From 25d2a1d0967c604607abde93af34bd1401adb403 Mon Sep 17 00:00:00 2001 From: Lyndon-Li Date: Thu, 5 Dec 2024 18:39:33 +0800 Subject: [PATCH] issue 8433: add ask label to data mover pods Signed-off-by: Lyndon-Li --- pkg/exposer/csi_snapshot.go | 4 ++++ pkg/exposer/generic_restore.go | 8 ++++++++ pkg/exposer/types.go | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/pkg/exposer/csi_snapshot.go b/pkg/exposer/csi_snapshot.go index bb421a794a..0e2d0b4db8 100644 --- a/pkg/exposer/csi_snapshot.go +++ b/pkg/exposer/csi_snapshot.go @@ -488,6 +488,10 @@ func (e *csiSnapshotExposer) createBackupPod( } label[podGroupLabel] = podGroupSnapshot + for k, v := range thirdPartyLabels { + label[k] = v + } + volumeMode := corev1.PersistentVolumeFilesystem if backupPVC.Spec.VolumeMode != nil { volumeMode = *backupPVC.Spec.VolumeMode diff --git a/pkg/exposer/generic_restore.go b/pkg/exposer/generic_restore.go index 975981d49a..e81d820380 100644 --- a/pkg/exposer/generic_restore.go +++ b/pkg/exposer/generic_restore.go @@ -323,6 +323,14 @@ func (e *genericRestoreExposer) createRestorePod(ctx context.Context, ownerObjec }} volumes = append(volumes, podInfo.volumes...) + if label == nil { + label = make(map[string]string) + } + + for k, v := range thirdPartyLabels { + label[k] = v + } + volumeMode := corev1.PersistentVolumeFilesystem if targetPVC.Spec.VolumeMode != nil { volumeMode = *targetPVC.Spec.VolumeMode diff --git a/pkg/exposer/types.go b/pkg/exposer/types.go index d4d8c87300..a75f5d3791 100644 --- a/pkg/exposer/types.go +++ b/pkg/exposer/types.go @@ -39,3 +39,7 @@ type ExposeByPod struct { HostingContainer string VolumeName string } + +var thirdPartyLabels map[string]string = map[string]string{ + "azure.workload.identity/use": "true", +}