Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

consistent use of kubernetes image base #4233

Merged
merged 5 commits into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions pkg/acsengine/params_k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,32 @@ 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
}

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"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tariq1890 won't this change break China contexts? That context depends upon the image base string being derived from the KubernetesSpecConfig, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubernetesImageBase is derived from cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase. defaults.go does that. So I don't think it will break china contexts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In china contexts cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase will return the mooncake image base.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for confirming!

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.IsAADPodIdentityEnabled() {
aadPodIdentityAddon := kubernetesConfig.GetAddonByName(DefaultAADPodIdentityAddonName)
aadIndex := aadPodIdentityAddon.GetAddonContainersIndexByName(DefaultAADPodIdentityAddonName)
Expand Down Expand Up @@ -79,12 +79,12 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
addValue(parametersMap, "kuberneteselbsvcname", fmt.Sprintf("%d", elbsvcName))
}
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,
Expand Down
1 change: 1 addition & 0 deletions pkg/acsengine/params_k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestAssignKubernetesParameters(t *testing.T) {
parametersMap := paramsMap{}
containerService.Location = "eatsus"
cloudSpecConfig := containerService.GetCloudSpecConfig()
containerService.SetPropertiesDefaults(false, false)
assignKubernetesParameters(containerService.Properties, parametersMap, cloudSpecConfig, DefaultGeneratorCode)
for k, v := range parametersMap {
switch val := v.(paramsMap)["value"].(type) {
Expand Down
1 change: 1 addition & 0 deletions pkg/acsengine/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 1 addition & 2 deletions pkg/api/defaults-kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

func (cs *ContainerService) setKubeletConfig() {
o := cs.Properties.OrchestratorProfile
cloudSpecConfig := cs.GetCloudSpecConfig()
staticLinuxKubeletConfig := map[string]string{
"--address": "0.0.0.0",
"--allow-privileged": "true",
Expand Down Expand Up @@ -48,7 +47,7 @@ func (cs *ContainerService) setKubeletConfig() {
defaultKubeletConfig := map[string]string{
"--cluster-domain": "cluster.local",
"--network-plugin": "cni",
"--pod-infra-container-image": cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase + K8sComponentsByVersionMap[o.OrchestratorVersion]["pause"],
"--pod-infra-container-image": o.KubernetesConfig.KubernetesImageBase + K8sComponentsByVersionMap[o.OrchestratorVersion]["pause"],
"--max-pods": strconv.Itoa(DefaultKubernetesMaxPods),
"--eviction-hard": DefaultKubernetesHardEvictionThreshold,
"--node-status-update-frequency": K8sComponentsByVersionMap[o.OrchestratorVersion]["nodestatusfreq"],
Expand Down