kubernetes

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EngineName = "kubernetes"
)
View Source
const (
	ServiceLabel = "service"
)
View Source
const (
	StepLabel = "step"
)

Variables

View Source
var (
	ErrDNSPatternInvalid = errors.New("name is not a valid kubernetes DNS name")
)
View Source
var Flags = []cli.Flag{
	&cli.StringFlag{
		EnvVars: []string{"WOODPECKER_BACKEND_K8S_NAMESPACE"},
		Name:    "backend-k8s-namespace",
		Usage:   "backend k8s namespace",
		Value:   "woodpecker",
	},
	&cli.StringFlag{
		EnvVars: []string{"WOODPECKER_BACKEND_K8S_VOLUME_SIZE"},
		Name:    "backend-k8s-volume-size",
		Usage:   "backend k8s volume size (default 10G)",
		Value:   "10G",
	},
	&cli.StringFlag{
		EnvVars: []string{"WOODPECKER_BACKEND_K8S_STORAGE_CLASS"},
		Name:    "backend-k8s-storage-class",
		Usage:   "backend k8s storage class",
		Value:   "",
	},
	&cli.BoolFlag{
		EnvVars: []string{"WOODPECKER_BACKEND_K8S_STORAGE_RWX"},
		Name:    "backend-k8s-storage-rwx",
		Usage:   "backend k8s storage access mode, should ReadWriteMany (RWX) instead of ReadWriteOnce (RWO) be used? (default: true)",
		Value:   true,
	},
	&cli.StringFlag{
		EnvVars: []string{"WOODPECKER_BACKEND_K8S_POD_LABELS"},
		Name:    "backend-k8s-pod-labels",
		Usage:   "backend k8s additional Agent-wide worker pod labels",
		Value:   "",
	},
	&cli.BoolFlag{
		EnvVars: []string{"WOODPECKER_BACKEND_K8S_POD_LABELS_ALLOW_FROM_STEP"},
		Name:    "backend-k8s-pod-labels-allow-from-step",
		Usage:   "whether to allow using labels from step's backend options",
		Value:   false,
	},
	&cli.StringFlag{
		EnvVars: []string{"WOODPECKER_BACKEND_K8S_POD_ANNOTATIONS"},
		Name:    "backend-k8s-pod-annotations",
		Usage:   "backend k8s additional Agent-wide worker pod annotations",
		Value:   "",
	},
	&cli.StringFlag{
		EnvVars: []string{"WOODPECKER_BACKEND_K8S_POD_NODE_SELECTOR"},
		Name:    "backend-k8s-pod-node-selector",
		Usage:   "backend k8s Agent-wide worker pod node selector",
		Value:   "",
	},
	&cli.BoolFlag{
		EnvVars: []string{"WOODPECKER_BACKEND_K8S_POD_ANNOTATIONS_ALLOW_FROM_STEP"},
		Name:    "backend-k8s-pod-annotations-allow-from-step",
		Usage:   "whether to allow using annotations from step's backend options",
		Value:   false,
	},
	&cli.BoolFlag{
		EnvVars: []string{"WOODPECKER_BACKEND_K8S_SECCTX_NONROOT"},
		Name:    "backend-k8s-secctx-nonroot",
		Usage:   "`run as non root` Kubernetes security context option",
	},
	&cli.StringSliceFlag{
		EnvVars: []string{"WOODPECKER_BACKEND_K8S_PULL_SECRET_NAMES"},
		Name:    "backend-k8s-pod-image-pull-secret-names",
		Usage:   "backend k8s pull secret names for private registries",
		Value:   cli.NewStringSlice("regcred"),
	},
}

Functions

func New

func New() types.Backend

New returns a new Kubernetes Backend.

Types

type BackendOptions added in v2.4.0

type BackendOptions struct {
	Resources          Resources         `mapstructure:"resources"`
	RuntimeClassName   *string           `mapstructure:"runtimeClassName"`
	ServiceAccountName string            `mapstructure:"serviceAccountName"`
	Labels             map[string]string `mapstructure:"labels"`
	Annotations        map[string]string `mapstructure:"annotations"`
	NodeSelector       map[string]string `mapstructure:"nodeSelector"`
	Tolerations        []Toleration      `mapstructure:"tolerations"`
	SecurityContext    *SecurityContext  `mapstructure:"securityContext"`
}

BackendOptions defines all the advanced options for the kubernetes backend.

type Resources added in v2.4.0

type Resources struct {
	Requests map[string]string `mapstructure:"requests"`
	Limits   map[string]string `mapstructure:"limits"`
}

Resources defines two maps for kubernetes resource definitions.

type SecProfile added in v2.4.0

type SecProfile struct {
	Type             SecProfileType `mapstructure:"type"`
	LocalhostProfile string         `mapstructure:"localhostProfile"`
}

type SecProfileType added in v2.4.0

type SecProfileType string
const (
	SecProfileTypeRuntimeDefault SecProfileType = "RuntimeDefault"
	SecProfileTypeLocalhost      SecProfileType = "Localhost"
)

type SecurityContext added in v2.4.0

type SecurityContext struct {
	Privileged      *bool       `mapstructure:"privileged"`
	RunAsNonRoot    *bool       `mapstructure:"runAsNonRoot"`
	RunAsUser       *int64      `mapstructure:"runAsUser"`
	RunAsGroup      *int64      `mapstructure:"runAsGroup"`
	FSGroup         *int64      `mapstructure:"fsGroup"`
	SeccompProfile  *SecProfile `mapstructure:"seccompProfile"`
	ApparmorProfile *SecProfile `mapstructure:"apparmorProfile"`
}

type SecurityContextConfig

type SecurityContextConfig struct {
	RunAsNonRoot bool
}

type TaintEffect added in v2.4.0

type TaintEffect string
const (
	TaintEffectNoSchedule       TaintEffect = "NoSchedule"
	TaintEffectPreferNoSchedule TaintEffect = "PreferNoSchedule"
	TaintEffectNoExecute        TaintEffect = "NoExecute"
)

type Toleration added in v2.4.0

type Toleration struct {
	Key               string             `mapstructure:"key"`
	Operator          TolerationOperator `mapstructure:"operator"`
	Value             string             `mapstructure:"value"`
	Effect            TaintEffect        `mapstructure:"effect"`
	TolerationSeconds *int64             `mapstructure:"tolerationSeconds"`
}

Toleration defines Kubernetes toleration.

type TolerationOperator added in v2.4.0

type TolerationOperator string
const (
	TolerationOpExists TolerationOperator = "Exists"
	TolerationOpEqual  TolerationOperator = "Equal"
)

Jump to

Keyboard shortcuts

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