consistent use of kubernetes image base (#4233)

This commit is contained in:
Tariq Ibrahim 2018-11-14 13:51:11 -08:00 коммит произвёл Jack Francis
Родитель 4a65d73215
Коммит 615de60f47
5 изменённых файлов: 16 добавлений и 15 удалений

Просмотреть файл

@ -59,7 +59,7 @@ To learn more about supported orchestrators and versions, run the orchestrators
| gcHighThreshold | no | Sets the --image-gc-high-threshold value on the kublet configuration. Default is 85. [See kubelet Garbage Collection](https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/) | | gcHighThreshold | no | Sets the --image-gc-high-threshold value on the kublet configuration. Default is 85. [See kubelet Garbage Collection](https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/) |
| gcLowThreshold | no | Sets the --image-gc-low-threshold value on the kublet configuration. Default is 80. [See kubelet Garbage Collection](https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/) | | gcLowThreshold | no | Sets the --image-gc-low-threshold value on the kublet configuration. Default is 80. [See kubelet Garbage Collection](https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/) |
| kubeletConfig | no | Configure various runtime configuration for kubelet. See `kubeletConfig` [below](#feat-kubelet-config) | | kubeletConfig | no | Configure various runtime configuration for kubelet. See `kubeletConfig` [below](#feat-kubelet-config) |
| kubernetesImageBase | no | Specifies the base URL (everything preceding the actual image filename) of the kubernetes hyperkube image to use for cluster deployment, e.g., `k8s.gcr.io/` | | kubernetesImageBase | no | Specifies the default image base URL (everything preceding the actual image filename) to be used for all kubernetes-related containers such as hyperkube, cloud-controller-manager, pause, addon-manager, heapster, exechealthz etc. e.g., `k8s.gcr.io/` |
| loadBalancerSku | no | Sku of Load Balancer and Public IP. Candidate values are: `basic` and `standard`. If not set, it will be default to basic. Requires Kubernetes 1.11 or newer. NOTE: VMs behind ILB standard SKU will not be able to access the internet without ELB configured with at least one frontend IP as described in the [standard loadbalancer outbound connectivity doc](https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-standard-overview#control-outbound-connectivity). For Kubernetes 1.11 and 1.12, We have created an external loadbalancer service in the kube-system namespace as a workaround to this issue. Starting k8s 1.13, instead of creating an ELB service, we will setup outbound rules in ARM template once the API is available. | | loadBalancerSku | no | Sku of Load Balancer and Public IP. Candidate values are: `basic` and `standard`. If not set, it will be default to basic. Requires Kubernetes 1.11 or newer. NOTE: VMs behind ILB standard SKU will not be able to access the internet without ELB configured with at least one frontend IP as described in the [standard loadbalancer outbound connectivity doc](https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-standard-overview#control-outbound-connectivity). For Kubernetes 1.11 and 1.12, We have created an external loadbalancer service in the kube-system namespace as a workaround to this issue. Starting k8s 1.13, instead of creating an ELB service, we will setup outbound rules in ARM template once the API is available. |
| networkPlugin | no | Specifies the network plugin implementation for the cluster. Valid values are:<br>`"azure"` (default), which provides an Azure native networking experience <br>`"kubenet"` for k8s software networking implementation. <br> `"flannel"` for using CoreOS Flannel <br> `"cilium"` for using the default Cilium CNI IPAM | | networkPlugin | no | Specifies the network plugin implementation for the cluster. Valid values are:<br>`"azure"` (default), which provides an Azure native networking experience <br>`"kubenet"` for k8s software networking implementation. <br> `"flannel"` for using CoreOS Flannel <br> `"cilium"` for using the default Cilium CNI IPAM |
| networkPolicy | no | Specifies the network policy enforcement tool for the cluster (currently Linux-only). Valid values are:<br>`"calico"` for Calico network policy.<br>`"cilium"` for cilium network policy (Lin), and `"azure"` (experimental) for Azure CNI-compliant network policy (note: Azure CNI-compliant network policy requires explicit `"networkPlugin": "azure"` configuration as well).<br>See [network policy examples](../examples/networkpolicy) for more information. | | networkPolicy | no | Specifies the network policy enforcement tool for the cluster (currently Linux-only). Valid values are:<br>`"calico"` for Calico network policy.<br>`"cilium"` for cilium network policy (Lin), and `"azure"` (experimental) for Azure CNI-compliant network policy (note: Azure CNI-compliant network policy requires explicit `"networkPlugin": "azure"` configuration as well).<br>See [network policy examples](../examples/networkpolicy) for more information. |

Просмотреть файл

@ -24,11 +24,11 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
k8sVersion := orchestratorProfile.OrchestratorVersion k8sVersion := orchestratorProfile.OrchestratorVersion
k8sComponents := api.K8sComponentsByVersionMap[k8sVersion] k8sComponents := api.K8sComponentsByVersionMap[k8sVersion]
kubernetesConfig := orchestratorProfile.KubernetesConfig kubernetesConfig := orchestratorProfile.KubernetesConfig
kubernetesImageBase := kubernetesConfig.KubernetesImageBase
if kubernetesConfig != nil { if kubernetesConfig != nil {
if helpers.IsTrueBoolPointer(kubernetesConfig.UseCloudControllerManager) { if helpers.IsTrueBoolPointer(kubernetesConfig.UseCloudControllerManager) {
kubernetesCcmSpec := kubernetesConfig.KubernetesImageBase + k8sComponents["ccm"] kubernetesCcmSpec := kubernetesImageBase + k8sComponents["ccm"]
if kubernetesConfig.CustomCcmImage != "" { if kubernetesConfig.CustomCcmImage != "" {
kubernetesCcmSpec = kubernetesConfig.CustomCcmImage kubernetesCcmSpec = kubernetesConfig.CustomCcmImage
} }
@ -36,20 +36,20 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
addValue(parametersMap, "kubernetesCcmImageSpec", kubernetesCcmSpec) addValue(parametersMap, "kubernetesCcmImageSpec", kubernetesCcmSpec)
} }
kubernetesHyperkubeSpec := kubernetesConfig.KubernetesImageBase + k8sComponents["hyperkube"] kubernetesHyperkubeSpec := kubernetesImageBase + k8sComponents["hyperkube"]
if kubernetesConfig.CustomHyperkubeImage != "" { if kubernetesConfig.CustomHyperkubeImage != "" {
kubernetesHyperkubeSpec = kubernetesConfig.CustomHyperkubeImage kubernetesHyperkubeSpec = kubernetesConfig.CustomHyperkubeImage
} }
addValue(parametersMap, "kubeDNSServiceIP", kubernetesConfig.DNSServiceIP) addValue(parametersMap, "kubeDNSServiceIP", kubernetesConfig.DNSServiceIP)
addValue(parametersMap, "kubernetesHyperkubeSpec", kubernetesHyperkubeSpec) addValue(parametersMap, "kubernetesHyperkubeSpec", kubernetesHyperkubeSpec)
addValue(parametersMap, "kubernetesAddonManagerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["addonmanager"]) addValue(parametersMap, "kubernetesAddonManagerSpec", kubernetesImageBase+k8sComponents["addonmanager"])
addValue(parametersMap, "kubernetesAddonResizerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["addonresizer"]) addValue(parametersMap, "kubernetesAddonResizerSpec", kubernetesImageBase+k8sComponents["addonresizer"])
if orchestratorProfile.NeedsExecHealthz() { 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, "kubernetesDNSSidecarSpec", kubernetesImageBase+k8sComponents["k8s-dns-sidecar"])
addValue(parametersMap, "kubernetesHeapsterSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["heapster"]) addValue(parametersMap, "kubernetesHeapsterSpec", kubernetesImageBase+k8sComponents["heapster"])
if kubernetesConfig.IsAADPodIdentityEnabled() { if kubernetesConfig.IsAADPodIdentityEnabled() {
aadPodIdentityAddon := kubernetesConfig.GetAddonByName(DefaultAADPodIdentityAddonName) aadPodIdentityAddon := kubernetesConfig.GetAddonByName(DefaultAADPodIdentityAddonName)
aadIndex := aadPodIdentityAddon.GetAddonContainersIndexByName(DefaultAADPodIdentityAddonName) aadIndex := aadPodIdentityAddon.GetAddonContainersIndexByName(DefaultAADPodIdentityAddonName)
@ -79,12 +79,12 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
addValue(parametersMap, "kuberneteselbsvcname", fmt.Sprintf("%d", elbsvcName)) addValue(parametersMap, "kuberneteselbsvcname", fmt.Sprintf("%d", elbsvcName))
} }
if common.IsKubernetesVersionGe(k8sVersion, "1.12.0") { if common.IsKubernetesVersionGe(k8sVersion, "1.12.0") {
addValue(parametersMap, "kubernetesCoreDNSSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["coredns"]) addValue(parametersMap, "kubernetesCoreDNSSpec", kubernetesImageBase+k8sComponents["coredns"])
} else { } else {
addValue(parametersMap, "kubernetesKubeDNSSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["kube-dns"]) addValue(parametersMap, "kubernetesKubeDNSSpec", kubernetesImageBase+k8sComponents["kube-dns"])
addValue(parametersMap, "kubernetesDNSMasqSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents["dnsmasq"]) 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{ addValue(parametersMap, "cloudproviderConfig", api.CloudProviderConfig{
CloudProviderBackoff: kubernetesConfig.CloudProviderBackoff, CloudProviderBackoff: kubernetesConfig.CloudProviderBackoff,
CloudProviderBackoffRetries: kubernetesConfig.CloudProviderBackoffRetries, CloudProviderBackoffRetries: kubernetesConfig.CloudProviderBackoffRetries,

Просмотреть файл

@ -36,6 +36,7 @@ func TestAssignKubernetesParameters(t *testing.T) {
parametersMap := paramsMap{} parametersMap := paramsMap{}
containerService.Location = "eatsus" containerService.Location = "eatsus"
cloudSpecConfig := containerService.GetCloudSpecConfig() cloudSpecConfig := containerService.GetCloudSpecConfig()
containerService.SetPropertiesDefaults(false, false)
assignKubernetesParameters(containerService.Properties, parametersMap, cloudSpecConfig, DefaultGeneratorCode) assignKubernetesParameters(containerService.Properties, parametersMap, cloudSpecConfig, DefaultGeneratorCode)
for k, v := range parametersMap { for k, v := range parametersMap {
switch val := v.(paramsMap)["value"].(type) { switch val := v.(paramsMap)["value"].(type) {

Просмотреть файл

@ -34,6 +34,7 @@ func TestAssignParameters(t *testing.T) {
} }
containerService.Location = "eastus" containerService.Location = "eastus"
containerService.SetPropertiesDefaults(false, false)
parametersMap, err := getParameters(containerService, DefaultGeneratorCode, "testversion") parametersMap, err := getParameters(containerService, DefaultGeneratorCode, "testversion")
if err != nil { if err != nil {
t.Errorf("should not get error when populating parameters") t.Errorf("should not get error when populating parameters")

Просмотреть файл

@ -10,7 +10,6 @@ import (
func (cs *ContainerService) setKubeletConfig() { func (cs *ContainerService) setKubeletConfig() {
o := cs.Properties.OrchestratorProfile o := cs.Properties.OrchestratorProfile
cloudSpecConfig := cs.GetCloudSpecConfig()
staticLinuxKubeletConfig := map[string]string{ staticLinuxKubeletConfig := map[string]string{
"--address": "0.0.0.0", "--address": "0.0.0.0",
"--allow-privileged": "true", "--allow-privileged": "true",
@ -48,7 +47,7 @@ func (cs *ContainerService) setKubeletConfig() {
defaultKubeletConfig := map[string]string{ defaultKubeletConfig := map[string]string{
"--cluster-domain": "cluster.local", "--cluster-domain": "cluster.local",
"--network-plugin": "cni", "--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), "--max-pods": strconv.Itoa(DefaultKubernetesMaxPods),
"--eviction-hard": DefaultKubernetesHardEvictionThreshold, "--eviction-hard": DefaultKubernetesHardEvictionThreshold,
"--node-status-update-frequency": K8sComponentsByVersionMap[o.OrchestratorVersion]["nodestatusfreq"], "--node-status-update-frequency": K8sComponentsByVersionMap[o.OrchestratorVersion]["nodestatusfreq"],