Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Abhijit Mukherjee <[email protected]>
  • Loading branch information
mabhi committed Feb 23, 2024
1 parent ad7aeba commit 13a732b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cmd/reposervercontroller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions pkg/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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.")
Expand All @@ -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
}
Expand Down

0 comments on commit 13a732b

Please sign in to comment.