Skip to content

Commit

Permalink
fix: when app ns and monitoring ns are the same, createorupdate wont …
Browse files Browse the repository at this point in the history
…work (#1537)

Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw authored Jan 22, 2025
1 parent c1ae46e commit 2258161
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions controllers/dscinitialization/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (r *DSCInitializationReconciler) createOperatorResource(ctx context.Context
// Patch monitoring namespace
err := r.patchMonitoringNS(ctx, dscInit)
if err != nil {
log.Error(err, "error patch monitoring namespace for managed cluster")
log.Error(err, "error patch monitoring namespace")
return err
}

Expand Down Expand Up @@ -143,11 +143,11 @@ func (r *DSCInitializationReconciler) createAppNamespace(ctx context.Context, ns

func (r *DSCInitializationReconciler) patchMonitoringNS(ctx context.Context, dscInit *dsciv1.DSCInitialization) error {
log := logf.FromContext(ctx)
if dscInit.Spec.Monitoring.ManagementState != operatorv1.Managed {
monitoringName := dscInit.Spec.Monitoring.Namespace
if dscInit.Spec.Monitoring.ManagementState != operatorv1.Managed || dscInit.Spec.ApplicationsNamespace == monitoringName {
return nil
}
// Create Monitoring Namespace if it is enabled and not exists
monitoringName := dscInit.Spec.Monitoring.Namespace

desiredMonitoringNamespace := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Expand Down

0 comments on commit 2258161

Please sign in to comment.