Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 53d5f06

Browse files
committed
initial webhook
1 parent 9c09454 commit 53d5f06

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

config/webhook/manifests.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,28 @@ webhooks:
7171
resources:
7272
- hierarchyconfigurations
7373
sideEffects: None
74+
- admissionReviewVersions:
75+
- v1
76+
clientConfig:
77+
service:
78+
name: webhook-service
79+
namespace: system
80+
path: /validate-objects
81+
failurePolicy: Fail
82+
name: objects.hnc.x-k8s.io
83+
rules:
84+
- apiGroups:
85+
- rbac.authorization.k8s.io
86+
apiVersions:
87+
- v1
88+
operations:
89+
- CREATE
90+
- UPDATE
91+
- DELETE
92+
resources:
93+
- roles
94+
- rolebindings
95+
sideEffects: None
7496
- admissionReviewVersions:
7597
- v1
7698
clientConfig:

internal/objects/validator.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ const (
3232
ServingPath = "/validate-objects"
3333
)
3434

35+
// Note: the validating webhook FAILS CLOSE. This means that if the webhook goes
36+
// down, all further changes are forbidden. The initial webhook configuration contains
37+
// just enforced types, and will be dynamically updated when reconciling the HNC configuration.
38+
//
39+
// +kubebuilder:webhook:admissionReviewVersions=v1,path=/validate-objects,mutating=false,failurePolicy=fail,groups="rbac.authorization.k8s.io",resources=roles;rolebindings,sideEffects=None,verbs=create;update;delete,versions=v1,name=objects.hnc.x-k8s.io
40+
3541
type Validator struct {
3642
Log logr.Logger
3743
Forest *forest.Forest

0 commit comments

Comments
 (0)