You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/webhook/fleetresourcehandler/fleetresourcehandler_webhook.go
+19-17Lines changed: 19 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,6 @@ import (
5
5
"fmt"
6
6
"net/http"
7
7
"regexp"
8
-
"strings"
9
8
10
9
admissionv1 "k8s.io/api/admission/v1"
11
10
"k8s.io/apimachinery/pkg/runtime"
@@ -24,11 +23,15 @@ import (
24
23
25
24
const (
26
25
// ValidationPath is the webhook service path which admission requests are routed to for validating custom resource definition resources.
27
-
ValidationPath="/validate-fleetresourcehandler"
28
-
groupMatch=`^[^.]*\.(.*)`
29
-
fleetMemberNamespacePrefix="fleet-member"
30
-
fleetNamespacePrefix="fleet"
31
-
kubeNamespacePrefix="kube"
26
+
ValidationPath="/validate-fleetresourcehandler"
27
+
groupMatch=`^[^.]*\.(.*)`
28
+
)
29
+
30
+
const (
31
+
// allowed messages.
32
+
allowedMessageMemberCluster="upstream member cluster resource is allowed to be created/deleted by any user"
33
+
allowedMessageNonReservedNamespace="namespace name doesn't begin with fleet-/kube- prefix so we allow all operations on this namespace"
34
+
allowedMessageFleetReservedNamespacedResource="namespace name of resource object doesn't begin with fleet-/kube- prefix so we allow all operations on request objects in these namespace"
32
35
)
33
36
34
37
// Add registers the webhook for K8s built-in object types.
@@ -138,15 +141,15 @@ func (v *fleetResourceValidator) handleMemberCluster(req admission.Request) admi
wantResponse: admission.Allowed("namespace name doesn't begin with fleet/kube prefix so we allow all operations on these namespaces for the request object"),
0 commit comments