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.
This commit is contained in:
Lubomir I. Ivanov 2024-02-28 14:32:28 +02:00
parent 12217672a3
commit 5f7c36a4e9

View File

@ -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