Disable some flags in kube-controller-manager and kube-scheduler 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-08-12 01:11:57 +09:00 committed by Ciprian Hacman
parent e19fc773d6
commit cb6398fce5
2 changed files with 22 additions and 10 deletions

View File

@ -252,11 +252,17 @@ func (b *KubeControllerManagerBuilder) buildPod(kcm *kops.KubeControllerManagerC
container.Args = append(container.Args, sortedStrings(flags)...)
} else {
container.Command = []string{"/usr/local/bin/kube-controller-manager"}
container.Args = append(
sortedStrings(flags),
"--logtostderr=false", // https://github.com/kubernetes/klog/issues/60
"--alsologtostderr",
"--log-file=/var/log/kube-controller-manager.log")
if kcm.LogFormat != "" && kcm.LogFormat != "text" {
// When logging-format is not text, some flags are not accepted.
// https://github.com/kubernetes/kops/issues/14100
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-controller-manager.log")
}
}
for _, path := range b.SSLHostPaths() {
name := strings.Replace(path, "/", "", -1)

View File

@ -264,11 +264,17 @@ func (b *KubeSchedulerBuilder) buildPod(kubeScheduler *kops.KubeSchedulerConfig)
container.Args = append(container.Args, sortedStrings(flags)...)
} else {
container.Command = []string{"/usr/local/bin/kube-scheduler"}
container.Args = append(
sortedStrings(flags),
"--logtostderr=false", // https://github.com/kubernetes/klog/issues/60
"--alsologtostderr",
"--log-file=/var/log/kube-scheduler.log")
if kubeScheduler.LogFormat != "" && kubeScheduler.LogFormat != "text" {
// When logging-format is not text, some flags are not accepted.
// https://github.com/kubernetes/kops/issues/14100
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-scheduler.log")
}
}
if kubeScheduler.MaxPersistentVolumes != nil {