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{ Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_NAMESPACE"), Name: "backend-k8s-namespace", Usage: "backend k8s namespace", Value: "woodpecker", }, &cli.StringFlag{ Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_VOLUME_SIZE"), Name: "backend-k8s-volume-size", Usage: "backend k8s volume size (default 10G)", Value: "10G", }, &cli.StringFlag{ Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_STORAGE_CLASS"), Name: "backend-k8s-storage-class", Usage: "backend k8s storage class", Value: "", }, &cli.BoolFlag{ Sources: cli.EnvVars("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{ Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_POD_LABELS"), Name: "backend-k8s-pod-labels", Usage: "backend k8s additional Agent-wide worker pod labels", Value: "", }, &cli.BoolFlag{ Sources: cli.EnvVars("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{ Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_POD_ANNOTATIONS"), Name: "backend-k8s-pod-annotations", Usage: "backend k8s additional Agent-wide worker pod annotations", Value: "", }, &cli.StringFlag{ Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_POD_NODE_SELECTOR"), Name: "backend-k8s-pod-node-selector", Usage: "backend k8s Agent-wide worker pod node selector", Value: "", }, &cli.BoolFlag{ Sources: cli.EnvVars("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{ Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_SECCTX_NONROOT"), Name: "backend-k8s-secctx-nonroot", Usage: "`run as non root` Kubernetes security context option", }, &cli.StringSliceFlag{ Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_PULL_SECRET_NAMES"), Name: "backend-k8s-pod-image-pull-secret-names", Usage: "backend k8s pull secret names for private registries", Value: []string{"regcred"}, }, &cli.BoolFlag{ Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_ALLOW_NATIVE_SECRETS"), Name: "backend-k8s-allow-native-secrets", Usage: "whether to allow existing Kubernetes secrets to be referenced from steps", Value: false, }, }
Functions ¶
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"` Secrets []SecretRef `mapstructure:"secrets"` }
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 SecretRef ¶ added in v2.7.0
type SecretRef struct { Name string `mapstructure:"name"` Key string `mapstructure:"key"` Target SecretTarget `mapstructure:"target"` }
SecretRef defines Kubernetes secret reference.
type SecretTarget ¶ added in v2.7.0
SecretTarget defines secret mount target.
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" )
Click to show internal directories.
Click to hide internal directories.