зеркало из https://github.com/Azure/aks-engine.git
setting default Images in addon defaults instead of params_k8s.go (#4208)
This commit is contained in:
Родитель
f72aec465a
Коммит
25936ea158
|
@ -59,11 +59,7 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
|
|||
addValue(parametersMap, "kubernetesTillerMemoryRequests", tillerAddon.Containers[tillerIndex].MemoryRequests)
|
||||
addValue(parametersMap, "kubernetesTillerMemoryLimit", tillerAddon.Containers[tillerIndex].MemoryLimits)
|
||||
addValue(parametersMap, "kubernetesTillerMaxHistory", tillerAddon.Config["max-history"])
|
||||
if tillerAddon.Containers[tillerIndex].Image != "" {
|
||||
addValue(parametersMap, "kubernetesTillerSpec", tillerAddon.Containers[tillerIndex].Image)
|
||||
} else {
|
||||
addValue(parametersMap, "kubernetesTillerSpec", cloudSpecConfig.KubernetesSpecConfig.TillerImageBase+k8sComponents[DefaultTillerAddonName])
|
||||
}
|
||||
addValue(parametersMap, "kubernetesTillerSpec", tillerAddon.Containers[tillerIndex].Image)
|
||||
}
|
||||
}
|
||||
if kubernetesConfig.IsAADPodIdentityEnabled() {
|
||||
|
@ -86,11 +82,7 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
|
|||
addValue(parametersMap, "kubernetesACIConnectorCPULimit", aciConnectorAddon.Containers[aciConnectorIndex].CPULimits)
|
||||
addValue(parametersMap, "kubernetesACIConnectorMemoryRequests", aciConnectorAddon.Containers[aciConnectorIndex].MemoryRequests)
|
||||
addValue(parametersMap, "kubernetesACIConnectorMemoryLimit", aciConnectorAddon.Containers[aciConnectorIndex].MemoryLimits)
|
||||
if aciConnectorAddon.Containers[aciConnectorIndex].Image != "" {
|
||||
addValue(parametersMap, "kubernetesACIConnectorSpec", aciConnectorAddon.Containers[aciConnectorIndex].Image)
|
||||
} else {
|
||||
addValue(parametersMap, "kubernetesACIConnectorSpec", cloudSpecConfig.KubernetesSpecConfig.ACIConnectorImageBase+k8sComponents[DefaultACIConnectorAddonName])
|
||||
}
|
||||
addValue(parametersMap, "kubernetesACIConnectorSpec", aciConnectorAddon.Containers[aciConnectorIndex].Image)
|
||||
}
|
||||
} else {
|
||||
addValue(parametersMap, "kubernetesACIConnectorEnabled", false)
|
||||
|
@ -108,11 +100,8 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
|
|||
addValue(parametersMap, "kubernetesClusterAutoscalerMaxNodes", clusterAutoscalerAddon.Config["maxNodes"])
|
||||
addValue(parametersMap, "kubernetesClusterAutoscalerEnabled", true)
|
||||
addValue(parametersMap, "kubernetesClusterAutoscalerUseManagedIdentity", strings.ToLower(strconv.FormatBool(kubernetesConfig.UseManagedIdentity)))
|
||||
if clusterAutoscalerAddon.Containers[clusterAutoScalerIndex].Image != "" {
|
||||
addValue(parametersMap, "kubernetesClusterAutoscalerSpec", clusterAutoscalerAddon.Containers[clusterAutoScalerIndex].Image)
|
||||
} else {
|
||||
addValue(parametersMap, "kubernetesClusterAutoscalerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents[DefaultClusterAutoscalerAddonName])
|
||||
}
|
||||
addValue(parametersMap, "kubernetesClusterAutoscalerSpec", clusterAutoscalerAddon.Containers[clusterAutoScalerIndex].Image)
|
||||
|
||||
}
|
||||
} else {
|
||||
addValue(parametersMap, "kubernetesClusterAutoscalerEnabled", false)
|
||||
|
@ -153,11 +142,7 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
|
|||
addValue(parametersMap, "kubernetesDashboardCPULimit", dashboardAddon.Containers[dashboardIndex].CPULimits)
|
||||
addValue(parametersMap, "kubernetesDashboardMemoryRequests", dashboardAddon.Containers[dashboardIndex].MemoryRequests)
|
||||
addValue(parametersMap, "kubernetesDashboardMemoryLimit", dashboardAddon.Containers[dashboardIndex].MemoryLimits)
|
||||
if dashboardAddon.Containers[dashboardIndex].Image != "" {
|
||||
addValue(parametersMap, "kubernetesDashboardSpec", dashboardAddon.Containers[dashboardIndex].Image)
|
||||
} else {
|
||||
addValue(parametersMap, "kubernetesDashboardSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents[DefaultDashboardAddonName])
|
||||
}
|
||||
addValue(parametersMap, "kubernetesDashboardSpec", dashboardAddon.Containers[dashboardIndex].Image)
|
||||
}
|
||||
}
|
||||
if kubernetesConfig.IsReschedulerEnabled() {
|
||||
|
@ -168,11 +153,7 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
|
|||
addValue(parametersMap, "kubernetesReschedulerCPULimit", reschedulerAddon.Containers[reschedulerIndex].CPULimits)
|
||||
addValue(parametersMap, "kubernetesReschedulerMemoryRequests", reschedulerAddon.Containers[reschedulerIndex].MemoryRequests)
|
||||
addValue(parametersMap, "kubernetesReschedulerMemoryLimit", reschedulerAddon.Containers[reschedulerIndex].MemoryLimits)
|
||||
if reschedulerAddon.Containers[reschedulerIndex].Image != "" {
|
||||
addValue(parametersMap, "kubernetesReschedulerSpec", reschedulerAddon.Containers[reschedulerIndex].Image)
|
||||
} else {
|
||||
addValue(parametersMap, "kubernetesReschedulerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents[DefaultReschedulerAddonName])
|
||||
}
|
||||
addValue(parametersMap, "kubernetesReschedulerSpec", reschedulerAddon.Containers[reschedulerIndex].Image)
|
||||
}
|
||||
}
|
||||
if properties.OrchestratorProfile.IsMetricsServerEnabled() {
|
||||
|
@ -194,11 +175,7 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
|
|||
addValue(parametersMap, "kubernetesNVIDIADevicePluginCPULimit", nvidiaDevicePluginAddon.Containers[nvidiaPluginIndex].CPULimits)
|
||||
addValue(parametersMap, "kubernetesNVIDIADevicePluginMemoryRequests", nvidiaDevicePluginAddon.Containers[nvidiaPluginIndex].MemoryRequests)
|
||||
addValue(parametersMap, "kubernetesNVIDIADevicePluginMemoryLimit", nvidiaDevicePluginAddon.Containers[nvidiaPluginIndex].MemoryLimits)
|
||||
if nvidiaDevicePluginAddon.Containers[nvidiaPluginIndex].Image != "" {
|
||||
addValue(parametersMap, "kubernetesNVIDIADevicePluginSpec", nvidiaDevicePluginAddon.Containers[nvidiaPluginIndex].Image)
|
||||
} else {
|
||||
addValue(parametersMap, "kubernetesNVIDIADevicePluginSpec", cloudSpecConfig.KubernetesSpecConfig.NVIDIAImageBase+k8sComponents[NVIDIADevicePluginAddonName])
|
||||
}
|
||||
addValue(parametersMap, "kubernetesNVIDIADevicePluginSpec", nvidiaDevicePluginAddon.Containers[nvidiaPluginIndex].Image)
|
||||
}
|
||||
}
|
||||
if kubernetesConfig.IsContainerMonitoringEnabled() {
|
||||
|
@ -213,11 +190,7 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
|
|||
addValue(parametersMap, "kubernetesOMSAgentCPULimit", containerMonitoringAddon.Containers[omsagentIndex].CPULimits)
|
||||
addValue(parametersMap, "kubernetesOMSAgentMemoryRequests", containerMonitoringAddon.Containers[omsagentIndex].MemoryRequests)
|
||||
addValue(parametersMap, "kubernetesOMSAgentMemoryLimit", containerMonitoringAddon.Containers[omsagentIndex].MemoryLimits)
|
||||
if containerMonitoringAddon.Containers[omsagentIndex].Image != "" {
|
||||
addValue(parametersMap, "omsAgentImage", containerMonitoringAddon.Containers[omsagentIndex].Image)
|
||||
} else {
|
||||
addValue(parametersMap, "omsAgentImage", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+k8sComponents[ContainerMonitoringAddonName])
|
||||
}
|
||||
addValue(parametersMap, "omsAgentImage", containerMonitoringAddon.Containers[omsagentIndex].Image)
|
||||
}
|
||||
}
|
||||
if kubernetesConfig.IsIPMasqAgentEnabled() {
|
||||
|
@ -240,11 +213,7 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params
|
|||
azureCNINetworkmonitorAddon := kubernetesConfig.GetAddonByName(AzureCNINetworkMonitoringAddonName)
|
||||
azureCNIIndex := azureCNINetworkmonitorAddon.GetAddonContainersIndexByName(AzureCNINetworkMonitoringAddonName)
|
||||
if azureCNIIndex > -1 {
|
||||
if azureCNINetworkmonitorAddon.Containers[azureCNIIndex].Image != "" {
|
||||
addValue(parametersMap, "AzureCNINetworkMonitorImageURL", azureCNINetworkmonitorAddon.Containers[azureCNIIndex].Image)
|
||||
} else {
|
||||
addValue(parametersMap, "AzureCNINetworkMonitorImageURL", cloudSpecConfig.KubernetesSpecConfig.AzureCNIImageBase+k8sComponents[AzureCNINetworkMonitoringAddonName])
|
||||
}
|
||||
addValue(parametersMap, "AzureCNINetworkMonitorImageURL", azureCNINetworkmonitorAddon.Containers[azureCNIIndex].Image)
|
||||
}
|
||||
}
|
||||
if common.IsKubernetesVersionGe(k8sVersion, "1.12.0") {
|
||||
|
|
|
@ -9,6 +9,9 @@ import (
|
|||
|
||||
func (cs *ContainerService) setAddonsConfig() {
|
||||
o := cs.Properties.OrchestratorProfile
|
||||
cloudSpecConfig := cs.GetCloudSpecConfig()
|
||||
k8sComponents := K8sComponentsByVersionMap[o.OrchestratorVersion]
|
||||
specConfig := cloudSpecConfig.KubernetesSpecConfig
|
||||
defaultTillerAddonsConfig := KubernetesAddon{
|
||||
Name: DefaultTillerAddonName,
|
||||
Enabled: helpers.PointerToBool(DefaultTillerAddonEnabled),
|
||||
|
@ -19,6 +22,7 @@ func (cs *ContainerService) setAddonsConfig() {
|
|||
MemoryRequests: "150Mi",
|
||||
CPULimits: "50m",
|
||||
MemoryLimits: "150Mi",
|
||||
Image: specConfig.TillerImageBase + k8sComponents[DefaultTillerAddonName],
|
||||
},
|
||||
},
|
||||
Config: map[string]string{
|
||||
|
@ -42,6 +46,7 @@ func (cs *ContainerService) setAddonsConfig() {
|
|||
MemoryRequests: "150Mi",
|
||||
CPULimits: "50m",
|
||||
MemoryLimits: "150Mi",
|
||||
Image: specConfig.ACIConnectorImageBase + k8sComponents[DefaultACIConnectorAddonName],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -60,6 +65,7 @@ func (cs *ContainerService) setAddonsConfig() {
|
|||
MemoryRequests: "300Mi",
|
||||
CPULimits: "100m",
|
||||
MemoryLimits: "300Mi",
|
||||
Image: specConfig.KubernetesImageBase + k8sComponents[DefaultClusterAutoscalerAddonName],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -116,6 +122,7 @@ func (cs *ContainerService) setAddonsConfig() {
|
|||
MemoryRequests: "150Mi",
|
||||
CPULimits: "300m",
|
||||
MemoryLimits: "150Mi",
|
||||
Image: specConfig.KubernetesImageBase + k8sComponents[DefaultDashboardAddonName],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -130,6 +137,7 @@ func (cs *ContainerService) setAddonsConfig() {
|
|||
MemoryRequests: "100Mi",
|
||||
CPULimits: "10m",
|
||||
MemoryLimits: "100Mi",
|
||||
Image: specConfig.KubernetesImageBase + k8sComponents[DefaultReschedulerAddonName],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -139,7 +147,8 @@ func (cs *ContainerService) setAddonsConfig() {
|
|||
Enabled: k8sVersionMetricsServerAddonEnabled(o),
|
||||
Containers: []KubernetesContainerSpec{
|
||||
{
|
||||
Name: DefaultMetricsServerAddonName,
|
||||
Name: DefaultMetricsServerAddonName,
|
||||
Image: specConfig.KubernetesImageBase + k8sComponents[DefaultMetricsServerAddonName],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -155,6 +164,7 @@ func (cs *ContainerService) setAddonsConfig() {
|
|||
MemoryRequests: "10Mi",
|
||||
CPULimits: "50m",
|
||||
MemoryLimits: "10Mi",
|
||||
Image: specConfig.NVIDIAImageBase + k8sComponents[NVIDIADevicePluginAddonName],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -169,11 +179,11 @@ func (cs *ContainerService) setAddonsConfig() {
|
|||
Containers: []KubernetesContainerSpec{
|
||||
{
|
||||
Name: "omsagent",
|
||||
Image: "microsoft/oms:ciprod10162018-2",
|
||||
CPURequests: "50m",
|
||||
MemoryRequests: "200Mi",
|
||||
CPULimits: "150m",
|
||||
MemoryLimits: "750Mi",
|
||||
Image: "microsoft/oms:ciprod10162018-2",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -197,7 +207,8 @@ func (cs *ContainerService) setAddonsConfig() {
|
|||
Enabled: azureCNINetworkMonitorAddonEnabled(o),
|
||||
Containers: []KubernetesContainerSpec{
|
||||
{
|
||||
Name: AzureCNINetworkMonitoringAddonName,
|
||||
Name: AzureCNINetworkMonitoringAddonName,
|
||||
Image: specConfig.AzureCNIImageBase + k8sComponents[AzureCNINetworkMonitoringAddonName],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -181,6 +181,60 @@ func TestAddonsIndexByName(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestAssignDefaultAddonImages(t *testing.T) {
|
||||
addonNameMap := map[string]string{
|
||||
DefaultTillerAddonName: "gcr.io/kubernetes-helm/tiller:v2.8.1",
|
||||
DefaultACIConnectorAddonName: "microsoft/virtual-kubelet:latest",
|
||||
DefaultClusterAutoscalerAddonName: "k8s.gcr.io/cluster-autoscaler:v1.2.2",
|
||||
DefaultBlobfuseFlexVolumeAddonName: "",
|
||||
DefaultSMBFlexVolumeAddonName: "",
|
||||
DefaultKeyVaultFlexVolumeAddonName: "",
|
||||
DefaultDashboardAddonName: "k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0",
|
||||
DefaultReschedulerAddonName: "k8s.gcr.io/rescheduler:v0.3.1",
|
||||
DefaultMetricsServerAddonName: "k8s.gcr.io/metrics-server-amd64:v0.2.1",
|
||||
NVIDIADevicePluginAddonName: "nvidia/k8s-device-plugin:1.10",
|
||||
ContainerMonitoringAddonName: "microsoft/oms:ciprod10162018-2",
|
||||
IPMASQAgentAddonName: "",
|
||||
AzureCNINetworkMonitoringAddonName: "containernetworking/networkmonitor:v0.0.4",
|
||||
}
|
||||
|
||||
var addons []KubernetesAddon
|
||||
for addonName := range addonNameMap {
|
||||
containerName := addonName
|
||||
if addonName == ContainerMonitoringAddonName {
|
||||
containerName = "omsagent"
|
||||
}
|
||||
customAddon := KubernetesAddon{
|
||||
Name: addonName,
|
||||
Enabled: helpers.PointerToBool(true),
|
||||
Containers: []KubernetesContainerSpec{
|
||||
{
|
||||
Name: containerName,
|
||||
CPURequests: "50m",
|
||||
MemoryRequests: "150Mi",
|
||||
CPULimits: "50m",
|
||||
MemoryLimits: "150Mi",
|
||||
},
|
||||
},
|
||||
}
|
||||
addons = append(addons, customAddon)
|
||||
}
|
||||
|
||||
mockCS := getMockBaseContainerService("1.10.8")
|
||||
mockCS.Properties.OrchestratorProfile.OrchestratorType = "Kubernetes"
|
||||
mockCS.Properties.OrchestratorProfile.KubernetesConfig.Addons = addons
|
||||
mockCS.SetPropertiesDefaults(false, false)
|
||||
modifiedAddons := mockCS.Properties.OrchestratorProfile.KubernetesConfig.Addons
|
||||
|
||||
for _, addon := range modifiedAddons {
|
||||
expected := addonNameMap[addon.Name]
|
||||
actual := addon.Containers[0].Image
|
||||
if actual != expected {
|
||||
t.Errorf("expected setDefaults to set Image %s in addon %s, but got %s", expected, addon.Name, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssignDefaultAddonVals(t *testing.T) {
|
||||
addonName := "testaddon"
|
||||
customCPURequests := "60m"
|
||||
|
|
|
@ -24,7 +24,7 @@ var k8sComponentVersions = map[string]map[string]string{
|
|||
"tiller": "tiller:v2.8.1",
|
||||
"rescheduler": "rescheduler:v0.4.0",
|
||||
"aci-connector": "virtual-kubelet:latest",
|
||||
ContainerMonitoringAddonName: "oms:ciprod05082018",
|
||||
ContainerMonitoringAddonName: "oms:ciprod10162018-2",
|
||||
AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.4",
|
||||
"cluster-autoscaler": "cluster-autoscaler:v1.3.3",
|
||||
NVIDIADevicePluginAddonName: "k8s-device-plugin:1.11",
|
||||
|
@ -56,7 +56,7 @@ var k8sComponentVersions = map[string]map[string]string{
|
|||
"tiller": "tiller:v2.8.1",
|
||||
"rescheduler": "rescheduler:v0.4.0",
|
||||
"aci-connector": "virtual-kubelet:latest",
|
||||
ContainerMonitoringAddonName: "oms:ciprod05082018",
|
||||
ContainerMonitoringAddonName: "oms:ciprod10162018-2",
|
||||
AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.4",
|
||||
"cluster-autoscaler": "cluster-autoscaler:v1.3.3",
|
||||
NVIDIADevicePluginAddonName: "k8s-device-plugin:1.11",
|
||||
|
@ -88,7 +88,7 @@ var k8sComponentVersions = map[string]map[string]string{
|
|||
"tiller": "tiller:v2.8.1",
|
||||
"rescheduler": "rescheduler:v0.4.0",
|
||||
"aci-connector": "virtual-kubelet:latest",
|
||||
ContainerMonitoringAddonName: "oms:ciprod05082018",
|
||||
ContainerMonitoringAddonName: "oms:ciprod10162018-2",
|
||||
AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.4",
|
||||
"cluster-autoscaler": "cluster-autoscaler:v1.3.0",
|
||||
NVIDIADevicePluginAddonName: "k8s-device-plugin:1.11",
|
||||
|
@ -120,7 +120,7 @@ var k8sComponentVersions = map[string]map[string]string{
|
|||
"tiller": "tiller:v2.8.1",
|
||||
"rescheduler": "rescheduler:v0.3.1",
|
||||
"aci-connector": "virtual-kubelet:latest",
|
||||
ContainerMonitoringAddonName: "oms:ciprod05082018",
|
||||
ContainerMonitoringAddonName: "oms:ciprod10162018-2",
|
||||
AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.4",
|
||||
"cluster-autoscaler": "cluster-autoscaler:v1.2.2",
|
||||
NVIDIADevicePluginAddonName: "k8s-device-plugin:1.10",
|
||||
|
@ -152,7 +152,7 @@ var k8sComponentVersions = map[string]map[string]string{
|
|||
"tiller": "tiller:v2.8.1",
|
||||
"rescheduler": "rescheduler:v0.3.1",
|
||||
"aci-connector": "virtual-kubelet:latest",
|
||||
ContainerMonitoringAddonName: "oms:ciprod05082018",
|
||||
ContainerMonitoringAddonName: "oms:ciprod10162018-2",
|
||||
AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.4",
|
||||
"cluster-autoscaler": "cluster-autoscaler:v1.1.2",
|
||||
"k8s-dns-sidecar": "k8s-dns-sidecar-amd64:1.14.7",
|
||||
|
@ -183,7 +183,7 @@ var k8sComponentVersions = map[string]map[string]string{
|
|||
"tiller": "tiller:v2.8.1",
|
||||
"rescheduler": "rescheduler:v0.3.1",
|
||||
"aci-connector": "virtual-kubelet:latest",
|
||||
ContainerMonitoringAddonName: "oms:ciprod05082018",
|
||||
ContainerMonitoringAddonName: "oms:ciprod10162018-2",
|
||||
AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.4",
|
||||
"nodestatusfreq": DefaultKubernetesNodeStatusUpdateFrequency,
|
||||
"nodegraceperiod": DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
|
||||
|
@ -212,7 +212,7 @@ var k8sComponentVersions = map[string]map[string]string{
|
|||
"tiller": "tiller:v2.8.1",
|
||||
"rescheduler": "rescheduler:v0.3.1",
|
||||
"aci-connector": "virtual-kubelet:latest",
|
||||
ContainerMonitoringAddonName: "oms:ciprod05082018",
|
||||
ContainerMonitoringAddonName: "oms:ciprod10162018-2",
|
||||
AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.4",
|
||||
"nodestatusfreq": DefaultKubernetesNodeStatusUpdateFrequency,
|
||||
"nodegraceperiod": DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
|
||||
|
@ -241,6 +241,7 @@ var k8sComponentVersions = map[string]map[string]string{
|
|||
"tiller": "tiller:v2.8.1",
|
||||
"rescheduler": "rescheduler:v0.3.1",
|
||||
"aci-connector": "virtual-kubelet:latest",
|
||||
ContainerMonitoringAddonName: "oms:ciprod10162018-2",
|
||||
AzureCNINetworkMonitoringAddonName: "networkmonitor:v0.0.4",
|
||||
"nodestatusfreq": DefaultKubernetesNodeStatusUpdateFrequency,
|
||||
"nodegraceperiod": DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
|
||||
|
|
Загрузка…
Ссылка в новой задаче