Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
fix: apiserver flag parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
raffis committed Feb 9, 2024
1 parent eccf40d commit 19702e9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ docker pull ghcr.io/doodlescheduling/yakmv:v0
| `` | `--namespace` | `` | `NAMESPACE` | Default namespace to apply to resources without a namespace |
| `` | `--skip-auto-namespace` | `SKIP_AUTO_NAMESPACE` | `false` | Do not create a namespace if it does not exists yet while validating a resource |
| `` | `--table` | `TABLE` | `false` | |
| `` | `--api-server-flags` | `API_SERVER_FLAGS` | `--api-server-flags=--disable-admission-plugins=MutatingAdmissionWebhook,ValidatingAdmissionPolicy,ValidatingAdmissionWebhook` | Set additional kube-apiserver flags. (Note: If set by env the arguments need to be delimited by `;`) |
| `` | `--api-server-flags` | `API_SERVER_FLAGS` | `--api-server-flags="--disable-admission-plugins=MutatingAdmissionWebhook,ValidatingAdmissionPolicy,ValidatingAdmissionWebhook"` | Set additional kube-apiserver flags. |


## Github Action
Expand Down
28 changes: 14 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ type Config struct {
Level string `env:"LOG_LEVEL, default=fatal"`
Encoding string `env:"LOG_ENCODING, default=json"`
}
File string `env:"FILE, default=/dev/stdin"`
FailFast bool `env:"FAIL_FAST"`
AllowFailure bool `env:"ALLOW_FAILURE"`
SkipAutoNamespace bool `env:"SKIP_AUTO_NAMESPACE"`
Namespace string `env:"NAMESPACE"`
Table bool `env:"TABLE"`
ExcludeValid bool `env:"EXCLUDE_VALID"`
KubeVersion string `env:"KUBE_VERSION, default=1.28.0"`
EtcdVersion string `env:"ETCD_VERSION, default=3.5.11"`
ApiServerRegistry string `env:"API_SERVER_REGISTRY, default=registry.k8s.io/kube-apiserver"`
EtcdRegistry string `env:"ETCD_REGISTRY, default=quay.io/coreos/etcd"`
ApiServerFlags []string `env:"API_SERVER_FLAGS, delimiter=;, default=--api-server-flags=--disable-admission-plugins=MutatingAdmissionWebhook,ValidatingAdmissionPolicy,ValidatingAdmissionWebhook"`
File string `env:"FILE, default=/dev/stdin"`
FailFast bool `env:"FAIL_FAST"`
AllowFailure bool `env:"ALLOW_FAILURE"`
SkipAutoNamespace bool `env:"SKIP_AUTO_NAMESPACE"`
Namespace string `env:"NAMESPACE"`
Table bool `env:"TABLE"`
ExcludeValid bool `env:"EXCLUDE_VALID"`
KubeVersion string `env:"KUBE_VERSION, default=1.28.0"`
EtcdVersion string `env:"ETCD_VERSION, default=3.5.11"`
ApiServerRegistry string `env:"API_SERVER_REGISTRY, default=registry.k8s.io/kube-apiserver"`
EtcdRegistry string `env:"ETCD_REGISTRY, default=quay.io/coreos/etcd"`
ApiServerFlags string `env:"API_SERVER_FLAGS, default=--disable-admission-plugins=MutatingAdmissionWebhook,ValidatingAdmissionPolicy,ValidatingAdmissionWebhook"`
}

var (
Expand All @@ -87,7 +87,7 @@ func init() {
flag.StringVarP(&config.ApiServerRegistry, "api-server-registry", "", "", "OCI registry for pulling the kube-apiserver image")
flag.StringVarP(&config.EtcdRegistry, "etcd-registry", "", "", "OCI registry for pulling the etcd image")
flag.StringVarP(&config.EtcdVersion, "etcd-version", "", "", "The version for etcd")
flag.StringSliceVarP(&config.ApiServerFlags, "api-server-flags", "", nil, "Set additional kube-apiserver flags")
flag.StringVarP(&config.ApiServerFlags, "api-server-flags", "", "", "Set additional kube-apiserver flags")

tbl = table.NewWriter()
tbl.SetOutputMirror(output)
Expand Down Expand Up @@ -529,7 +529,7 @@ func startAPIServer(ctx context.Context, dockerClient *dockerclient.Client, etcd
"--service-account-signing-key-file=/certs/service-account-key.pem",
"--token-auth-file=/certs/token",
"--enable-priority-and-fairness=false",
}, config.ApiServerFlags...)
}, strings.Split(config.ApiServerFlags, " ")...)

tag, _ := strings.CutPrefix(config.KubeVersion, "v")
cont, err := dockerClient.ContainerCreate(
Expand Down

0 comments on commit 19702e9

Please sign in to comment.