mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-21 06:36:06 +00:00
Merge pull request #8812 from Lyndon-Li/third-party-annotation-for-maintenance-job
Run the E2E test on kind / build (push) Failing after 6m4s
Run the E2E test on kind / setup-test-matrix (push) Successful in 2s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 37s
Close stale issues and PRs / stale (push) Successful in 8s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 1m11s
Trivy Nightly Scan / Trivy nightly scan (velero-restore-helper, main) (push) Failing after 55s
Run the E2E test on kind / build (push) Failing after 6m4s
Run the E2E test on kind / setup-test-matrix (push) Successful in 2s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 37s
Close stale issues and PRs / stale (push) Successful in 8s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 1m11s
Trivy Nightly Scan / Trivy nightly scan (velero-restore-helper, main) (push) Failing after 55s
Add third party annotation support for maintenance job
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Add third party annotation support for maintenance job, so that the declared third party annotations could be added to the maintenance job pods
|
||||
@@ -460,6 +460,13 @@ func buildJob(cli client.Client, ctx context.Context, repo *velerov1api.BackupRe
|
||||
}
|
||||
}
|
||||
|
||||
podAnnotations := map[string]string{}
|
||||
for _, k := range util.ThirdPartyAnnotations {
|
||||
if v := veleroutil.GetVeleroServerAnnotationValue(deployment, k); v != "" {
|
||||
podAnnotations[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
// Set arguments
|
||||
args := []string{"repo-maintenance"}
|
||||
args = append(args, fmt.Sprintf("--repo-name=%s", repo.Spec.VolumeNamespace))
|
||||
@@ -481,8 +488,9 @@ func buildJob(cli client.Client, ctx context.Context, repo *velerov1api.BackupRe
|
||||
BackoffLimit: new(int32), // Never retry
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "velero-repo-maintenance-pod",
|
||||
Labels: podLabels,
|
||||
Name: "velero-repo-maintenance-pod",
|
||||
Labels: podLabels,
|
||||
Annotations: podAnnotations,
|
||||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
|
||||
@@ -96,3 +96,12 @@ func GetVeleroServerLabelValue(deployment *appsv1.Deployment, key string) string
|
||||
|
||||
return deployment.Spec.Template.Labels[key]
|
||||
}
|
||||
|
||||
// GetVeleroServerAnnotationValue returns the value of specified annotation of Velero server deployment
|
||||
func GetVeleroServerAnnotationValue(deployment *appsv1.Deployment, key string) string {
|
||||
if deployment.Spec.Template.Annotations == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return deployment.Spec.Template.Annotations[key]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user