chore: update out-of-tree cloudprovider releases (#4784)

This commit is contained in:
Jack Francis 2021-12-15 12:26:30 -08:00 коммит произвёл GitHub
Родитель fb0ab4a1ae
Коммит fc56ccba80
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 302 добавлений и 134 удалений

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

@ -3,26 +3,9 @@
"properties": {
"orchestratorProfile": {
"kubernetesConfig": {
"useCloudControllerManager": true,
"useManagedIdentity": true,
"addons": [
{
"name": "cluster-autoscaler",
"enabled": true,
"pools": [
{
"name": "poollinux",
"config": {
"min-nodes": "1",
"max-nodes": "3"
}
}
],
"config": {
"scan-interval": "1m",
"scale-down-delay-after-add": "1m0s",
"scale-down-unneeded-time": "2m0s"
}
},
{
"name": "coredns",
"enabled": true,
@ -56,7 +39,11 @@
],
"availabilityProfile": "VirtualMachineScaleSets",
"osDiskCachingType": "ReadOnly",
"dataDiskCachingType": "ReadWrite"
"dataDiskCachingType": "ReadWrite",
"availabilityZones": [
"1",
"2"
]
},
{
"name": "poolwin",
@ -64,21 +51,33 @@
"vmSize": "Standard_D2s_v3",
"OSDiskSizeGB": 256,
"availabilityProfile": "VirtualMachineScaleSets",
"osType": "Windows"
"osType": "Windows",
"availabilityZones": [
"1",
"2"
]
},
{
"name": "pool1804",
"count": 1,
"vmSize": "Standard_D2_v3",
"distro": "ubuntu-18.04",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"availabilityZones": [
"1",
"2"
]
},
{
"name": "pool1804gen2",
"count": 1,
"vmSize": "Standard_D2s_v3",
"distro": "ubuntu-18.04-gen2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"availabilityZones": [
"1",
"2"
]
}
],
"linuxProfile": {

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

@ -3,27 +3,10 @@
"properties": {
"orchestratorProfile": {
"kubernetesConfig": {
"useCloudControllerManager": true,
"useManagedIdentity": true,
"clusterSubnet": "10.239.0.0/16",
"addons": [
{
"name": "cluster-autoscaler",
"enabled": true,
"pools": [
{
"name": "poollinux",
"config": {
"min-nodes": "1",
"max-nodes": "3"
}
}
],
"config": {
"scan-interval": "1m",
"scale-down-delay-after-add": "1m0s",
"scale-down-unneeded-time": "2m0s"
}
},
{
"name": "coredns",
"enabled": true,
@ -61,7 +44,11 @@
"availabilityProfile": "VirtualMachineScaleSets",
"vnetSubnetId": "/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.Network/virtualNetworks/VNET_NAME/subnets/SUBNET_NAME",
"osDiskCachingType": "ReadOnly",
"dataDiskCachingType": "ReadWrite"
"dataDiskCachingType": "ReadWrite",
"availabilityZones": [
"1",
"2"
]
},
{
"name": "poolwin",
@ -70,7 +57,11 @@
"OSDiskSizeGB": 256,
"availabilityProfile": "VirtualMachineScaleSets",
"vnetSubnetId": "/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.Network/virtualNetworks/VNET_NAME/subnets/SUBNET_NAME",
"osType": "Windows"
"osType": "Windows",
"availabilityZones": [
"1",
"2"
]
},
{
"name": "pool1804",
@ -78,7 +69,11 @@
"vmSize": "Standard_D2_v3",
"distro": "ubuntu-18.04",
"availabilityProfile": "VirtualMachineScaleSets",
"vnetSubnetId": "/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.Network/virtualNetworks/VNET_NAME/subnets/SUBNET_NAME"
"vnetSubnetId": "/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.Network/virtualNetworks/VNET_NAME/subnets/SUBNET_NAME",
"availabilityZones": [
"1",
"2"
]
},
{
"name": "pool1804gen2",
@ -86,7 +81,11 @@
"vmSize": "Standard_D2s_v3",
"distro": "ubuntu-18.04-gen2",
"availabilityProfile": "VirtualMachineScaleSets",
"vnetSubnetId": "/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.Network/virtualNetworks/VNET_NAME/subnets/SUBNET_NAME"
"vnetSubnetId": "/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.Network/virtualNetworks/VNET_NAME/subnets/SUBNET_NAME",
"availabilityZones": [
"1",
"2"
]
}
],
"linuxProfile": {

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

@ -97,12 +97,12 @@ parameters:
cachingMode: ReadOnly
reclaimPolicy: Delete
allowVolumeExpansion: true
{{- if HasAvailabilityZones}}
{{- if HasAgentPoolAvailabilityZones}}
volumeBindingMode: WaitForFirstConsumer
allowedTopologies:
- matchLabelExpressions:
- key: topology.disk.csi.azure.com/zone
values: {{GetZones}}
values: {{GetAgentPoolZones}}
{{else}}
volumeBindingMode: Immediate
{{- end}}
@ -120,12 +120,12 @@ parameters:
cachingMode: ReadOnly
reclaimPolicy: Delete
allowVolumeExpansion: true
{{- if HasAvailabilityZones}}
{{- if HasAgentPoolAvailabilityZones}}
volumeBindingMode: WaitForFirstConsumer
allowedTopologies:
- matchLabelExpressions:
- key: topology.disk.csi.azure.com/zone
values: {{GetZones}}
values: {{GetAgentPoolZones}}
{{else}}
volumeBindingMode: Immediate
{{- end}}
@ -143,12 +143,12 @@ parameters:
cachingMode: ReadOnly
reclaimPolicy: Delete
allowVolumeExpansion: true
{{- if HasAvailabilityZones}}
{{- if HasAgentPoolAvailabilityZones}}
volumeBindingMode: WaitForFirstConsumer
allowedTopologies:
- matchLabelExpressions:
- key: topology.disk.csi.azure.com/zone
values: {{GetZones}}
values: {{GetAgentPoolZones}}
{{else}}
volumeBindingMode: Immediate
{{- end}}

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

@ -43,8 +43,8 @@ const (
csiResizerImageReference string = "oss/kubernetes-csi/csi-resizer:v1.3.0"
csiSnapshotterImageReference string = "oss/kubernetes-csi/csi-snapshotter:v4.2.1"
csiSnapshotControllerImageReference string = "oss/kubernetes-csi/snapshot-controller:v4.2.1"
csiAzureDiskImageReference string = "oss/kubernetes-csi/azuredisk-csi:v1.8.0"
csiAzureFileImageReference string = "oss/kubernetes-csi/azurefile-csi:v1.7.0"
csiAzureDiskImageReference string = "oss/kubernetes-csi/azuredisk-csi:v1.9.0"
csiAzureFileImageReference string = "oss/kubernetes-csi/azurefile-csi:v1.8.0"
azureCloudControllerManagerImageReference string = "oss/kubernetes/azure-cloud-controller-manager:v1.1.1"
azureCloudNodeManagerImageReference string = "oss/kubernetes/azure-cloud-node-manager:v1.1.1"
dashboardImageReference string = "mcr.microsoft.com/oss/kubernetes/dashboard:v2.0.4" // deprecated
@ -496,8 +496,8 @@ func getK8sVersionComponents(version, kubernetesImageBaseType string, overrides
common.ControllerManagerComponentName: getDefaultImage(common.ControllerManagerComponentName, kubernetesImageBaseType) + ":v" + version,
common.KubeProxyAddonName: getDefaultImage(common.KubeProxyAddonName, kubernetesImageBaseType) + ":v" + version,
common.SchedulerComponentName: getDefaultImage(common.SchedulerComponentName, kubernetesImageBaseType) + ":v" + version,
common.CloudControllerManagerComponentName: azureCloudControllerManagerImageReference,
common.CloudNodeManagerAddonName: azureCloudNodeManagerImageReference,
common.CloudControllerManagerComponentName: "oss/kubernetes/azure-cloud-controller-manager:v1.1.3",
common.CloudNodeManagerAddonName: "oss/kubernetes/azure-cloud-node-manager:v1.1.3",
common.WindowsArtifactComponentName: "v" + version + "/windowszip/v" + version + "-1int.zip",
common.WindowsArtifactAzureStackComponentName: "v" + version + "/windowszip/v" + version + "-1int.zip",
common.DashboardAddonName: dashboardImageReference,
@ -580,8 +580,8 @@ func getK8sVersionComponents(version, kubernetesImageBaseType string, overrides
common.ControllerManagerComponentName: getDefaultImage(common.ControllerManagerComponentName, kubernetesImageBaseType) + ":v" + version,
common.KubeProxyAddonName: getDefaultImage(common.KubeProxyAddonName, kubernetesImageBaseType) + ":v" + version,
common.SchedulerComponentName: getDefaultImage(common.SchedulerComponentName, kubernetesImageBaseType) + ":v" + version,
common.CloudControllerManagerComponentName: azureCloudControllerManagerImageReference,
common.CloudNodeManagerAddonName: azureCloudNodeManagerImageReference,
common.CloudControllerManagerComponentName: "oss/kubernetes/azure-cloud-controller-manager:v1.1.3",
common.CloudNodeManagerAddonName: "oss/kubernetes/azure-cloud-node-manager:v1.1.3",
common.WindowsArtifactComponentName: "v" + version + "/windowszip/v" + version + "-1int.zip",
common.WindowsArtifactAzureStackComponentName: "v" + version + "/windowszip/v" + version + "-1int.zip",
common.DashboardAddonName: dashboardImageReference,
@ -664,8 +664,8 @@ func getK8sVersionComponents(version, kubernetesImageBaseType string, overrides
common.ControllerManagerComponentName: getDefaultImage(common.ControllerManagerComponentName, kubernetesImageBaseType) + ":v" + version,
common.KubeProxyAddonName: getDefaultImage(common.KubeProxyAddonName, kubernetesImageBaseType) + ":v" + version,
common.SchedulerComponentName: getDefaultImage(common.SchedulerComponentName, kubernetesImageBaseType) + ":v" + version,
common.CloudControllerManagerComponentName: azureCloudControllerManagerImageReference,
common.CloudNodeManagerAddonName: azureCloudNodeManagerImageReference,
common.CloudControllerManagerComponentName: "oss/kubernetes/azure-cloud-controller-manager:v1.0.7",
common.CloudNodeManagerAddonName: "oss/kubernetes/azure-cloud-node-manager:v1.0.7",
common.WindowsArtifactComponentName: "v" + version + "/windowszip/v" + version + "-1int.zip",
common.WindowsArtifactAzureStackComponentName: "v" + version + "/windowszip/v" + version + "-1int.zip",
common.DashboardAddonName: dashboardImageReference,
@ -748,8 +748,8 @@ func getK8sVersionComponents(version, kubernetesImageBaseType string, overrides
common.ControllerManagerComponentName: getDefaultImage(common.ControllerManagerComponentName, kubernetesImageBaseType) + ":v" + version,
common.KubeProxyAddonName: getDefaultImage(common.KubeProxyAddonName, kubernetesImageBaseType) + ":v" + version,
common.SchedulerComponentName: getDefaultImage(common.SchedulerComponentName, kubernetesImageBaseType) + ":v" + version,
common.CloudControllerManagerComponentName: azureCloudControllerManagerImageReference,
common.CloudNodeManagerAddonName: azureCloudNodeManagerImageReference,
common.CloudControllerManagerComponentName: "oss/kubernetes/azure-cloud-controller-manager:v0.7.10",
common.CloudNodeManagerAddonName: "oss/kubernetes/azure-cloud-node-manager:v0.7.10",
common.WindowsArtifactComponentName: "v" + version + "/windowszip/v" + version + "-1int.zip",
common.WindowsArtifactAzureStackComponentName: "v" + version + common.AzureStackSuffix + "/windowszip/v" + version + common.AzureStackSuffix + "-1int.zip",
common.DashboardAddonName: dashboardImageReference,
@ -832,8 +832,8 @@ func getK8sVersionComponents(version, kubernetesImageBaseType string, overrides
common.ControllerManagerComponentName: getDefaultImage(common.ControllerManagerComponentName, kubernetesImageBaseType) + ":v" + version,
common.KubeProxyAddonName: getDefaultImage(common.KubeProxyAddonName, kubernetesImageBaseType) + ":v" + version,
common.SchedulerComponentName: getDefaultImage(common.SchedulerComponentName, kubernetesImageBaseType) + ":v" + version,
common.CloudControllerManagerComponentName: azureCloudControllerManagerImageReference,
common.CloudNodeManagerAddonName: azureCloudNodeManagerImageReference,
common.CloudControllerManagerComponentName: "oss/kubernetes/azure-cloud-controller-manager:v0.6.0",
common.CloudNodeManagerAddonName: "oss/kubernetes/azure-cloud-node-manager:v0.6.0",
common.WindowsArtifactComponentName: "v" + version + "/windowszip/v" + version + "-1int.zip",
common.WindowsArtifactAzureStackComponentName: "v" + version + common.AzureStackSuffix + "/windowszip/v" + version + common.AzureStackSuffix + "-1int.zip",
common.DashboardAddonName: dashboardImageReference,

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

@ -1088,6 +1088,15 @@ func (p *Properties) HasAvailabilityZones() bool {
return hasZones
}
func (p *Properties) HasAgentPoolAvailabilityZones() bool {
for _, pool := range p.AgentPoolProfiles {
if pool.AvailabilityZones != nil {
return true
}
}
return false
}
// HasNonRegularPriorityScaleset returns true if any one node pool has a low or spot priority scaleset configuration
func (p *Properties) HasNonRegularPriorityScaleset() bool {
for _, agentPoolProfile := range p.AgentPoolProfiles {

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

@ -1711,10 +1711,11 @@ func TestIsCustomVNET(t *testing.T) {
func TestHasAvailabilityZones(t *testing.T) {
cases := []struct {
p Properties
expectedMaster bool
expectedAgent bool
expectedAllZones bool
p Properties
expectedMaster bool
expectedAgent bool
expectedAllZones bool
expectedHasAgentPoolAvailabilityZones bool
}{
{
p: Properties{
@ -1733,9 +1734,30 @@ func TestHasAvailabilityZones(t *testing.T) {
},
},
},
expectedMaster: true,
expectedAgent: true,
expectedAllZones: true,
expectedMaster: true,
expectedAgent: true,
expectedAllZones: true,
expectedHasAgentPoolAvailabilityZones: true,
},
{
p: Properties{
MasterProfile: &MasterProfile{
Count: 1,
AvailabilityZones: []string{"1", "2"},
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Count: 1,
},
{
Count: 1,
},
},
},
expectedMaster: true,
expectedAgent: false,
expectedAllZones: false,
expectedHasAgentPoolAvailabilityZones: false,
},
{
p: Properties{
@ -1752,9 +1774,10 @@ func TestHasAvailabilityZones(t *testing.T) {
},
},
},
expectedMaster: false,
expectedAgent: false,
expectedAllZones: false,
expectedMaster: false,
expectedAgent: false,
expectedAllZones: false,
expectedHasAgentPoolAvailabilityZones: true,
},
{
p: Properties{
@ -1772,9 +1795,10 @@ func TestHasAvailabilityZones(t *testing.T) {
},
},
},
expectedMaster: false,
expectedAgent: false,
expectedAllZones: false,
expectedMaster: false,
expectedAgent: false,
expectedAllZones: false,
expectedHasAgentPoolAvailabilityZones: true,
},
}
@ -1788,6 +1812,9 @@ func TestHasAvailabilityZones(t *testing.T) {
if c.p.HasZonesForAllAgentPools() != c.expectedAllZones {
t.Fatalf("expected HasZonesForAllAgentPools() to return %t but instead returned %t", c.expectedAllZones, c.p.HasZonesForAllAgentPools())
}
if c.p.HasAgentPoolAvailabilityZones() != c.expectedHasAgentPoolAvailabilityZones {
t.Fatalf("expected HasAgentPoolAvailabilityZones() to return %t but instead returned %t", c.expectedHasAgentPoolAvailabilityZones, c.p.HasAgentPoolAvailabilityZones())
}
}
}

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

@ -595,14 +595,24 @@ func getAddonFuncMap(addon api.KubernetesAddon, cs *api.ContainerService) templa
"HasAvailabilityZones": func() bool {
return cs.Properties.HasAvailabilityZones()
},
"GetZones": func() string {
"HasAgentPoolAvailabilityZones": func() bool {
return cs.Properties.HasAgentPoolAvailabilityZones()
},
"GetAgentPoolZones": func() string {
if len(cs.Properties.AgentPoolProfiles) == 0 {
return ""
}
var zones string
for _, zone := range cs.Properties.AgentPoolProfiles[0].AvailabilityZones {
zones += fmt.Sprintf("\n - %s-%s", cs.Location, zone)
for _, pool := range cs.Properties.AgentPoolProfiles {
if pool.AvailabilityZones != nil {
for _, zone := range pool.AvailabilityZones {
zones += fmt.Sprintf("\n - %s-%s", cs.Location, zone)
}
}
if zones != "" {
return zones
}
}
return zones
},

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

@ -2287,7 +2287,8 @@ func TestGetAddonFuncMap(t *testing.T) {
expectedNeedsManagedDiskStorageClasses bool
expectedUsesCloudControllerManager bool
expectedHasAvailabilityZones bool
expectedGetZones string
expectedHasAgentPoolAvailabilityZones bool
expectedGetAgentPoolZones string
expectedHasWindows bool
expectedHasLinux bool
expectedCSIControllerReplicas string
@ -2369,7 +2370,8 @@ func TestGetAddonFuncMap(t *testing.T) {
expectedNeedsManagedDiskStorageClasses: true,
expectedUsesCloudControllerManager: false,
expectedHasAvailabilityZones: false,
expectedGetZones: "",
expectedHasAgentPoolAvailabilityZones: false,
expectedGetAgentPoolZones: "",
expectedHasWindows: false,
expectedHasLinux: true,
expectedCSIControllerReplicas: "2",
@ -2455,7 +2457,8 @@ func TestGetAddonFuncMap(t *testing.T) {
expectedNeedsManagedDiskStorageClasses: true,
expectedUsesCloudControllerManager: false,
expectedHasAvailabilityZones: false,
expectedGetZones: "",
expectedHasAgentPoolAvailabilityZones: false,
expectedGetAgentPoolZones: "",
expectedHasWindows: false,
expectedHasLinux: true,
expectedCSIControllerReplicas: "2",
@ -2537,7 +2540,8 @@ func TestGetAddonFuncMap(t *testing.T) {
expectedNeedsManagedDiskStorageClasses: false,
expectedUsesCloudControllerManager: false,
expectedHasAvailabilityZones: false,
expectedGetZones: "",
expectedHasAgentPoolAvailabilityZones: false,
expectedGetAgentPoolZones: "",
expectedHasWindows: false,
expectedHasLinux: true,
expectedCSIControllerReplicas: "2",
@ -2620,7 +2624,8 @@ func TestGetAddonFuncMap(t *testing.T) {
expectedNeedsManagedDiskStorageClasses: true,
expectedUsesCloudControllerManager: true,
expectedHasAvailabilityZones: false,
expectedGetZones: "",
expectedHasAgentPoolAvailabilityZones: false,
expectedGetAgentPoolZones: "",
expectedHasWindows: false,
expectedHasLinux: true,
expectedCSIControllerReplicas: "2",
@ -2694,6 +2699,16 @@ func TestGetAddonFuncMap(t *testing.T) {
},
OSType: api.Linux,
},
{
Name: "pool2",
Count: 1,
AvailabilityProfile: api.VirtualMachineScaleSets,
StorageProfile: api.ManagedDisks,
AvailabilityZones: []string{
"1",
},
OSType: api.Linux,
},
},
},
},
@ -2708,7 +2723,99 @@ func TestGetAddonFuncMap(t *testing.T) {
expectedNeedsManagedDiskStorageClasses: true,
expectedUsesCloudControllerManager: true,
expectedHasAvailabilityZones: true,
expectedGetZones: "\n - eastus2-1\n - eastus2-2",
expectedHasAgentPoolAvailabilityZones: true,
expectedGetAgentPoolZones: "\n - eastus2-1\n - eastus2-2",
expectedHasWindows: false,
expectedHasLinux: true,
expectedCSIControllerReplicas: "2",
expectedShouldEnableAzureDiskCSISnapshotFeature: true,
expectedShouldEnableAzureFileCSISnapshotFeature: false,
expectedIsKubernetesVersionGeOneDotSixteenDotZero: true,
expectedMode: api.AddonModeEnsureExists,
expectedGetClusterSubnet: "10.239.0.0/16",
expectedIsAzureCNI: true,
},
{
name: "coredns as an example - MasterProfile Availability Zones",
addon: api.KubernetesAddon{
Name: common.CoreDNSAddonName,
Enabled: to.BoolPtr(true),
Mode: api.AddonModeEnsureExists,
Config: map[string]string{
"foo": "bar",
},
Containers: []api.KubernetesContainerSpec{
{
Name: common.CoreDNSAddonName,
CPURequests: "100m",
MemoryRequests: "300Mi",
CPULimits: "100m",
MemoryLimits: "300Mi",
Image: specConfig.KubernetesImageBase + k8sComponentsByVersionMap["1.15.4"][common.CoreDNSAddonName],
},
},
},
cs: &api.ContainerService{
Location: "eastus2",
Properties: &api.Properties{
OrchestratorProfile: &api.OrchestratorProfile{
OrchestratorType: api.Kubernetes,
OrchestratorVersion: "1.17.0",
KubernetesConfig: &api.KubernetesConfig{
UseCloudControllerManager: to.BoolPtr(true),
NetworkPlugin: api.NetworkPluginAzure,
Addons: []api.KubernetesAddon{
{
Name: common.CoreDNSAddonName,
Enabled: to.BoolPtr(true),
Config: map[string]string{
"foo": "bar",
},
Containers: []api.KubernetesContainerSpec{
{
Name: common.CoreDNSAddonName,
CPURequests: "100m",
MemoryRequests: "300Mi",
CPULimits: "100m",
MemoryLimits: "300Mi",
Image: specConfig.KubernetesImageBase + k8sComponentsByVersionMap["1.15.4"][common.CoreDNSAddonName],
},
},
},
},
ClusterSubnet: "10.239.0.0/16",
},
},
MasterProfile: &api.MasterProfile{
AvailabilityZones: []string{
"1",
"2",
},
},
AgentPoolProfiles: []*api.AgentPoolProfile{
{
Name: "pool1",
Count: 1,
AvailabilityProfile: api.VirtualMachineScaleSets,
StorageProfile: api.ManagedDisks,
OSType: api.Linux,
},
},
},
},
expectedImage: specConfig.KubernetesImageBase + k8sComponentsByVersionMap["1.15.4"][common.CoreDNSAddonName],
expectedCPUReqs: "100m",
expectedCPULimits: "100m",
expectedMemReqs: "300Mi",
expectedMemLimits: "300Mi",
expectedFoo: "bar",
expectedIsAzureStackCloud: false,
expectedNeedsStorageAccountStorageClasses: false,
expectedNeedsManagedDiskStorageClasses: true,
expectedUsesCloudControllerManager: true,
expectedHasAvailabilityZones: true,
expectedHasAgentPoolAvailabilityZones: false,
expectedGetAgentPoolZones: "",
expectedHasWindows: false,
expectedHasLinux: true,
expectedCSIControllerReplicas: "2",
@ -2788,23 +2895,25 @@ func TestGetAddonFuncMap(t *testing.T) {
},
},
},
expectedImage: specConfig.KubernetesImageBase + k8sComponentsByVersionMap["1.15.4"][common.CoreDNSAddonName],
expectedCPUReqs: "100m",
expectedCPULimits: "100m",
expectedMemReqs: "300Mi",
expectedMemLimits: "300Mi",
expectedFoo: "bar",
expectedNeedsManagedDiskStorageClasses: true,
expectedUsesCloudControllerManager: true,
expectedHasWindows: true,
expectedHasLinux: true,
expectedCSIControllerReplicas: "2",
expectedImage: specConfig.KubernetesImageBase + k8sComponentsByVersionMap["1.15.4"][common.CoreDNSAddonName],
expectedCPUReqs: "100m",
expectedCPULimits: "100m",
expectedMemReqs: "300Mi",
expectedMemLimits: "300Mi",
expectedFoo: "bar",
expectedNeedsManagedDiskStorageClasses: true,
expectedUsesCloudControllerManager: true,
expectedHasAvailabilityZones: false,
expectedHasAgentPoolAvailabilityZones: false,
expectedHasWindows: true,
expectedHasLinux: true,
expectedCSIControllerReplicas: "2",
expectedShouldEnableAzureDiskCSISnapshotFeature: true,
expectedShouldEnableAzureFileCSISnapshotFeature: false,
expectedIsKubernetesVersionGeOneDotSixteenDotZero: true,
expectedMode: api.AddonModeReconcile,
expectedGetClusterSubnet: "10.239.0.0/16",
expectedIsAzureCNI: true,
expectedMode: api.AddonModeReconcile,
expectedGetClusterSubnet: "10.239.0.0/16",
expectedIsAzureCNI: true,
},
{
name: "coredns as an example - kubenet",
@ -2875,23 +2984,25 @@ func TestGetAddonFuncMap(t *testing.T) {
},
},
},
expectedImage: specConfig.KubernetesImageBase + k8sComponentsByVersionMap["1.15.4"][common.CoreDNSAddonName],
expectedCPUReqs: "100m",
expectedCPULimits: "100m",
expectedMemReqs: "300Mi",
expectedMemLimits: "300Mi",
expectedFoo: "bar",
expectedNeedsManagedDiskStorageClasses: true,
expectedUsesCloudControllerManager: true,
expectedHasWindows: true,
expectedHasLinux: true,
expectedCSIControllerReplicas: "2",
expectedImage: specConfig.KubernetesImageBase + k8sComponentsByVersionMap["1.15.4"][common.CoreDNSAddonName],
expectedCPUReqs: "100m",
expectedCPULimits: "100m",
expectedMemReqs: "300Mi",
expectedMemLimits: "300Mi",
expectedFoo: "bar",
expectedNeedsManagedDiskStorageClasses: true,
expectedUsesCloudControllerManager: true,
expectedHasAvailabilityZones: false,
expectedHasAgentPoolAvailabilityZones: false,
expectedHasWindows: true,
expectedHasLinux: true,
expectedCSIControllerReplicas: "2",
expectedShouldEnableAzureDiskCSISnapshotFeature: true,
expectedShouldEnableAzureFileCSISnapshotFeature: false,
expectedIsKubernetesVersionGeOneDotSixteenDotZero: true,
expectedMode: api.AddonModeReconcile,
expectedGetClusterSubnet: "10.239.0.0/16",
expectedIsAzureCNI: false,
expectedMode: api.AddonModeReconcile,
expectedGetClusterSubnet: "10.239.0.0/16",
expectedIsAzureCNI: false,
},
}
@ -2955,10 +3066,15 @@ func TestGetAddonFuncMap(t *testing.T) {
if ret[0].Interface() != c.expectedHasAvailabilityZones {
t.Errorf("expected funcMap invocation of HasAvailabilityZones to return %t, instead got %t", c.expectedHasAvailabilityZones, ret[0].Interface())
}
v = reflect.ValueOf(funcMap["GetZones"])
v = reflect.ValueOf(funcMap["HasAgentPoolAvailabilityZones"])
ret = v.Call(make([]reflect.Value, 0))
if ret[0].Interface() != c.expectedGetZones {
t.Errorf("expected funcMap invocation of GetZones to return %s, instead got %s", c.expectedGetZones, ret[0].Interface())
if ret[0].Interface() != c.expectedHasAgentPoolAvailabilityZones {
t.Errorf("expected funcMap invocation of HasAgentPoolAvailabilityZones to return %t, instead got %t", c.expectedHasAgentPoolAvailabilityZones, ret[0].Interface())
}
v = reflect.ValueOf(funcMap["GetAgentPoolZones"])
ret = v.Call(make([]reflect.Value, 0))
if ret[0].Interface() != c.expectedGetAgentPoolZones {
t.Errorf("expected funcMap invocation of GetAgentPoolZones to return %s, instead got %s", c.expectedGetAgentPoolZones, ret[0].Interface())
}
v = reflect.ValueOf(funcMap["HasWindows"])
ret = v.Call(make([]reflect.Value, 0))

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

@ -5897,12 +5897,12 @@ parameters:
cachingMode: ReadOnly
reclaimPolicy: Delete
allowVolumeExpansion: true
{{- if HasAvailabilityZones}}
{{- if HasAgentPoolAvailabilityZones}}
volumeBindingMode: WaitForFirstConsumer
allowedTopologies:
- matchLabelExpressions:
- key: topology.disk.csi.azure.com/zone
values: {{GetZones}}
values: {{GetAgentPoolZones}}
{{else}}
volumeBindingMode: Immediate
{{- end}}
@ -5920,12 +5920,12 @@ parameters:
cachingMode: ReadOnly
reclaimPolicy: Delete
allowVolumeExpansion: true
{{- if HasAvailabilityZones}}
{{- if HasAgentPoolAvailabilityZones}}
volumeBindingMode: WaitForFirstConsumer
allowedTopologies:
- matchLabelExpressions:
- key: topology.disk.csi.azure.com/zone
values: {{GetZones}}
values: {{GetAgentPoolZones}}
{{else}}
volumeBindingMode: Immediate
{{- end}}
@ -5943,12 +5943,12 @@ parameters:
cachingMode: ReadOnly
reclaimPolicy: Delete
allowVolumeExpansion: true
{{- if HasAvailabilityZones}}
{{- if HasAgentPoolAvailabilityZones}}
volumeBindingMode: WaitForFirstConsumer
allowedTopologies:
- matchLabelExpressions:
- key: topology.disk.csi.azure.com/zone
values: {{GetZones}}
values: {{GetAgentPoolZones}}
{{else}}
volumeBindingMode: Immediate
{{- end}}

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

@ -1382,7 +1382,7 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu
sc, err := storageclass.Get(azureDiskStorageClass)
Expect(err).NotTo(HaveOccurred())
Expect(sc.Provisioner).To(Equal(azureDiskProvisioner))
if isUsingAzureDiskCSIDriver && eng.ExpandedDefinition.Properties.HasAvailabilityZones() {
if isUsingAzureDiskCSIDriver && eng.ExpandedDefinition.Properties.HasAgentPoolAvailabilityZones() {
Expect(sc.VolumeBindingMode).To(Equal("WaitForFirstConsumer"))
Expect(len(sc.AllowedTopologies)).To(Equal(1))
Expect(len(sc.AllowedTopologies[0].MatchLabelExpressions)).To(Equal(1))
@ -2851,11 +2851,7 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu
case "master":
instanceType = eng.ExpandedDefinition.Properties.MasterProfile.VMSize
case "agent":
osType := api.Linux
if n.IsWindows() {
osType = api.Windows
}
instanceType = util.GetAgentVMSize(eng.ExpandedDefinition.Properties.AgentPoolProfiles, osType)
instanceType = util.GetAgentVMSize(eng.ExpandedDefinition.Properties.AgentPoolProfiles, n.Metadata.Name, n.Status.NodeInfo.OperatingSystem)
}
Expect(labels).To(HaveKeyWithValue("beta.kubernetes.io/instance-type", instanceType))
Expect(labels).To(HaveKeyWithValue("node.kubernetes.io/instance-type", instanceType))

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

@ -8,6 +8,7 @@ import (
"fmt"
"log"
"os/exec"
"strconv"
"strings"
"time"
@ -90,10 +91,18 @@ func IsUsingEphemeralDisks(agentPools []*api.AgentPoolProfile) bool {
return false
}
func GetAgentVMSize(agentPools []*api.AgentPoolProfile, osType api.OSType) string {
for _, a := range agentPools {
if a.OSType == osType {
return a.VMSize
func GetAgentVMSize(agentPools []*api.AgentPoolProfile, nodeName, os string) string {
for i, a := range agentPools {
if os == "linux" {
if strings.Split(nodeName, "-")[1] == a.Name {
return a.VMSize
}
} else if os == "windows" {
if poolIndex, err := strconv.Atoi(nodeName[8:9]); err == nil {
if poolIndex == i {
return a.VMSize
}
}
}
}
return ""

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

@ -239,7 +239,10 @@ done
# Starting with 1.16 we pull cloud-controller-manager and cloud-node-manager
CLOUD_MANAGER_VERSIONS="
1.1.1
1.1.3
1.0.7
0.7.10
0.6.0
"
for CLOUD_MANAGER_VERSION in ${CLOUD_MANAGER_VERSIONS}; do
for COMPONENT in azure-cloud-controller-manager azure-cloud-node-manager; do
@ -250,7 +253,7 @@ for CLOUD_MANAGER_VERSION in ${CLOUD_MANAGER_VERSIONS}; do
done
AZUREDISK_CSI_VERSIONS="
1.8.0
1.9.0
"
for AZUREDISK_CSI_VERSION in ${AZUREDISK_CSI_VERSIONS}; do
CONTAINER_IMAGE="mcr.microsoft.com/oss/kubernetes-csi/azuredisk-csi:v${AZUREDISK_CSI_VERSION}"
@ -259,7 +262,7 @@ for AZUREDISK_CSI_VERSION in ${AZUREDISK_CSI_VERSIONS}; do
done
AZUREFILE_CSI_VERSIONS="
1.7.0
1.8.0
"
for AZUREFILE_CSI_VERSION in ${AZUREFILE_CSI_VERSIONS}; do
CONTAINER_IMAGE="mcr.microsoft.com/oss/kubernetes-csi/azurefile-csi:v${AZUREFILE_CSI_VERSION}"