Skip to content

Commit

Permalink
Add labels to maintanance job pods
Browse files Browse the repository at this point in the history
Signed-off-by: Shubham Pampattiwar <[email protected]>
  • Loading branch information
shubham-pampattiwar committed Sep 25, 2024
1 parent 11f771f commit 55157e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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 55157e0

Please sign in to comment.