Skip to content

Commit

Permalink
Fix RuntimeClient nil check in Cluster controller
Browse files Browse the repository at this point in the history
RuntimeClient is only mandatory if RuntimeSDK feature gate is enabled

Signed-off-by: Lennart Jern <[email protected]>
  • Loading branch information
lentzi90 committed Nov 15, 2024
1 parent a9fef8e commit 4c0a10e
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 4c0a10e

Please sign in to comment.