mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-08 22:23:15 +00:00
Modify according to comments
1. rename zoneSeparator to gkeZoneSeparator 2. add example of regional PV's node affinity. modify test case description. Signed-off-by: Xun Jiang <jxun@vmware.com>
This commit is contained in:
@@ -385,7 +385,7 @@ const (
|
||||
awsEbsCsiZoneKey = "topology.ebs.csi.aws.com/zone"
|
||||
azureCsiZoneKey = "topology.disk.csi.azure.com/zone"
|
||||
gkeCsiZoneKey = "topology.gke.io/zone"
|
||||
zoneSeparator = "__"
|
||||
gkeZoneSeparator = "__"
|
||||
)
|
||||
|
||||
// takePVSnapshot triggers a snapshot for the volume/disk underlying a PersistentVolume if the provided
|
||||
@@ -560,7 +560,7 @@ func zoneFromPVNodeAffinity(res *corev1api.PersistentVolume, topologyKeys ...str
|
||||
}
|
||||
|
||||
if providerGke {
|
||||
return gkeCsiZoneKey, strings.Join(zones, zoneSeparator)
|
||||
return gkeCsiZoneKey, strings.Join(zones, gkeZoneSeparator)
|
||||
}
|
||||
|
||||
return "", ""
|
||||
|
||||
@@ -132,7 +132,22 @@ func Test_zoneFromPVNodeAffinity(t *testing.T) {
|
||||
wantValue: "us-central",
|
||||
},
|
||||
{
|
||||
name: "Volume with multiple valid keys, and provider is gke, returns the all match", // it should never happen
|
||||
/* an valid example of node affinity in a GKE's regional PV
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: topology.gke.io/zone
|
||||
operator: In
|
||||
values:
|
||||
- us-central1-a
|
||||
- matchExpressions:
|
||||
- key: topology.gke.io/zone
|
||||
operator: In
|
||||
values:
|
||||
- us-central1-c
|
||||
*/
|
||||
name: "Volume with multiple valid keys, and provider is gke, returns all valid entries's first zone value",
|
||||
pv: builder.ForPersistentVolume("multi-matching-pv").NodeAffinityRequired(
|
||||
builder.ForNodeSelector(
|
||||
*builder.NewNodeSelectorTermBuilder().WithMatchExpression("topology.gke.io/zone",
|
||||
|
||||
Reference in New Issue
Block a user