diff --git a/controllers/config/manager.go b/controllers/config/manager.go index 09313c3a..4d509540 100644 --- a/controllers/config/manager.go +++ b/controllers/config/manager.go @@ -1,7 +1,7 @@ // Copyright 2020-2021 Clastix Labs // SPDX-License-Identifier: Apache-2.0 -package rbac +package config import ( "context" @@ -25,8 +25,8 @@ type Manager struct { } // InjectClient injects the Client interface, required by the Runnable interface -func (r *Manager) InjectClient(c client.Client) error { - r.Client = c +func (c *Manager) InjectClient(client client.Client) error { + c.Client = client return nil } @@ -52,22 +52,22 @@ func forOptionPerInstanceName(instanceName string) builder.ForOption { }) } -func (r *Manager) SetupWithManager(mgr ctrl.Manager, configurationName string) error { +func (c *Manager) SetupWithManager(mgr ctrl.Manager, configurationName string) error { return ctrl.NewControllerManagedBy(mgr). For(&capsulev1alpha1.CapsuleConfiguration{}, forOptionPerInstanceName(configurationName)). - Complete(r) + Complete(c) } -func (r *Manager) Reconcile(ctx context.Context, request reconcile.Request) (res reconcile.Result, err error) { - r.Log.Info("CapsuleConfiguration reconciliation started", "request.name", request.Name) +func (c *Manager) Reconcile(ctx context.Context, request reconcile.Request) (res reconcile.Result, err error) { + c.Log.Info("CapsuleConfiguration reconciliation started", "request.name", request.Name) - cfg := configuration.NewCapsuleConfiguration(r.Client, request.Name) + cfg := configuration.NewCapsuleConfiguration(c.Client, request.Name) // Validating the Capsule Configuration options if _, err = cfg.ProtectedNamespaceRegexp(); err != nil { panic(errors.Wrap(err, "Invalid configuration for protected Namespace regex")) } - r.Log.Info("CapsuleConfiguration reconciliation finished", "request.name", request.Name) + c.Log.Info("CapsuleConfiguration reconciliation finished", "request.name", request.Name) return } diff --git a/main.go b/main.go index e3d85d0b..f3e32b9e 100644 --- a/main.go +++ b/main.go @@ -23,7 +23,7 @@ import ( capsulev1alpha1 "github.com/clastix/capsule/api/v1alpha1" capsulev1beta1 "github.com/clastix/capsule/api/v1beta1" "github.com/clastix/capsule/controllers" - config "github.com/clastix/capsule/controllers/config" + "github.com/clastix/capsule/controllers/config" "github.com/clastix/capsule/controllers/rbac" "github.com/clastix/capsule/controllers/secret" "github.com/clastix/capsule/controllers/servicelabels"