Skip to content

Commit

Permalink
Merge pull request #8246 from shubham-pampattiwar/add-labels-job
Browse files Browse the repository at this point in the history
Add labels to maintenance job pods
  • Loading branch information
reasonerjt authored Sep 25, 2024
2 parents 11f771f + c0d51a5 commit aab2140
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/8256-shubham-pampattiwar
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add labels to maintenance job pods
3 changes: 3 additions & 0 deletions pkg/repository/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,9 @@ func (m *manager) buildMaintenanceJob(
Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: "velero-repo-maintenance-pod",
Labels: map[string]string{
repository.RepositoryNameLabel: param.BackupRepo.Name,
},
},
Spec: v1.PodSpec{
Containers: []v1.Container{
Expand Down
2 changes: 2 additions & 0 deletions pkg/repository/manager/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ func TestBuildMaintenanceJob(t *testing.T) {
assert.Equal(t, param.BackupRepo.Namespace, job.Namespace)
assert.Equal(t, param.BackupRepo.Name, job.Labels[repository.RepositoryNameLabel])

assert.Equal(t, param.BackupRepo.Name, job.Spec.Template.ObjectMeta.Labels[repository.RepositoryNameLabel])

// Check container
assert.Len(t, job.Spec.Template.Spec.Containers, 1)
container := job.Spec.Template.Spec.Containers[0]
Expand Down

0 comments on commit aab2140

Please sign in to comment.