From 13a732b39c88538552e8c0e8b3f4d19e5dd5b972 Mon Sep 17 00:00:00 2001 From: Abhijit Mukherjee Date: Fri, 23 Feb 2024 17:05:54 +0530 Subject: [PATCH] Addressed review comments Signed-off-by: Abhijit Mukherjee --- cmd/reposervercontroller/main.go | 3 ++- pkg/resource/resource.go | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/reposervercontroller/main.go b/cmd/reposervercontroller/main.go index ea8013341a0..b0f26c003b8 100644 --- a/cmd/reposervercontroller/main.go +++ b/cmd/reposervercontroller/main.go @@ -35,6 +35,7 @@ import ( "github.com/kanisterio/kanister/pkg/controllers/repositoryserver" "github.com/kanisterio/kanister/pkg/resource" "github.com/kanisterio/kanister/pkg/validatingwebhook" + //+kubebuilder:scaffold:imports "github.com/kanisterio/kanister/pkg/utils" ) @@ -131,7 +132,7 @@ func main() { hookServerOptions := webhook.Options{CertDir: validatingwebhook.WHCertsDir, Port: webhookServerPort} hookServer := webhook.NewServer(hookServerOptions) webhook := admission.WithCustomValidator(mgr.GetScheme(), &crv1alpha1.RepositoryServer{}, &validatingwebhook.RepositoryServerValidator{}) - // registers a webhooks to a webhook server that gets ran by a controller manager. + // registers a webhooks to a webhook server that gets run by a controller manager. hookServer.Register(whHandlePath, webhook) if err := mgr.Add(hookServer); err != nil { setupLog.Error(err, "Failed to add webhook server to the manager") diff --git a/pkg/resource/resource.go b/pkg/resource/resource.go index 4c4a109aa9f..35a3697315c 100644 --- a/pkg/resource/resource.go +++ b/pkg/resource/resource.go @@ -38,7 +38,7 @@ const ( // CreateCustomResources creates the given custom resources and waits for them to initialize func CreateCustomResources(ctx context.Context, config *rest.Config) error { - crCTX, err := newOpKitContext(config, ctx) + crCTX, err := newOpKitContext(ctx, config) if err != nil { return err } @@ -50,7 +50,7 @@ func CreateCustomResources(ctx context.Context, config *rest.Config) error { return customresource.CreateCustomResources(*crCTX, resources) } -func newOpKitContext(config *rest.Config, ctx context.Context) (*customresource.Context, error) { +func newOpKitContext(ctx context.Context, config *rest.Config) (*customresource.Context, error) { clientset, err := kubernetes.NewForConfig(config) if err != nil { return nil, errors.Wrap(err, "failed to get k8s client.") @@ -70,7 +70,7 @@ func newOpKitContext(config *rest.Config, ctx context.Context) (*customresource. // CreateRepoServerCustomResource creates the kopia repository server custom resource func CreateRepoServerCustomResource(ctx context.Context, config *rest.Config) error { - crCTX, err := newOpKitContext(config, ctx) + crCTX, err := newOpKitContext(ctx, config) if err != nil { return err }