Skip to content

Commit

Permalink
Merge pull request #3 from snapp-incubator/fix/lint-webhook
Browse files Browse the repository at this point in the history
fix lint
  • Loading branch information
AnisHamidi authored Mar 5, 2023
2 parents 4b8dbc5 + 3443e00 commit c6fd634
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions api/v1alpha1/team_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ var teamns corev1.Namespace
func (r *Team) ValidateCreate() error {
teamlog.Info("validate create", "name", r.Name)
clientset, err := getClinet()

if err != nil {
return errors.New("fail to get clinet,can't not update team object")
}
for _, ns := range r.Spec.Namespaces {

//check if namespace does not exist or has been deleted
Expand Down Expand Up @@ -83,7 +85,9 @@ func (r *Team) ValidateUpdate(old runtime.Object) error {
teamlog.Info("validate update", "name", r.Name)

clientset, err := getClinet()

if err != nil {
return errors.New("fail to get clinet,can't not update team object")
}
for _, ns := range r.Spec.Namespaces {

//check if namespace does not exist or has been deleted
Expand Down Expand Up @@ -125,7 +129,7 @@ func (r *Team) ValidateUpdate(old runtime.Object) error {
exists = true
}
}
if exists == false {
if !exists {
return errors.New("you can not remove the namespaces which have team label.")
}

Expand Down

0 comments on commit c6fd634

Please sign in to comment.