From 86689f9e6cef4af0739dd0450f16b4dfba6a1565 Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Mon, 1 Jan 2024 22:02:59 +0100 Subject: [PATCH] add caching rules via client and cache to main --- cmd/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 72842e42..d5ac6c18 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -38,6 +38,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook" natsv1alpha1 "github.com/kyma-project/nats-manager/api/v1alpha1" + controllercache "github.com/kyma-project/nats-manager/internal/controller/cache" + controllerclient "github.com/kyma-project/nats-manager/internal/controller/client" natscontroller "github.com/kyma-project/nats-manager/internal/controller/nats" "github.com/kyma-project/nats-manager/pkg/env" "github.com/kyma-project/nats-manager/pkg/k8s" @@ -112,8 +114,6 @@ func main() { //nolint:funlen // main function needs to initialize many objects HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, LeaderElectionID: leaderElectionID, - Metrics: server.Options{BindAddress: metricsAddr}, - WebhookServer: webhook.NewServer(webhook.Options{Port: metricsPort}), // LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily // when the Manager ends. This requires the binary to immediately end when the // Manager is stopped, otherwise, this setting is unsafe. Setting this significantly @@ -125,6 +125,10 @@ func main() { //nolint:funlen // main function needs to initialize many objects // if you are doing or is intended to do any operation such as perform cleanups // after the manager stops then its usage might be unsafe. // LeaderElectionReleaseOnCancel: true, + Metrics: server.Options{BindAddress: metricsAddr}, + WebhookServer: webhook.NewServer(webhook.Options{Port: metricsPort}), + NewCache: controllercache.New, + NewClient: controllerclient.New, }) if err != nil { setupLog.Error(err, "unable to start manager")