From 5f7c36a4e97e5d26df08a5e1986d5c52349f224c Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Wed, 28 Feb 2024 14:32:28 +0200 Subject: [PATCH] kubeadm: fix a bug in default apiserver "authorizaion-mode" When the flag is defaulted before writing the apiserver manifest, the input "cfg" object should not be mutated. If the "cfg" is mutated, the upload ClusterConfiguration to the cluster will include the defaulting, which is not needed. --- cmd/kubeadm/app/phases/controlplane/manifests.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/kubeadm/app/phases/controlplane/manifests.go b/cmd/kubeadm/app/phases/controlplane/manifests.go index eb99238fe9b..ae8d2199de5 100644 --- a/cmd/kubeadm/app/phases/controlplane/manifests.go +++ b/cmd/kubeadm/app/phases/controlplane/manifests.go @@ -229,7 +229,7 @@ func getAPIServerCommand(cfg *kubeadmapi.ClusterConfiguration, localAPIEndpoint cfg.APIServer.ExtraArgs = []kubeadmapi.Arg{} } authzVal, _ := kubeadmapi.GetArgValue(cfg.APIServer.ExtraArgs, "authorization-mode", -1) - cfg.APIServer.ExtraArgs = kubeadmapi.SetArgValues(cfg.APIServer.ExtraArgs, "authorization-mode", getAuthzModes(authzVal), 1) + defaultArguments = kubeadmapi.SetArgValues(defaultArguments, "authorization-mode", getAuthzModes(authzVal), 1) command = append(command, kubeadmutil.ArgumentsToCommand(defaultArguments, cfg.APIServer.ExtraArgs)...) return command