Skip to content

Commit

Permalink
Merge pull request #1020 from nasark/add_labels
Browse files Browse the repository at this point in the history
AddLabels util function

(cherry picked from commit 6c35382)
  • Loading branch information
Fryguy committed Jan 5, 2024
1 parent 53f6649 commit 13467a0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions manageiq-operator/api/v1alpha1/helpers/miq-components/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ func addBackupLabel(backupLabel string, meta *metav1.ObjectMeta) {
meta.Labels[backupLabel] = "t"
}

func AddLabels(labels map[string]string, meta *metav1.ObjectMeta) {
if len(labels) > 0 {
if meta.Labels == nil {
meta.Labels = make(map[string]string)
}
for key, value := range labels {
meta.Labels[key] = value
}
}
}

func addBackupAnnotation(volumesToBackup string, meta *metav1.ObjectMeta) {
if meta.Annotations == nil {
meta.Annotations = make(map[string]string)
Expand Down

0 comments on commit 13467a0

Please sign in to comment.