Skip to content

Commit

Permalink
Merge pull request #7110 from pvsune/fix/license-setting-end
Browse files Browse the repository at this point in the history
Set license to be at the last part of reconciliation
  • Loading branch information
pvsune authored Nov 7, 2022
2 parents 952b50a + 0d877bd commit 35a6066
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/go/k8s/controllers/redpanda/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ func (r *ClusterReconciler) Reconcile(
return ctrl.Result{}, nil
}

if err := r.setLicense(ctx, &redpandaCluster, log); err != nil {
return ctrl.Result{}, fmt.Errorf("setting license: %w", err)
}

redpandaPorts := networking.NewRedpandaPorts(&redpandaCluster)
nodeports := collectNodePorts(redpandaPorts)
headlessPorts := collectHeadlessPorts(redpandaPorts)
Expand Down Expand Up @@ -264,7 +260,18 @@ func (r *ClusterReconciler) Reconcile(
log.Info(requeueErr.Error())
return ctrl.Result{RequeueAfter: requeueErr.RequeueAfter}, nil
}
return ctrl.Result{}, err
if err != nil {
return ctrl.Result{}, err
}

// setting license should be at the last part as it requires AdminAPI to be running
if cc := redpandaCluster.Status.GetCondition(redpandav1alpha1.ClusterConfiguredConditionType); cc == nil || cc.Status != corev1.ConditionTrue {
return ctrl.Result{RequeueAfter: time.Minute * 1}, nil
}
if err := r.setLicense(ctx, &redpandaCluster, log); err != nil {
return ctrl.Result{}, fmt.Errorf("setting license: %w", err)
}
return ctrl.Result{}, nil
}

// SetupWithManager sets up the controller with the Manager.
Expand Down

0 comments on commit 35a6066

Please sign in to comment.