Disable some flags in kube-apiserver when logging-format is not text

Disable these flags because these are not accepted.
* --logtostderr
* --alsologtostderr
* --log-file
This commit is contained in:
AkiraFukushima 2022-02-17 00:41:06 +09:00 committed by Ciprian Hacman
parent 1378e62bdb
commit 4bc9ea1225
1 changed files with 11 additions and 5 deletions

View File

@ -666,11 +666,17 @@ func (b *KubeAPIServerBuilder) buildPod(kubeAPIServer *kops.KubeAPIServerConfig)
container.Args = append(container.Args, sortedStrings(flags)...)
} else {
container.Command = []string{"/usr/local/bin/kube-apiserver"}
container.Args = append(
sortedStrings(flags),
"--logtostderr=false", // https://github.com/kubernetes/klog/issues/60
"--alsologtostderr",
"--log-file=/var/log/kube-apiserver.log")
if kubeAPIServer.LogFormat != "" && kubeAPIServer.LogFormat != "text" {
// When logging-format is not text, some flags are not accepted.
// https://github.com/kubernetes/kops/issues/13245
container.Args = sortedStrings(flags)
} else {
container.Args = append(
sortedStrings(flags),
"--logtostderr=false", // https://github.com/kubernetes/klog/issues/60
"--alsologtostderr",
"--log-file=/var/log/kube-apiserver.log")
}
}
for _, path := range b.SSLHostPaths() {