Skip to content

Commit

Permalink
fix webhook (#5068)
Browse files Browse the repository at this point in the history
  • Loading branch information
bxy4543 authored Sep 12, 2024
1 parent 7a19c64 commit 6647429
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion controllers/account/api/v1/debt_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ func (d *DebtValidate) Handle(ctx context.Context, req admission.Request) admiss
return admission.ValidationResponse(true, "")
}
// is user sa
if !strings.HasPrefix(g, saPrefix+":ns-") {
if !strings.HasPrefix(g, saPrefix+":user-system") {
continue
}
if strings.Contains(req.UserInfo.Username, "user-controller-manager") {
break
}
if isWhiteList(req) {
return admission.ValidationResponse(true, "")
}
Expand Down
6 changes: 3 additions & 3 deletions controllers/account/controllers/billing_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ func (r *BillingReconciler) SetupWithManager(mgr ctrl.Manager, rateOpts controll
own, ok := createEvent.Object.GetLabels()[v1.UserLabelOwnerKey]
return ok && getUsername(createEvent.Object.GetName()) == own
},
UpdateFunc: func(updateEvent event.UpdateEvent) bool {
UpdateFunc: func(_ event.UpdateEvent) bool {
return false
},
DeleteFunc: func(deleteEvent event.DeleteEvent) bool {
DeleteFunc: func(_ event.DeleteEvent) bool {
return false
},
GenericFunc: func(genericEvent event.GenericEvent) bool {
GenericFunc: func(_ event.GenericEvent) bool {
return false
},
})).
Expand Down

0 comments on commit 6647429

Please sign in to comment.