From 0b4e5ee3b84abc7166ab75f06a4094fa08591419 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Thu, 7 Nov 2019 02:59:55 +0200 Subject: [PATCH] kubeadm: fix an issue with the kube-proxy container env. variables 3993c42431a622f 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. --- cmd/kubeadm/app/phases/addons/proxy/proxy.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/kubeadm/app/phases/addons/proxy/proxy.go b/cmd/kubeadm/app/phases/addons/proxy/proxy.go index d302f41c544..36a840e1c36 100644 --- a/cmd/kubeadm/app/phases/addons/proxy/proxy.go +++ b/cmd/kubeadm/app/phases/addons/proxy/proxy.go @@ -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)