// LabelZonesToSet converts a PV label value from string containing a delimited list of zones to set func LabelZonesToSet(labelZonesValue string) (sets.String, error) { … } // ZonesSetToLabelValue converts zones set to label value func ZonesSetToLabelValue(strSet sets.String) string { … } // ZonesToSet converts a string containing a comma separated list of zones to set func ZonesToSet(zonesString string) (sets.String, error) { … } // StringToSet converts a string containing list separated by specified delimiter to a set func stringToSet(str, delimiter string) (sets.String, error) { … } // LabelZonesToList converts a PV label value from string containing a delimited list of zones to list func LabelZonesToList(labelZonesValue string) ([]string, error) { … } // StringToList converts a string containing list separated by specified delimiter to a list func stringToList(str, delimiter string) ([]string, error) { … } // SelectZoneForVolume is a wrapper around SelectZonesForVolume // to select a single zone for a volume based on parameters func SelectZoneForVolume(zoneParameterPresent, zonesParameterPresent bool, zoneParameter string, zonesParameter, zonesWithNodes sets.String, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm, pvcName string) (string, error) { … } // SelectZonesForVolume selects zones for a volume based on several factors: // node.zone, allowedTopologies, zone/zones parameters from storageclass, // zones with active nodes from the cluster. The number of zones = replicas. func SelectZonesForVolume(zoneParameterPresent, zonesParameterPresent bool, zoneParameter string, zonesParameter, zonesWithNodes sets.String, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm, pvcName string, numReplicas uint32) (sets.String, error) { … } // ZonesFromAllowedTopologies returns a list of zones specified in allowedTopologies func ZonesFromAllowedTopologies(allowedTopologies []v1.TopologySelectorTerm) (sets.String, error) { … } // chooseZonesForVolumeIncludingZone is a wrapper around ChooseZonesForVolume that ensures zoneToInclude is chosen // zoneToInclude can either be empty in which case it is ignored. If non-empty, zoneToInclude is expected to be member of zones. // numReplicas is expected to be > 0 and <= zones.Len() func chooseZonesForVolumeIncludingZone(zones sets.String, pvcName, zoneToInclude string, numReplicas uint32) (sets.String, error) { … } // ChooseZonesForVolume is identical to ChooseZoneForVolume, but selects a multiple zones, for multi-zone disks. func ChooseZonesForVolume(zones sets.String, pvcName string, numZones uint32) sets.String { … } func getPVCNameHashAndIndexOffset(pvcName string) (hash uint32, index uint32) { … }