Skip to content

Commit

Permalink
fix(): append missing labels instead of replacing
Browse files Browse the repository at this point in the history
Signed-off-by: Priyank Upadhyay <[email protected]>
  • Loading branch information
priyank-upadhyay committed Nov 12, 2024
1 parent e05c53c commit f893a2d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion service/namespace_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ func (n *NamespaceService) ReconcileProjectNamespace(ctx context.Context, namesp
} else {
// check if the namespace has the correct labels
if !util.CompareLabels(nsResource.Labels, n.getResourceLabel(namespace, owner)) {
nsResource.Labels = n.getResourceLabel(namespace, owner)
// append missing labels
for key, value := range n.getResourceLabel(namespace, owner) {
if nsResource.Labels[key] != value {
nsResource.Labels[key] = value
}
}
err := util.UpdateResource(ctx, nsResource)
nsResource.Namespace = ControllerNamespace
if err != nil {
Expand Down

0 comments on commit f893a2d

Please sign in to comment.