From ba5e3007d3e8df1421e31dc2d5ef6c32ac15862f Mon Sep 17 00:00:00 2001 From: tariqibrahim Date: Mon, 12 Nov 2018 11:48:18 -0800 Subject: [PATCH] consistent use of kubernetes image base --- pkg/acsengine/params_k8s.go | 26 +++++++++++++------------- pkg/acsengine/params_test.go | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/pkg/acsengine/params_k8s.go b/pkg/acsengine/params_k8s.go index 550253b043..1c6b6a901c 100644 --- a/pkg/acsengine/params_k8s.go +++ b/pkg/acsengine/params_k8s.go @@ -24,11 +24,11 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params k8sVersion := orchestratorProfile.OrchestratorVersion k8sComponents := api.K8sComponentsByVersionMap[k8sVersion] kubernetesConfig := orchestratorProfile.KubernetesConfig + kubernetesImageBase := kubernetesConfig.KubernetesImageBase if kubernetesConfig != nil { - if helpers.IsTrueBoolPointer(kubernetesConfig.UseCloudControllerManager) { - kubernetesCcmSpec := kubernetesConfig.KubernetesImageBase + k8sComponents["ccm"] + kubernetesCcmSpec := kubernetesImageBase + k8sComponents["ccm"] if kubernetesConfig.CustomCcmImage != "" { kubernetesCcmSpec = kubernetesConfig.CustomCcmImage } @@ -36,20 +36,20 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params addValue(parametersMap, "kubernetesCcmImageSpec", kubernetesCcmSpec) } - kubernetesHyperkubeSpec := kubernetesConfig.KubernetesImageBase + k8sComponents["hyperkube"] + kubernetesHyperkubeSpec := kubernetesImageBase + k8sComponents["hyperkube"] if kubernetesConfig.CustomHyperkubeImage != "" { kubernetesHyperkubeSpec = kubernetesConfig.CustomHyperkubeImage } addValue(parametersMap, "kubeDNSServiceIP", kubernetesConfig.DNSServiceIP) addValue(parametersMap, "kubernetesHyperkubeSpec", kubernetesHyperkubeSpec) - addValue(parametersMap, "kubernetesAddonManagerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["addonmanager"]) - addValue(parametersMap, "kubernetesAddonResizerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["addonresizer"]) + addValue(parametersMap, "kubernetesAddonManagerSpec", kubernetesImageBase+k8sComponents["addonmanager"]) + addValue(parametersMap, "kubernetesAddonResizerSpec", kubernetesImageBase+k8sComponents["addonresizer"]) if orchestratorProfile.NeedsExecHealthz() { - addValue(parametersMap, "kubernetesExecHealthzSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["exechealthz"]) + addValue(parametersMap, "kubernetesExecHealthzSpec", kubernetesImageBase+k8sComponents["exechealthz"]) } - addValue(parametersMap, "kubernetesDNSSidecarSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["k8s-dns-sidecar"]) - addValue(parametersMap, "kubernetesHeapsterSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["heapster"]) + addValue(parametersMap, "kubernetesDNSSidecarSpec", kubernetesImageBase+k8sComponents["k8s-dns-sidecar"]) + addValue(parametersMap, "kubernetesHeapsterSpec", kubernetesImageBase+k8sComponents["heapster"]) if kubernetesConfig.IsTillerEnabled() { tillerAddon := kubernetesConfig.GetAddonByName(DefaultTillerAddonName) tillerIndex := tillerAddon.GetAddonContainersIndexByName(DefaultTillerAddonName) @@ -163,7 +163,7 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params if metricsServerAddon.Containers[metricsServerIndex].Image != "" { addValue(parametersMap, "kubernetesMetricsServerSpec", metricsServerAddon.Containers[metricsServerIndex].Image) } else { - addValue(parametersMap, "kubernetesMetricsServerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents[DefaultMetricsServerAddonName]) + addValue(parametersMap, "kubernetesMetricsServerSpec", kubernetesImageBase+k8sComponents[DefaultMetricsServerAddonName]) } } } @@ -217,12 +217,12 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params } } if common.IsKubernetesVersionGe(k8sVersion, "1.12.0") { - addValue(parametersMap, "kubernetesCoreDNSSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["coredns"]) + addValue(parametersMap, "kubernetesCoreDNSSpec", kubernetesImageBase+k8sComponents["coredns"]) } else { - addValue(parametersMap, "kubernetesKubeDNSSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["kube-dns"]) - addValue(parametersMap, "kubernetesDNSMasqSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["dnsmasq"]) + addValue(parametersMap, "kubernetesKubeDNSSpec", kubernetesImageBase+k8sComponents["kube-dns"]) + addValue(parametersMap, "kubernetesDNSMasqSpec", kubernetesImageBase+k8sComponents["dnsmasq"]) } - addValue(parametersMap, "kubernetesPodInfraContainerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["pause"]) + addValue(parametersMap, "kubernetesPodInfraContainerSpec", kubernetesImageBase+k8sComponents["pause"]) addValue(parametersMap, "cloudproviderConfig", api.CloudProviderConfig{ CloudProviderBackoff: kubernetesConfig.CloudProviderBackoff, CloudProviderBackoffRetries: kubernetesConfig.CloudProviderBackoffRetries, diff --git a/pkg/acsengine/params_test.go b/pkg/acsengine/params_test.go index a045ee80ad..20e8c3e2d2 100644 --- a/pkg/acsengine/params_test.go +++ b/pkg/acsengine/params_test.go @@ -34,6 +34,7 @@ func TestAssignParameters(t *testing.T) { } containerService.Location = "eastus" + containerService.SetPropertiesDefaults(false, false) parametersMap, err := getParameters(containerService, DefaultGeneratorCode, "testversion") if err != nil { t.Errorf("should not get error when populating parameters")