Skip to content

Commit 3d848cf

Browse files
committed
Switch to disk-type.gke.io topology label key
1 parent 51b7f9e commit 3d848cf

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

Diff for: cmd/gce-pd-csi-driver/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var (
9494

9595
extraTagsStr = flag.String("extra-tags", "", "Extra tags to attach to each Compute Disk, Image, Snapshot created. It is a comma separated list of parent id, key and value like '<parent_id1>/<tag_key1>/<tag_value1>,...,<parent_idN>/<tag_keyN>/<tag_valueN>'. parent_id is the Organization or the Project ID or Project name where the tag key and the tag value resources exist. A maximum of 50 tags bindings is allowed for a resource. See https://cloud.google.com/resource-manager/docs/tags/tags-overview, https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing for details")
9696

97-
diskTopology = flag.Bool("disk-topology", false, "If set to true, the driver will add a topology.gke.io/[disk-type] topology label to the Topologies returned in CreateVolumeResponse. Label is only added if all cluster nodes have at least one disk support label")
97+
diskTopology = flag.Bool("disk-topology", false, "If set to true, the driver will add a disk-type.gke.io/[some-disk-type] topology label to the Topologies returned in CreateVolumeResponse.")
9898

9999
version string
100100
)

Diff for: pkg/common/constants.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ package common
1818

1919
const (
2020
// Keys for Topology. This key will be shared amongst drivers from GCP
21-
TopologyKeyPrefix = "topology.gke.io"
22-
TopologyKeyZone = TopologyKeyPrefix + "/zone"
21+
TopologyKeyZone = "topology.gke.io/zone"
22+
23+
// DiskTypeKeyPrefix is the prefix for the disk type label key used as part
24+
// of the Disk Topology feature.
25+
DiskTypeKeyPrefix = "disk-type.gke.io"
2326

2427
// VolumeAttributes for Partition
2528
VolumeAttributePartition = "partition"

Diff for: pkg/common/utils.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,6 @@ func MapNumber(num int64) int64 {
765765
return 0
766766
}
767767

768-
func IsGKETopologyLabel(key string) bool {
769-
return strings.HasPrefix(key, TopologyKeyPrefix)
770-
}
771-
772-
func TopologyLabelKey(diskType string) string {
773-
return fmt.Sprintf("%s/%s", TopologyKeyPrefix, diskType)
768+
func DiskTypeLabelKey(diskType string) string {
769+
return fmt.Sprintf("%s/%s", DiskTypeKeyPrefix, diskType)
774770
}

Diff for: pkg/gce-pd-csi-driver/controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2419,7 +2419,7 @@ func (gceCS *GCEControllerServer) generateCreateVolumeResponseWithVolumeId(disk
24192419
}
24202420

24212421
if gceCS.EnableDiskTopology {
2422-
top.Segments[common.TopologyLabelKey(params.DiskType)] = "true"
2422+
top.Segments[common.DiskTypeLabelKey(params.DiskType)] = "true"
24232423
}
24242424

24252425
tops = append(tops, top)

Diff for: pkg/gce-pd-csi-driver/controller_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ func TestCreateVolumeArguments(t *testing.T) {
13661366
Segments: map[string]string{
13671367
common.TopologyKeyZone: zone,
13681368
// Disk type is added as topology segment.
1369-
common.TopologyLabelKey(stdDiskType): "true",
1369+
common.DiskTypeLabelKey(stdDiskType): "true",
13701370
},
13711371
},
13721372
},

0 commit comments

Comments
 (0)