k8s

package
v0.0.0-...-ea74aed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JobSelectorKey   = "app.kubernetes.io/managed-by"
	JobSelectorValue = "actions-job-dispatcher"
	JobSelector      = labels.Set(map[string]string{JobSelectorKey: JobSelectorValue})
)

Functions

func CreateJob

func CreateJob(ctx context.Context, job batchv1.Job) (*batchv1.Job, error)

func ListJobs

func ListJobs(ctx context.Context) ([]batchv1.Job, error)

func Version

func Version() (*version.Info, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func GetClient

func GetClient() (*Client, error)

func (*Client) CreateJob

func (c *Client) CreateJob(ctx context.Context, job batchv1.Job) (*batchv1.Job, error)

func (*Client) ListJobs

func (c *Client) ListJobs(ctx context.Context) ([]batchv1.Job, error)

func (*Client) Version

func (c *Client) Version() (*version.Info, error)

type EnvMap

type EnvMap map[string]string

func (EnvMap) Add

func (m EnvMap) Add(key string, value string)

func (EnvMap) EnvVarList

func (m EnvMap) EnvVarList() []corev1.EnvVar

func (EnvMap) MaybeAdd

func (m EnvMap) MaybeAdd(key string, value *string)

type Job

type Job struct {
	Env         EnvMap
	Annotations PrefixMap
	Labels      PrefixMap
}

func NewRunnerJob

func NewRunnerJob() Job

func (Job) AddAnnotation

func (j Job) AddAnnotation(key, value string)

func (Job) AddEnv

func (j Job) AddEnv(key, value string)

func (Job) AddLabel

func (j Job) AddLabel(key, value string)

func (Job) Hash

func (j Job) Hash(labels config.Labels) string

func (Job) Render

func (j Job) Render(runner config.RunnerConfig) batchv1.Job

note: need to include env vars "RUNNER_TOKEN" with a registration token

type PrefixMap

type PrefixMap map[string]string

func PrefixMapFromLabels

func PrefixMapFromLabels(m map[string]string) PrefixMap

creates a prefix map using only keys that have the matching prefix

func (PrefixMap) Add

func (m PrefixMap) Add(key string, value any)

func (PrefixMap) Extract

func (m PrefixMap) Extract() map[string]string

returns a map without prefixed keys

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL