2023-08-07 19:13:26 +00:00
|
|
|
// Copyright 2023 Woodpecker Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package kubernetes
|
|
|
|
|
2024-07-17 23:26:35 +00:00
|
|
|
import (
|
|
|
|
"github.com/urfave/cli/v3"
|
|
|
|
)
|
2023-08-07 19:13:26 +00:00
|
|
|
|
|
|
|
var Flags = []cli.Flag{
|
|
|
|
&cli.StringFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_NAMESPACE"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-k8s-namespace",
|
|
|
|
Usage: "backend k8s namespace",
|
|
|
|
Value: "woodpecker",
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_VOLUME_SIZE"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-k8s-volume-size",
|
|
|
|
Usage: "backend k8s volume size (default 10G)",
|
|
|
|
Value: "10G",
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_STORAGE_CLASS"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-k8s-storage-class",
|
|
|
|
Usage: "backend k8s storage class",
|
|
|
|
Value: "",
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_STORAGE_RWX"),
|
2023-08-07 19:13:26 +00:00
|
|
|
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{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_POD_LABELS"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-k8s-pod-labels",
|
2024-05-11 09:45:29 +00:00
|
|
|
Usage: "backend k8s additional Agent-wide worker pod labels",
|
2023-08-07 19:13:26 +00:00
|
|
|
Value: "",
|
|
|
|
},
|
2024-05-11 09:45:29 +00:00
|
|
|
&cli.BoolFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_POD_LABELS_ALLOW_FROM_STEP"),
|
2024-05-11 09:45:29 +00:00
|
|
|
Name: "backend-k8s-pod-labels-allow-from-step",
|
|
|
|
Usage: "whether to allow using labels from step's backend options",
|
|
|
|
Value: false,
|
|
|
|
},
|
2023-08-07 19:13:26 +00:00
|
|
|
&cli.StringFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_POD_ANNOTATIONS"),
|
2023-08-07 19:13:26 +00:00
|
|
|
Name: "backend-k8s-pod-annotations",
|
2024-05-11 09:45:29 +00:00
|
|
|
Usage: "backend k8s additional Agent-wide worker pod annotations",
|
2023-08-07 19:13:26 +00:00
|
|
|
Value: "",
|
|
|
|
},
|
2024-06-03 15:25:28 +00:00
|
|
|
&cli.StringFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_POD_NODE_SELECTOR"),
|
2024-06-03 15:25:28 +00:00
|
|
|
Name: "backend-k8s-pod-node-selector",
|
|
|
|
Usage: "backend k8s Agent-wide worker pod node selector",
|
|
|
|
Value: "",
|
|
|
|
},
|
2024-05-11 09:45:29 +00:00
|
|
|
&cli.BoolFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_POD_ANNOTATIONS_ALLOW_FROM_STEP"),
|
2024-05-11 09:45:29 +00:00
|
|
|
Name: "backend-k8s-pod-annotations-allow-from-step",
|
|
|
|
Usage: "whether to allow using annotations from step's backend options",
|
|
|
|
Value: false,
|
|
|
|
},
|
2023-11-26 07:46:06 +00:00
|
|
|
&cli.BoolFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_SECCTX_NONROOT"), // cspell:words secctx nonroot
|
2023-11-26 07:46:06 +00:00
|
|
|
Name: "backend-k8s-secctx-nonroot",
|
|
|
|
Usage: "`run as non root` Kubernetes security context option",
|
|
|
|
},
|
2024-01-05 07:33:56 +00:00
|
|
|
&cli.StringSliceFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_PULL_SECRET_NAMES"),
|
2024-01-05 07:33:56 +00:00
|
|
|
Name: "backend-k8s-pod-image-pull-secret-names",
|
|
|
|
Usage: "backend k8s pull secret names for private registries",
|
2024-07-17 23:26:35 +00:00
|
|
|
Value: []string{"regcred"},
|
2024-01-05 07:33:56 +00:00
|
|
|
},
|
2024-06-23 16:20:21 +00:00
|
|
|
&cli.BoolFlag{
|
2024-07-17 23:26:35 +00:00
|
|
|
Sources: cli.EnvVars("WOODPECKER_BACKEND_K8S_ALLOW_NATIVE_SECRETS"),
|
2024-06-23 16:20:21 +00:00
|
|
|
Name: "backend-k8s-allow-native-secrets",
|
|
|
|
Usage: "whether to allow existing Kubernetes secrets to be referenced from steps",
|
|
|
|
Value: false,
|
|
|
|
},
|
2023-08-07 19:13:26 +00:00
|
|
|
}
|