From d914702e93b2de01b21d591def9c1dffe0809860 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 --- changelogs/unreleased/8487-Lyndon-Li | 1 + pkg/exposer/csi_snapshot.go | 4 ++++ pkg/exposer/generic_restore.go | 8 ++++++++ pkg/exposer/types.go | 4 ++++ 4 files changed, 17 insertions(+) create mode 100644 changelogs/unreleased/8487-Lyndon-Li diff --git a/changelogs/unreleased/8487-Lyndon-Li b/changelogs/unreleased/8487-Lyndon-Li new file mode 100644 index 0000000000..8ea6009cf1 --- /dev/null +++ b/changelogs/unreleased/8487-Lyndon-Li @@ -0,0 +1 @@ +Fix issue #8433, add aks label to data mover pods \ No newline at end of file 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", +}