Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/controller/monitoring/monitoring_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (r *Reconciler) reconcile(ctx context.Context, clh *helper.Client, desired
if err != nil {
return err
}
} else if helper.IsManaged(nsExist) && !helper.IsSubSet(nsExist.ObjectMeta.Labels, desiredNs.ObjectMeta.Labels) {
} else if !helper.SkipOwnership(nsExist) && !helper.IsSubSet(nsExist.ObjectMeta.Labels, desiredNs.ObjectMeta.Labels) {
err = r.Update(ctx, desiredNs)
if err != nil {
return err
Expand Down
7 changes: 7 additions & 0 deletions internal/pkg/helper/flowcollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ func IsManaged(obj client.Object) bool {
return labels[netobservManagedLabel] == "true"
}

// special case where ownership is ignored if netobserv-managed label is explicitly set to false
// this is used to allow users to create namespaces with custom labels and annotations prior to the reconciliation
func SkipOwnership(obj client.Object) bool {
labels := obj.GetLabels()
return labels != nil && labels[netobservManagedLabel] == "false"
}

func IsOwned(obj client.Object) bool {
// ownership is forced if netobserv-managed label is explicitly set to true
if IsManaged(obj) {
Expand Down