Skip to content

Commit

Permalink
Fixing lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Abhijit Mukherjee <abhijit.mukherjee@infracloud.io>
  • Loading branch information
mabhi committed Dec 26, 2023
1 parent 268aeef commit 3b675f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions cmd/reposervercontroller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/kanisterio/kanister/pkg/apis/cr/v1alpha1"
crv1alpha1 "github.com/kanisterio/kanister/pkg/apis/cr/v1alpha1"
"github.com/kanisterio/kanister/pkg/controllers/repositoryserver"
"github.com/kanisterio/kanister/pkg/log"
"github.com/kanisterio/kanister/pkg/resource"
"github.com/kanisterio/kanister/pkg/validatingwebhook"

//+kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -144,7 +142,7 @@ func main() {
if validatingwebhook.IsCACertMounted() {
hookServerOptions := webhook.Options{CertDir: validatingwebhook.WHCertsDir, Port: webhookServerPort}
hookServer := webhook.NewServer(hookServerOptions)
webhook := admission.WithCustomValidator(mgr.GetScheme(), &v1alpha1.RepositoryServer{}, &validatingwebhook.RepositoryServerValidator{})
webhook := admission.WithCustomValidator(mgr.GetScheme(), &crv1alpha1.RepositoryServer{}, &validatingwebhook.RepositoryServerValidator{})
hookServer.Register(whHandlePath, webhook)
}
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/validatingwebhook/repositoryserver_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ import (
"context"
"fmt"

"github.com/kanisterio/kanister/pkg/apis/cr/v1alpha1"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

crv1alpha1 "github.com/kanisterio/kanister/pkg/apis/cr/v1alpha1"
)

type RepositoryServerValidator struct{}
Expand All @@ -39,8 +40,8 @@ func (r *RepositoryServerValidator) ValidateCreate(ctx context.Context, obj runt

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *RepositoryServerValidator) ValidateUpdate(ctx context.Context, old runtime.Object, new runtime.Object) (admission.Warnings, error) {
oldrs, ook := old.(*v1alpha1.RepositoryServer)
newrs, nok := new.(*v1alpha1.RepositoryServer)
oldrs, ook := old.(*crv1alpha1.RepositoryServer)
newrs, nok := new.(*crv1alpha1.RepositoryServer)
if !ook || !nok {
return nil, errors.New("Either updated object or the old object is not of type RepositoryServer.cr.kanister.io")
}
Expand Down

0 comments on commit 3b675f0

Please sign in to comment.