mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-15 11:46:06 +00:00
Add the key for GKE zone for AZ collection
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Add the key for GKE zone for AZ collection
|
||||
@@ -401,6 +401,7 @@ const (
|
||||
|
||||
awsEbsCsiZoneKey = "topology.ebs.csi.aws.com/zone"
|
||||
azureCsiZoneKey = "topology.disk.csi.azure.com/zone"
|
||||
gkeCsiZoneKey = "topology.gke.io/zone"
|
||||
)
|
||||
|
||||
// takePVSnapshot triggers a snapshot for the volume/disk underlying a PersistentVolume if the provided
|
||||
@@ -439,7 +440,7 @@ func (ib *itemBackupper) takePVSnapshot(obj runtime.Unstructured, log logrus.Fie
|
||||
if !labelFound {
|
||||
var k string
|
||||
log.Infof("label %q is not present on PersistentVolume", zoneLabelDeprecated)
|
||||
k, pvFailureDomainZone = zoneFromPVNodeAffinity(pv, awsEbsCsiZoneKey, azureCsiZoneKey, zoneLabel, zoneLabelDeprecated)
|
||||
k, pvFailureDomainZone = zoneFromPVNodeAffinity(pv, awsEbsCsiZoneKey, azureCsiZoneKey, gkeCsiZoneKey, zoneLabel, zoneLabelDeprecated)
|
||||
if pvFailureDomainZone != "" {
|
||||
log.Infof("zone info from nodeAffinity requirements: %s, key: %s", pvFailureDomainZone, k)
|
||||
} else {
|
||||
|
||||
@@ -51,7 +51,9 @@ func Test_zoneFromPVNodeAffinity(t *testing.T) {
|
||||
keys := []string{
|
||||
awsEbsCsiZoneKey,
|
||||
azureCsiZoneKey,
|
||||
gkeCsiZoneKey,
|
||||
zoneLabel,
|
||||
zoneLabelDeprecated,
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -81,6 +83,17 @@ func Test_zoneFromPVNodeAffinity(t *testing.T) {
|
||||
wantKey: "topology.disk.csi.azure.com/zone",
|
||||
wantValue: "us-central",
|
||||
},
|
||||
{
|
||||
name: "GCP CSI Volume",
|
||||
pv: builder.ForPersistentVolume("gcpcsi").NodeAffinityRequired(
|
||||
builder.ForNodeSelector(
|
||||
*builder.NewNodeSelectorTermBuilder().WithMatchExpression("topology.gke.io/zone",
|
||||
"In", "us-west1-a").Result(),
|
||||
).Result(),
|
||||
).Result(),
|
||||
wantKey: "topology.gke.io/zone",
|
||||
wantValue: "us-west1-a",
|
||||
},
|
||||
{
|
||||
name: "AWS CSI Volume with multiple zone value, returns the first",
|
||||
pv: builder.ForPersistentVolume("awscsi").NodeAffinityRequired(
|
||||
|
||||
Reference in New Issue
Block a user