Skip to content

Commit

Permalink
Exclude VolSync secret Policy from hub backup
Browse files Browse the repository at this point in the history
Signed-off-by: Benamar Mekhissi <bmekhiss@ibm.com>
  • Loading branch information
Benamar Mekhissi authored and raghavendra-talur committed Dec 5, 2023
1 parent 9dd1c15 commit ca7af2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions controllers/volsync/secret_propagator.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ func (sp *secretPropagator) reconcileSecretPropagationPolicy() error {
return fmt.Errorf("%w", err)
}

util.AddLabel(policy, "velero.io/exclude-from-backup", "true")

policy.Spec = policyv1.PolicySpec{
Disabled: false,
PolicyTemplates: []*policyv1.PolicyTemplate{
Expand Down
1 change: 1 addition & 0 deletions controllers/volsync/secret_propagator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ var _ = Describe("Secret_propagator", func() {
Expect(plBindingSubject.APIGroup).To(Equal("policy.open-cluster-management.io"))
Expect(plBindingSubject.Kind).To(Equal("Policy"))
Expect(plBindingSubject.Name).To(Equal(createdPolicy.GetName()))
Expect(createdPolicy.GetLabels()["velero.io/exclude-from-backup"]).Should(Equal("true"))
})

Context("When Policy name combined with namespace is longer than 62 characters", func() {
Expand Down

0 comments on commit ca7af2d

Please sign in to comment.