diff --git a/parts/k8s/kubernetesmastercustomdata.yml b/parts/k8s/kubernetesmastercustomdata.yml index b4daf1e1f6..9dd2c0c422 100644 --- a/parts/k8s/kubernetesmastercustomdata.yml +++ b/parts/k8s/kubernetesmastercustomdata.yml @@ -253,7 +253,7 @@ MASTER_ARTIFACTS_CONFIG_PLACEHOLDER sed -i "s||{{WrapAsParameter "kubernetesHyperkubeSpec"}}|g" "/etc/kubernetes/manifests/kube-controller-manager.yaml" sed -i "s||{{WrapAsParameter "kubernetesHyperkubeSpec"}}|g" "/etc/kubernetes/manifests/kube-scheduler.yaml" sed -i "s||{{WrapAsParameter "kubernetesHyperkubeSpec"}}|g; s||{{WrapAsParameter "kubeClusterCidr"}}|g" "/etc/kubernetes/addons/kube-proxy-daemonset.yaml" -{{if and (IsKubernetesVersionGe "1.7.0") (not (IsKubernetesVersionGe "1.9.0"))}} +{{if NeedsKubeDNSPlusExecHealthz}} sed -i "s||{{WrapAsParameter "kubernetesKubeDNSSpec"}}|g; s||{{WrapAsParameter "kubernetesDNSMasqSpec"}}|g; s||{{WrapAsParameter "kubernetesExecHealthzSpec"}}|g; s||{{WrapAsParameter "kubernetesDNSSidecarSpec"}}|g; s||{{WrapAsParameter "kubernetesKubeletClusterDomain"}}|g; s||{{WrapAsParameter "kubeDNSServiceIP"}}|g" "/etc/kubernetes/addons/kube-dns-deployment.yaml" {{else if IsKubernetesVersionGe "1.12.0"}} sed -i "s||{{WrapAsParameter "kubernetesCoreDNSSpec"}}|g; s||{{WrapAsParameter "kubernetesKubeletClusterDomain"}}|g; s||{{WrapAsParameter "kubeDNSServiceIP"}}|g" "/etc/kubernetes/addons/coredns.yaml" diff --git a/parts/k8s/kubernetesmastercustomdatavmss.yml b/parts/k8s/kubernetesmastercustomdatavmss.yml index 46ce02a7d2..8f5491391d 100644 --- a/parts/k8s/kubernetesmastercustomdatavmss.yml +++ b/parts/k8s/kubernetesmastercustomdatavmss.yml @@ -255,7 +255,7 @@ MASTER_ARTIFACTS_CONFIG_PLACEHOLDER sed -i "s||{{WrapAsParameter "kubernetesHyperkubeSpec"}}|g" "/etc/kubernetes/manifests/kube-controller-manager.yaml" sed -i "s||{{WrapAsParameter "kubernetesHyperkubeSpec"}}|g" "/etc/kubernetes/manifests/kube-scheduler.yaml" sed -i "s||{{WrapAsParameter "kubernetesHyperkubeSpec"}}|g; s||{{WrapAsParameter "kubeClusterCidr"}}|g" "/etc/kubernetes/addons/kube-proxy-daemonset.yaml" -{{if and (IsKubernetesVersionGe "1.7.0") (not (IsKubernetesVersionGe "1.9.0"))}} +{{if NeedsKubeDNSPlusExecHealthz}} sed -i "s||{{WrapAsParameter "kubernetesKubeDNSSpec"}}|g; s||{{WrapAsParameter "kubernetesDNSMasqSpec"}}|g; s||{{WrapAsParameter "kubernetesExecHealthzSpec"}}|g; s||{{WrapAsParameter "kubernetesDNSSidecarSpec"}}|g; s||{{WrapAsParameter "kubernetesKubeletClusterDomain"}}|g; s||{{WrapAsParameter "kubeDNSServiceIP"}}|g" "/etc/kubernetes/addons/kube-dns-deployment.yaml" {{else if IsKubernetesVersionGe "1.12.0"}} sed -i "s||{{WrapAsParameter "kubernetesCoreDNSSpec"}}|g; s||{{WrapAsParameter "kubernetesKubeletClusterDomain"}}|g; s||{{WrapAsParameter "kubeDNSServiceIP"}}|g" "/etc/kubernetes/addons/coredns.yaml" diff --git a/parts/k8s/kubernetesparams.t b/parts/k8s/kubernetesparams.t index 9c2e99527a..235625ebf8 100644 --- a/parts/k8s/kubernetesparams.t +++ b/parts/k8s/kubernetesparams.t @@ -280,7 +280,7 @@ "defaultValue": false, "type": "bool" }, -{{if and (IsKubernetesVersionGe "1.7.0") (not (IsKubernetesVersionGe "1.9.0"))}} +{{if NeedsKubeDNSPlusExecHealthz}} "kubernetesExecHealthzSpec": { "metadata": { "description": "The container spec for exechealthz-amd64." diff --git a/pkg/acsengine/params_k8s.go b/pkg/acsengine/params_k8s.go index d7c69747a6..ea7f98d06a 100644 --- a/pkg/acsengine/params_k8s.go +++ b/pkg/acsengine/params_k8s.go @@ -8,7 +8,6 @@ import ( "time" "github.com/Azure/acs-engine/pkg/api" - "github.com/Azure/acs-engine/pkg/api/common" "github.com/Azure/acs-engine/pkg/helpers" ) @@ -47,7 +46,7 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params addValue(parametersMap, "kubernetesAddonManagerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["addonmanager"]) addValue(parametersMap, "kubernetesAddonResizerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["addonresizer"]) addValue(parametersMap, "kubernetesDNSMasqSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["dnsmasq"]) - if common.IsKubernetesVersionGe(properties.OrchestratorProfile.OrchestratorVersion, "1.7.0") && !common.IsKubernetesVersionGe(properties.OrchestratorProfile.OrchestratorVersion, "1.9.0") { + if orchestratorProfile.NeedsExecHealthz() { addValue(parametersMap, "kubernetesExecHealthzSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["exechealthz"]) } addValue(parametersMap, "kubernetesDNSSidecarSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["k8s-dns-sidecar"]) diff --git a/pkg/acsengine/template_generator.go b/pkg/acsengine/template_generator.go index 715f7f13fb..29872ad8b2 100644 --- a/pkg/acsengine/template_generator.go +++ b/pkg/acsengine/template_generator.go @@ -375,6 +375,9 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat "UseInstanceMetadata": func() bool { return helpers.IsTrueBoolPointer(cs.Properties.OrchestratorProfile.KubernetesConfig.UseInstanceMetadata) }, + "NeedsKubeDNSPlusExecHealthz": func() bool { + return cs.Properties.OrchestratorProfile.NeedsExecHealthz() + }, "LoadBalancerSku": func() string { return cs.Properties.OrchestratorProfile.KubernetesConfig.LoadBalancerSku }, diff --git a/pkg/api/types.go b/pkg/api/types.go index ee7575d69f..89d6817dde 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -1146,6 +1146,13 @@ func (o *OrchestratorProfile) RequireRouteTable() bool { } } +// NeedsExecHealthz returns whether or not we have a configuration that requires exechealthz pod anywhere +func (o *OrchestratorProfile) NeedsExecHealthz() bool { + return o.IsKubernetes() && + common.IsKubernetesVersionGe(o.OrchestratorVersion, "1.7.0") && + !common.IsKubernetesVersionGe(o.OrchestratorVersion, "1.7.0") +} + // HasAadProfile returns true if the has aad profile func (p *Properties) HasAadProfile() bool { return p.AADProfile != nil