-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlinstor-scheduler-admission.yaml
207 lines (207 loc) · 5.36 KB
/
linstor-scheduler-admission.yaml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: linstor-scheduler-admission
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: linstor-scheduler-admission
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: linstor-scheduler-admission
subjects:
- kind: ServiceAccount
name: linstor-scheduler-admission
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: linstor-scheduler-admission
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: linstor-scheduler-admission
subjects:
- kind: ServiceAccount
name: linstor-scheduler-admission
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: linstor-scheduler-admission
namespace: kube-system
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "create"]
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: linstor-scheduler-admission
rules:
- apiGroups: [""]
resources: ["pods", "persistentvolumeclaims", "persistentvolumes"]
verbs: ["get"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get"]
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["mutatingwebhookconfigurations"]
verbs: ["get", "update"]
---
apiVersion: batch/v1
kind: Job
metadata:
name: linstor-scheduler-admission-create
namespace: kube-system
spec:
template:
metadata:
name: linstor-scheduler-admission-create
spec:
containers:
- args:
- create
- --host=linstor-scheduler-admission,linstor-scheduler-admission.$(POD_NAMESPACE).svc
- --namespace=$(POD_NAMESPACE)
- --secret-name=linstor-scheduler-admission
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v20220916-gd32f8c343
imagePullPolicy: IfNotPresent
name: create
securityContext:
allowPrivilegeEscalation: false
restartPolicy: OnFailure
securityContext:
fsGroup: 2000
runAsNonRoot: true
runAsUser: 2000
serviceAccountName: linstor-scheduler-admission
---
apiVersion: batch/v1
kind: Job
metadata:
name: linstor-scheduler-admission-patch
namespace: kube-system
spec:
template:
metadata:
name: linstor-scheduler-admission-patch
spec:
containers:
- args:
- patch
- --webhook-name=linstor-scheduler-admission
- --namespace=$(POD_NAMESPACE)
- --patch-validating=false
- --patch-mutating=true
- --secret-name=linstor-scheduler-admission
- --patch-failure-policy=Ignore
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v20220916-gd32f8c343
imagePullPolicy: IfNotPresent
name: create
securityContext:
allowPrivilegeEscalation: false
restartPolicy: OnFailure
securityContext:
fsGroup: 2000
runAsNonRoot: true
runAsUser: 2000
serviceAccountName: linstor-scheduler-admission
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: linstor-scheduler-admission
namespace: kube-system
spec:
replicas: 2
selector:
matchLabels:
app.kubernetes.io/name: linstor-scheduler-admission
template:
metadata:
labels:
app.kubernetes.io/name: linstor-scheduler-admission
spec:
containers:
- name: linstor-scheduler-admission
image: quay.io/piraeusdatastore/linstor-scheduler-extender:v0.3.2
imagePullPolicy: IfNotPresent
command: ["/linstor-scheduler-admission"]
args:
- -scheduler=linstor
- -tls-cert-file=/usr/local/certificates/cert
- -tls-key-file=/usr/local/certificates/key
volumeMounts:
- mountPath: /usr/local/certificates/
name: webhook-cert
readOnly: true
serviceAccountName: linstor-scheduler-admission
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
volumes:
- name: webhook-cert
secret:
secretName: linstor-scheduler-admission
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app.kubernetes.io/name: linstor-scheduler-admission
---
apiVersion: v1
kind: Service
metadata:
name: linstor-scheduler-admission
namespace: kube-system
spec:
selector:
app.kubernetes.io/name: linstor-scheduler-admission
ports:
- protocol: TCP
port: 8080
targetPort: 8080
---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: linstor-scheduler-admission
webhooks:
- name: linstor-scheduler-admission.linbit.com
rules:
- apiGroups: [""]
apiVersions: ["v1"]
operations: ["CREATE"]
resources: ["pods"]
scope: "*"
clientConfig:
service:
namespace: kube-system
name: linstor-scheduler-admission
path: "/mutate"
port: 8080
admissionReviewVersions: ["v1", "v1beta1"]
sideEffects: None
failurePolicy: Ignore