move stage-editor stuff to ontime-operator
This commit is contained in:
32
infrastructure/ontime-operator/namespace-prefix-policy.yaml
Normal file
32
infrastructure/ontime-operator/namespace-prefix-policy.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: ValidatingAdmissionPolicy
|
||||
metadata:
|
||||
name: "force-ns-prefix-for-stage-editor"
|
||||
spec:
|
||||
failurePolicy: Fail
|
||||
matchConstraints:
|
||||
resourceRules:
|
||||
- apiGroups: [""]
|
||||
apiVersions: ["v1"]
|
||||
operations: ["CREATE", "UPDATE"]
|
||||
resources: ["namespaces"]
|
||||
matchConditions:
|
||||
- name: 'only-stage-editor'
|
||||
expression: "request.userInfo.username == 'system:serviceaccount:ontime-operator-system:stage-editor'"
|
||||
validations:
|
||||
- expression: "object.metadata.name.startsWith('team-')"
|
||||
message: "All namespaces managed by stage-editor must start with 'team-'"
|
||||
---
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: ValidatingAdmissionPolicyBinding
|
||||
metadata:
|
||||
name: "force-ns-prefix-for-stage-editor-binding"
|
||||
spec:
|
||||
policyName: "force-ns-prefix-for-stage-editor"
|
||||
validationActions: [Deny]
|
||||
matchResources:
|
||||
resourceRules:
|
||||
- apiGroups: [""]
|
||||
apiVersions: ["v1"]
|
||||
operations: ["CREATE", "UPDATE"]
|
||||
resources: ["namespaces"]
|
||||
Reference in New Issue
Block a user