diff --git a/cluster-autoscaler/cloudprovider/gce/templates.go b/cluster-autoscaler/cloudprovider/gce/templates.go index 23210fb22d75..fc03881d428f 100644 --- a/cluster-autoscaler/cloudprovider/gce/templates.go +++ b/cluster-autoscaler/cloudprovider/gce/templates.go @@ -209,12 +209,15 @@ func BuildGenericLabels(ref GceRef, machineType string, nodeName string, os Oper result[apiv1.LabelOSStable] = string(os) result[apiv1.LabelInstanceType] = machineType + result[apiv1.LabelInstanceTypeStable] = machineType ix := strings.LastIndex(ref.Zone, "-") if ix == -1 { return nil, fmt.Errorf("unexpected zone: %s", ref.Zone) } result[apiv1.LabelZoneRegion] = ref.Zone[:ix] + result[apiv1.LabelZoneRegionStable] = ref.Zone[:ix] result[apiv1.LabelZoneFailureDomain] = ref.Zone + result[apiv1.LabelZoneFailureDomainStable] = ref.Zone result[gceCSITopologyKeyZone] = ref.Zone result[apiv1.LabelHostname] = nodeName return result, nil diff --git a/cluster-autoscaler/cloudprovider/gce/templates_test.go b/cluster-autoscaler/cloudprovider/gce/templates_test.go index df35f12dbccf..012eb0d6ec2c 100644 --- a/cluster-autoscaler/cloudprovider/gce/templates_test.go +++ b/cluster-autoscaler/cloudprovider/gce/templates_test.go @@ -166,15 +166,18 @@ func TestBuildGenericLabels(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { expectedLabels := map[string]string{ - apiv1.LabelZoneRegion: "us-central1", - apiv1.LabelZoneFailureDomain: "us-central1-b", - gceCSITopologyKeyZone: "us-central1-b", - apiv1.LabelHostname: "sillyname", - apiv1.LabelInstanceType: "n1-standard-8", - kubeletapis.LabelArch: cloudprovider.DefaultArch, - kubeletapis.LabelOS: tc.expectedOsLabel, - apiv1.LabelArchStable: cloudprovider.DefaultArch, - apiv1.LabelOSStable: tc.expectedOsLabel, + apiv1.LabelZoneRegion: "us-central1", + apiv1.LabelZoneRegionStable: "us-central1", + apiv1.LabelZoneFailureDomain: "us-central1-b", + apiv1.LabelZoneFailureDomainStable: "us-central1-b", + gceCSITopologyKeyZone: "us-central1-b", + apiv1.LabelHostname: "sillyname", + apiv1.LabelInstanceType: "n1-standard-8", + apiv1.LabelInstanceTypeStable: "n1-standard-8", + kubeletapis.LabelArch: cloudprovider.DefaultArch, + kubeletapis.LabelOS: tc.expectedOsLabel, + apiv1.LabelArchStable: cloudprovider.DefaultArch, + apiv1.LabelOSStable: tc.expectedOsLabel, } labels, err := BuildGenericLabels(GceRef{ Name: "kubernetes-minion-group",