diff --git a/Makefile b/Makefile index ed0a7a2c3d..7f744bb14a 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ pre-commit: all verify test build: hypershift-operator control-plane-operator control-plane-pki-operator hypershift product-cli .PHONY: update -update: deps api api-docs app-sre-saas-template clients +update: api-deps api api-docs deps clients app-sre-saas-template .PHONY: verify verify: update staticcheck fmt vet promtool @@ -202,6 +202,9 @@ deps: $(GO) mod verify $(GO) list -m -mod=readonly -json all > /dev/null (cd hack/tools && $(GO) mod tidy && $(GO) mod vendor && $(GO) mod verify && $(GO) list -m -mod=readonly -json all > /dev/null) + +.PHONY: api-deps +api-deps: cd api && \ $(GO) mod tidy && \ $(GO) mod vendor && \ diff --git a/control-plane-operator/hostedclusterconfigoperator/controllers/nodecount/controller.go b/control-plane-operator/hostedclusterconfigoperator/controllers/nodecount/controller.go index f9e5a3bcf3..4f8153ddb1 100644 --- a/control-plane-operator/hostedclusterconfigoperator/controllers/nodecount/controller.go +++ b/control-plane-operator/hostedclusterconfigoperator/controllers/nodecount/controller.go @@ -53,6 +53,6 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (reconc cfg := hypershiftv1beta1applyconfigurations.HostedControlPlane(r.hcpName, r.hcpNamespace) cfg.Status = hypershiftv1beta1applyconfigurations.HostedControlPlaneStatus().WithNodeCount(len(nodes.Items)) - _, err := r.client.HypershiftV1beta1().HostedControlPlanes(r.hcpNamespace).Apply(ctx, cfg, metav1.ApplyOptions{FieldManager: ControllerName}) + _, err := r.client.HypershiftV1beta1().HostedControlPlanes(r.hcpNamespace).ApplyStatus(ctx, cfg, metav1.ApplyOptions{FieldManager: ControllerName}) return reconcile.Result{}, err } diff --git a/control-plane-operator/hostedclusterconfigoperator/controllers/nodecount/setup.go b/control-plane-operator/hostedclusterconfigoperator/controllers/nodecount/setup.go index dd33d4efd1..488b4ede13 100644 --- a/control-plane-operator/hostedclusterconfigoperator/controllers/nodecount/setup.go +++ b/control-plane-operator/hostedclusterconfigoperator/controllers/nodecount/setup.go @@ -1,7 +1,6 @@ package nodecount import ( - "fmt" "time" hypershiftclient "github.com/openshift/hypershift/client/clientset/clientset" @@ -20,20 +19,16 @@ func Setup(opts *operator.HostedClusterConfigOperatorConfig) error { if err != nil { return err } - if _, err := ctrl.NewControllerManagedBy(opts.Manager). + return ctrl.NewControllerManagedBy(opts.Manager). Named(ControllerName). For(&corev1.Node{}). WithOptions(controller.Options{ RateLimiter: workqueue.NewItemExponentialFailureRateLimiter(1*time.Second, 10*time.Second), - }).Build(&reconciler{ + }).Complete(&reconciler{ hcpName: opts.HCPName, hcpNamespace: opts.Namespace, client: hypershiftClient, lister: opts.CPCluster.GetClient(), guestClusterClient: opts.Manager.GetClient(), - }); err != nil { - return fmt.Errorf("failed setting up with a controller manager %w", err) - } - - return nil + }) }