Skip to content

Commit

Permalink
Move log message to only log when the orchestrator type is initially set
Browse files Browse the repository at this point in the history
Signed-off-by: Shiva Krishna, Merla <[email protected]>
  • Loading branch information
shivamerla committed Nov 4, 2024
1 parent bbd16db commit 1f7718d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/controller/nemo_guardrail_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,10 @@ func (r *NemoGuardrailReconciler) Reconcile(ctx context.Context, req ctrl.Reques
}

// Fetch container orchestrator type
orchestratorType, err := r.GetOrchestratorType()
_, err := r.GetOrchestratorType()
if err != nil {
return ctrl.Result{}, fmt.Errorf("Unable to get container orchestrator type, %v", err)
}
logger.Info("Container orchestrator is successfully set", "type", orchestratorType)

// Handle platform-specific reconciliation
if result, err := r.reconcileNemoGuardrail(ctx, NemoGuardrail); err != nil {
Expand Down Expand Up @@ -216,6 +215,7 @@ func (r *NemoGuardrailReconciler) GetOrchestratorType() (k8sutil.OrchestratorTyp
return k8sutil.Unknown, fmt.Errorf("Unable to get container orchestrator type, %v", err)
}
r.orchestratorType = orchestratorType
r.GetLogger().Info("Container orchestrator is successfully set", "type", orchestratorType)
}
return r.orchestratorType, nil
}
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/nimcache_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,10 @@ func (r *NIMCacheReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
}

// Fetch container orchestrator type
orchestratorType, err := r.GetOrchestratorType()
_, err = r.GetOrchestratorType()
if err != nil {
return ctrl.Result{}, fmt.Errorf("Unable to get container orchestrator type, %v", err)
}
logger.Info("Container orchestrator is successfully set", "type", orchestratorType)

// Handle nim-cache reconciliation
result, err = r.reconcileNIMCache(ctx, nimCache)
Expand Down Expand Up @@ -239,6 +238,7 @@ func (r *NIMCacheReconciler) GetOrchestratorType() (k8sutil.OrchestratorType, er
return k8sutil.Unknown, fmt.Errorf("Unable to get container orchestrator type, %v", err)
}
r.orchestratorType = orchestratorType
r.GetLogger().Info("Container orchestrator is successfully set", "type", orchestratorType)
}
return r.orchestratorType, nil
}
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/nimservice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,10 @@ func (r *NIMServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request)
}

// Fetch container orchestrator type
orchestratorType, err := r.GetOrchestratorType()
_, err := r.GetOrchestratorType()
if err != nil {
return ctrl.Result{}, fmt.Errorf("Unable to get container orchestrator type, %v", err)
}
logger.Info("Container orchestrator is successfully set", "type", orchestratorType)

// Handle platform-specific reconciliation
if result, err := r.Platform.Sync(ctx, r, nimService); err != nil {
Expand Down Expand Up @@ -207,6 +206,7 @@ func (r *NIMServiceReconciler) GetOrchestratorType() (k8sutil.OrchestratorType,
return k8sutil.Unknown, fmt.Errorf("Unable to get container orchestrator type, %v", err)
}
r.orchestratorType = orchestratorType
r.GetLogger().Info("Container orchestrator is successfully set", "type", orchestratorType)
}
return r.orchestratorType, nil
}
Expand Down

0 comments on commit 1f7718d

Please sign in to comment.