kubeadm: fix an issue with the kube-proxy container env. variables

3993c42431 introduced the propagation of *_PROXY
host env. variables to the kube-proxy container.

To allow The NODE_NAME variable to be properly updated by the downward
API make, sure we preserve the existing variables when adding *_PROXY.
This commit is contained in:
Lubomir I. Ivanov 2019-11-07 02:59:55 +02:00
parent e328029255
commit 0b4e5ee3b8

View File

@ -129,8 +129,9 @@ func createKubeProxyAddon(configMapBytes, daemonSetbytes []byte, client clientse
if err := kuberuntime.DecodeInto(clientsetscheme.Codecs.UniversalDecoder(), daemonSetbytes, kubeproxyDaemonSet); err != nil {
return errors.Wrap(err, "unable to decode kube-proxy daemonset")
}
// propagate http/https proxy env vars
kubeproxyDaemonSet.Spec.Template.Spec.Containers[0].Env = kubeadmutil.GetProxyEnvVars()
// Propagate the http/https proxy host environment variables to the container
env := &kubeproxyDaemonSet.Spec.Template.Spec.Containers[0].Env
*env = append(*env, kubeadmutil.GetProxyEnvVars()...)
// Create the DaemonSet for kube-proxy or update it in case it already exists
return apiclient.CreateOrUpdateDaemonSet(client, kubeproxyDaemonSet)