Skip to content

Commit

Permalink
Merge pull request #11426 from Nordix/lentzi90/fix-runtime-client-nil…
Browse files Browse the repository at this point in the history
…-check

🐛 Fix RuntimeClient nil check in Cluster controller
  • Loading branch information
k8s-ci-robot authored Nov 15, 2024
2 parents a9fef8e + 4c0a10e commit ceab066
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/controllers/topology/cluster/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ type Reconciler struct {
}

func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
if r.Client == nil || r.APIReader == nil || r.ClusterCache == nil || r.RuntimeClient == nil {
return errors.New("Client, APIReader, ClusterCache and RuntimeClient must not be nil")
if r.Client == nil || r.APIReader == nil || r.ClusterCache == nil {
return errors.New("Client, APIReader and ClusterCache must not be nil")
}

if feature.Gates.Enabled(feature.RuntimeSDK) && r.RuntimeClient == nil {
return errors.New("RuntimeClient must not be nil")
}

r.predicateLog = ctrl.LoggerFrom(ctx).WithValues("controller", "topology/cluster")
Expand Down

0 comments on commit ceab066

Please sign in to comment.