1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: socialweb-owner
labels:
app.kubernetes.io/part-of: socialweb-computer
socialweb.computer/role: owner
subjects:
- kind: ServiceAccount
name: __SOCIALWEB_OWNER_SERVICE_ACCOUNT__
namespace: users
- kind: Group
apiGroup: rbac.authorization.k8s.io
name: socialweb.computer:cluster-owners
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicy
metadata:
name: socialweb-mint-identity
spec:
failurePolicy: Fail
matchConstraints:
resourceRules:
- apiGroups: [""]
apiVersions: ["v1"]
operations: ["CREATE"]
resources: ["secrets"]
scope: Namespaced
matchConditions:
- name: only-in-users
expression: request.namespace == 'users'
validations:
- expression: >-
(request.userInfo.username == 'system:admin' && 'system:masters' in request.userInfo.groups)
|| request.userInfo.username == '__SOCIALWEB_ESO_USER__'
message: "only the provisioning cluster-admin or the External Secrets controller that materialises its vault-backed Secrets may write Secrets in this namespace"
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicyBinding
metadata:
name: socialweb-mint-identity
spec:
policyName: socialweb-mint-identity
validationActions: ["Deny"]
matchResources: {}