From 962dcc1d5400ab782858c73ecfb5dcdab07b02d4 Mon Sep 17 00:00:00 2001 From: Jack Francis Date: Thu, 31 May 2018 16:13:26 -0700 Subject: [PATCH] =?UTF-8?q?calico=20needs=20kubelet=20config=20=E2=80=94ne?= =?UTF-8?q?twork-config=3Dcni=20(#3128)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/acsengine/defaults-kubelet.go | 4 +++- pkg/acsengine/defaults-kubelet_test.go | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/acsengine/defaults-kubelet.go b/pkg/acsengine/defaults-kubelet.go index 9437fc3c08..ca0b18c2b0 100644 --- a/pkg/acsengine/defaults-kubelet.go +++ b/pkg/acsengine/defaults-kubelet.go @@ -61,7 +61,9 @@ func setKubeletConfig(cs *api.ContainerService) { // Override default --network-plugin? if o.KubernetesConfig.NetworkPlugin == NetworkPluginKubenet { - o.KubernetesConfig.KubeletConfig["--network-plugin"] = NetworkPluginKubenet + if o.KubernetesConfig.NetworkPolicy != NetworkPolicyCalico { + o.KubernetesConfig.KubeletConfig["--network-plugin"] = NetworkPluginKubenet + } o.KubernetesConfig.KubeletConfig["--max-pods"] = strconv.Itoa(DefaultKubernetesMaxPods) } diff --git a/pkg/acsengine/defaults-kubelet_test.go b/pkg/acsengine/defaults-kubelet_test.go index b26e64926a..a6a927048a 100644 --- a/pkg/acsengine/defaults-kubelet_test.go +++ b/pkg/acsengine/defaults-kubelet_test.go @@ -173,3 +173,14 @@ func TestKubeletMaxPods(t *testing.T) { NetworkPluginKubenet, k["--max-pods"]) } } + +func TestKubeletCalico(t *testing.T) { + cs := createContainerService("testcluster", defaultTestClusterVer, 3, 2) + cs.Properties.OrchestratorProfile.KubernetesConfig.NetworkPolicy = NetworkPolicyCalico + setKubeletConfig(cs) + k := cs.Properties.OrchestratorProfile.KubernetesConfig.KubeletConfig + if k["--network-plugin"] != "cni" { + t.Fatalf("got unexpected '--network-plugin' kubelet config value for NetworkPolicy=%s: %s", + NetworkPolicyCalico, k["--network-plugin"]) + } +}