Skip to content

Commit

Permalink
feat(disk): add region and zone labels to disk PV
Browse files Browse the repository at this point in the history
  • Loading branch information
iltyty committed Jan 7, 2025
1 parent a3d455c commit b64eaa9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/disk/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ import (
const (
driverType = "disk"
driverName = "diskplugin.csi.alibabacloud.com"
TopologyZoneKey = "topology." + driverName + "/zone"
TopologyKey = "topology." + driverName
TopologyRegionKey = TopologyKey + "/region"
TopologyZoneKey = TopologyKey + "/zone"
TopologyMultiZonePrefix = TopologyZoneKey + "-"
)

Expand Down
2 changes: 2 additions & 0 deletions pkg/disk/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -951,10 +951,12 @@ func patchForNode(node *v1.Node, maxVolumesNum int, diskTypes []string) []byte {
func volumeCreate(attempt createAttempt, diskID string, volSizeBytes int64, volumeContext map[string]string, zoneID string, contextSource *csi.VolumeContentSource) *csi.Volume {
segments := map[string]string{}
cateDesc := AllCategories[attempt.Category]
volumeContext[labelAppendPrefix+TopologyRegionKey] = GlobalConfigVar.Region
if cateDesc.Regional {
segments[common.TopologyKeyRegion] = GlobalConfigVar.Region
} else {
segments[TopologyZoneKey] = zoneID
volumeContext[labelAppendPrefix+TopologyZoneKey] = zoneID
}
if attempt.Instance != "" {
segments[common.ECSInstanceIDTopologyKey] = attempt.Instance
Expand Down

0 comments on commit b64eaa9

Please sign in to comment.