You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-23 21:44:44 +02:00
Add runtimeClassName in Kubernetes backend options (#3474)
Resolves #3473 --------- Co-authored-by: Thomas Anderson <127358482+zc-devs@users.noreply.github.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
// BackendOptions defines all the advanced options for the kubernetes backend
|
||||
type BackendOptions struct {
|
||||
Resources Resources `mapstructure:"resources"`
|
||||
RuntimeClassName *string `mapstructure:"runtimeClassName"`
|
||||
ServiceAccountName string `mapstructure:"serviceAccountName"`
|
||||
NodeSelector map[string]string `mapstructure:"nodeSelector"`
|
||||
Tolerations []Toleration `mapstructure:"tolerations"`
|
||||
|
||||
@@ -117,6 +117,7 @@ func podSpec(step *types.Step, config *config, options BackendOptions) (v1.PodSp
|
||||
var err error
|
||||
spec := v1.PodSpec{
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
RuntimeClassName: options.RuntimeClassName,
|
||||
ServiceAccountName: options.ServiceAccountName,
|
||||
ImagePullSecrets: imagePullSecretsReferences(config.ImagePullSecretNames),
|
||||
HostAliases: hostAliases(step.ExtraHosts),
|
||||
|
||||
@@ -245,6 +245,7 @@ func TestFullPod(t *testing.T) {
|
||||
"nodeSelector": {
|
||||
"storage": "ssd"
|
||||
},
|
||||
"runtimeClassName": "runc",
|
||||
"serviceAccountName": "wp-svc-acc",
|
||||
"securityContext": {
|
||||
"runAsUser": 101,
|
||||
@@ -289,6 +290,7 @@ func TestFullPod(t *testing.T) {
|
||||
"status": {}
|
||||
}`
|
||||
|
||||
runtimeClass := "runc"
|
||||
hostAliases := []types.HostAlias{
|
||||
{Name: "cloudflare", IP: "1.1.1.1"},
|
||||
{Name: "cf.v6", IP: "2606:4700:4700::64"},
|
||||
@@ -333,6 +335,7 @@ func TestFullPod(t *testing.T) {
|
||||
SecurityContext: SecurityContextConfig{RunAsNonRoot: false},
|
||||
}, "wp-01he8bebctabr3kgk0qj36d2me-0", "linux/amd64", BackendOptions{
|
||||
NodeSelector: map[string]string{"storage": "ssd"},
|
||||
RuntimeClassName: &runtimeClass,
|
||||
ServiceAccountName: "wp-svc-acc",
|
||||
Tolerations: []Toleration{{Key: "net-port", Value: "100Mbit", Effect: TaintEffectNoSchedule}},
|
||||
Resources: Resources{
|
||||
|
||||
Reference in New Issue
Block a user