Skip to content

Commit

Permalink
Merge pull request #2673 from msau42/add-gce-csi
Browse files Browse the repository at this point in the history
Add GCE PD CSI zone topology key to node template
  • Loading branch information
k8s-ci-robot authored Mar 20, 2020
2 parents 4fe2ca4 + bb2eed1 commit 8e19a64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/gce/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ import (
// GceTemplateBuilder builds templates for GCE nodes.
type GceTemplateBuilder struct{}

// TODO: This should be imported from sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/common/constants.go
// This key is applicable to both GCE and GKE
const gceCSITopologyKeyZone = "topology.gke.io/zone"

func (t *GceTemplateBuilder) getAcceleratorCount(accelerators []*gce.AcceleratorConfig) int64 {
count := int64(0)
for _, accelerator := range accelerators {
Expand Down Expand Up @@ -211,6 +215,7 @@ func BuildGenericLabels(ref GceRef, machineType string, nodeName string, os Oper
}
result[apiv1.LabelZoneRegion] = ref.Zone[:ix]
result[apiv1.LabelZoneFailureDomain] = ref.Zone
result[gceCSITopologyKeyZone] = ref.Zone
result[apiv1.LabelHostname] = nodeName
return result, nil
}
Expand Down
1 change: 1 addition & 0 deletions cluster-autoscaler/cloudprovider/gce/templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ func TestBuildGenericLabels(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,
Expand Down

0 comments on commit 8e19a64

Please sign in to comment.