Skip to content

Commit

Permalink
controllers: reconcile webhook only when we are managing CSI
Browse files Browse the repository at this point in the history
when we are not managing CSI we are scaled down by a higher level
operator, however as the default for us is running state, client-op
creates a webhook and then waits for CSI.

this changes folds the decision of managing webhook and dependents of
webhook onto CSI being managed or not.

Signed-off-by: Leela Venkaiah G <[email protected]>
  • Loading branch information
leelavg committed Jul 29, 2024
1 parent e9adefa commit 5e08b73
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions internal/controller/operatorconfigmap_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,26 +212,6 @@ func (c *OperatorConfigMapReconciler) Reconcile(ctx context.Context, req ctrl.Re
}
}

if err := c.reconcileWebhookService(); err != nil {
c.log.Error(err, "unable to reconcile webhook service")
return ctrl.Result{}, err
}

if err := c.reconcileSubscriptionValidatingWebhook(); err != nil {
c.log.Error(err, "unable to register subscription validating webhook")
return ctrl.Result{}, err
}

if err := c.reconcileClientOperatorSubscription(); err != nil {
c.log.Error(err, "unable to reconcile client operator subscription")
return ctrl.Result{}, err
}

if err := c.reconcileCSIAddonsOperatorSubscription(); err != nil {
c.log.Error(err, "unable to reconcile CSI Addons subscription")
return ctrl.Result{}, err
}

if err := c.ensureConsolePlugin(); err != nil {
c.log.Error(err, "unable to deploy client console")
return ctrl.Result{}, err
Expand All @@ -241,6 +221,26 @@ func (c *OperatorConfigMapReconciler) Reconcile(ctx context.Context, req ctrl.Re
c.log.Error(err, "failed to perform precheck for deploying CSI")
return ctrl.Result{}, err
} else if deployCSI {
if err := c.reconcileWebhookService(); err != nil {
c.log.Error(err, "unable to reconcile webhook service")
return ctrl.Result{}, err
}

if err := c.reconcileSubscriptionValidatingWebhook(); err != nil {
c.log.Error(err, "unable to register subscription validating webhook")
return ctrl.Result{}, err
}

if err := c.reconcileClientOperatorSubscription(); err != nil {
c.log.Error(err, "unable to reconcile client operator subscription")
return ctrl.Result{}, err
}

if err := c.reconcileCSIAddonsOperatorSubscription(); err != nil {
c.log.Error(err, "unable to reconcile CSI Addons subscription")
return ctrl.Result{}, err
}

clusterVersion := &configv1.ClusterVersion{}
clusterVersion.Name = clusterVersionName
if err := c.get(clusterVersion); err != nil {
Expand Down

0 comments on commit 5e08b73

Please sign in to comment.