mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Merge pull request #72518 from bart0sh/PR0055-selfhosting-pivot-controller-manager-config
kubeadm selfhosting: fix pod spec mutation for controller-manager
This commit is contained in:
commit
103813057c
@ -159,7 +159,14 @@ func setSelfHostedVolumesForControllerManager(podSpec *v1.PodSpec) {
|
||||
// This is not a problem with hostPath mounts as hostPath supports mounting one file only, instead of always a full directory. Secrets and Projected Volumes
|
||||
// don't support that.
|
||||
podSpec.Containers[0].Command = kubeadmutil.ReplaceArgument(podSpec.Containers[0].Command, func(argMap map[string]string) map[string]string {
|
||||
argMap["kubeconfig"] = filepath.Join(selfHostedKubeConfigDir, kubeadmconstants.ControllerManagerKubeConfigFileName)
|
||||
controllerManagerKubeConfigPath := filepath.Join(selfHostedKubeConfigDir, kubeadmconstants.ControllerManagerKubeConfigFileName)
|
||||
argMap["kubeconfig"] = controllerManagerKubeConfigPath
|
||||
if _, ok := argMap["authentication-kubeconfig"]; ok {
|
||||
argMap["authentication-kubeconfig"] = controllerManagerKubeConfigPath
|
||||
}
|
||||
if _, ok := argMap["authorization-kubeconfig"]; ok {
|
||||
argMap["authorization-kubeconfig"] = controllerManagerKubeConfigPath
|
||||
}
|
||||
return argMap
|
||||
})
|
||||
}
|
||||
|
@ -414,6 +414,8 @@ func TestSetSelfHostedVolumesForControllerManager(t *testing.T) {
|
||||
},
|
||||
Command: []string{
|
||||
"--kubeconfig=/etc/kubernetes/controller-manager.conf",
|
||||
"--authentication-kubeconfig=/etc/kubernetes/controller-manager.conf",
|
||||
"--authorization-kubeconfig=/etc/kubernetes/controller-manager.conf",
|
||||
"--foo=bar",
|
||||
},
|
||||
},
|
||||
@ -467,6 +469,8 @@ func TestSetSelfHostedVolumesForControllerManager(t *testing.T) {
|
||||
},
|
||||
Command: []string{
|
||||
"--kubeconfig=/etc/kubernetes/kubeconfig/controller-manager.conf",
|
||||
"--authentication-kubeconfig=/etc/kubernetes/kubeconfig/controller-manager.conf",
|
||||
"--authorization-kubeconfig=/etc/kubernetes/kubeconfig/controller-manager.conf",
|
||||
"--foo=bar",
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user