-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathkubeplus-components-6.yaml
More file actions
512 lines (511 loc) · 14.2 KB
/
kubeplus-components-6.yaml
File metadata and controls
512 lines (511 loc) · 14.2 KB
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
apiVersion: v1
kind: Secret
metadata:
name: webhook-tls-certificates
namespace: {{ .Release.Namespace }}
type: Opaque
data:
username: YWRtaW4=
password: MWYyZDFlMmU2N2Rm
---
# No need for admin role in a namespace
#apiVersion: rbac.authorization.k8s.io/v1
#kind: RoleBinding
#metadata:
# name: kubeplus:namespace-admin
# namespace: {{ .Release.Namespace }}
#roleRef:
# apiGroup: rbac.authorization.k8s.io
# kind: ClusterRole
# name: admin
#subjects:
#- kind: ServiceAccount
# name: kubeplus
# namespace: {{ .Release.Namespace }}
# apiGroup: ""
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kubeplus:namespaceperms
rules:
- apiGroups: [""]
resources: ["namespaces","secrets","services","configmaps","endpoints","persistentvolumeclaims","pods","pods/attach","pods/exec","pods/portforward","pods/proxy","replicationcontrollers","replicationcontrollers/scale","serviceaccounts","services/proxy","events"]
verbs: ["get","list","create","update","delete","watch","patch"]
- apiGroups: ["apps"]
resources: ["daemonsets","deployments","deployments/rollback","deployments/scale","replicasets","replicasets/scale","statefulsets","statefulsets/scale"]
verbs: ["get","list","create","update","delete","watch","patch"]
- apiGroups: ["extensions"]
resources: ["daemonsets","deployments","deployments/rollback","deployments/scale","ingresses","networkpolicies","replicasets","replicasets/scale","replicationcontrollers/scale"]
verbs: ["get","list","create","update","delete","watch","patch"]
- apiGroups: ["networking.k8s.io"]
resources: ["ingresses","networkpolicies"]
verbs: ["get","list","create","update","delete","watch","patch"]
- apiGroups: ["policy"]
resources: ["poddisruptionbudgets"]
verbs: ["get","list","create","update","delete","watch","patch"]
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["rolebindings","roles"]
verbs: ["get","list","create","update","delete","watch","patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubeplus:namespaceperms-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeplus:namespaceperms
subjects:
- kind: ServiceAccount
name: kubeplus
namespace: {{ .Release.Namespace }}
apiGroup: ""
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kubeplus:allperms
rules:
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["patch"]
- apiGroups: ["certificates.k8s.io"]
resources: ["certificatesigningrequests","certificatesigningrequests/approval"]
verbs: ["get","list","create","update","delete","watch","patch"]
- apiGroups: ["certificates.k8s.io"]
resources: ["signers"]
resourceNames: ["kubernetes.io/legacy-unknown","kubernetes.io/kubelet-serving","kubernetes.io/kube-apiserver-client","cloudark.io/kubeplus"]
verbs: ["approve"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["get","list","create","update","delete","watch","patch"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get","list","watch"]
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["mutatingwebhookconfigurations"]
verbs: ["get","list","create","delete"]
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["clusterroles"]
verbs: ["get","list","create","delete"]
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["clusterrolebindings"]
verbs: ["get","list","create","delete"]
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["roles"]
verbs: ["get","list","update","delete","create"]
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["rolebindings"]
verbs: ["get","list","create","delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubeplus:allperms-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeplus:allperms
subjects:
- kind: ServiceAccount
name: kubeplus
namespace: {{ .Release.Namespace }}
apiGroup: ""
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kubeplus:readallperms
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["get","list","watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubeplus:readallperms-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeplus:readallperms
subjects:
- kind: ServiceAccount
name: kubeplus
namespace: {{ .Release.Namespace }}
apiGroup: ""
#- kind: ServiceAccount
# name: kubeplus-saas-provider
# namespace: {{ .Release.Namespace }}
# apiGroup: ""
- kind: ServiceAccount
name: kubeplus-saas-consumer
namespace: {{ .Release.Namespace }}
apiGroup: ""
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kubeplus:providerapiperms
rules:
- apiGroups: ["workflows.kubeplus"]
resources: ["resourcecompositions","resourceevents","resourcemonitors","resourcepolicies"]
verbs: ["get","list","create","update","delete","watch","patch"]
- apiGroups: [""]
resources: ["pods","pods/attach","pods/exec","pods/portforward","pods/proxy"]
verbs: ["get","list","create","update","delete","watch","patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubeplus:providerapiperms-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeplus:providerapiperms
subjects:
- kind: ServiceAccount
name: kubeplus
namespace: {{ .Release.Namespace }}
apiGroup: ""
#- kind: ServiceAccount
# name: kubeplus-saas-provider
# namespace: {{ .Release.Namespace }}
# apiGroup: ""
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: kubeplus-saas-provider-consumer
namespace: {{ .Release.Namespace }}
rules:
- apiGroups: ["platformapi.kubeplus"]
resources: ["*"]
verbs: ["get","list","create","update","delete","watch","patch"]
- apiGroups: [""]
resources: ["pods/portforward"]
verbs: ["get","list","create","update","delete","watch","patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: kubeplus-saas-provider-consumer-rolebinding
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: kubeplus-saas-provider-consumer
subjects:
#- kind: ServiceAccount
# name: kubeplus-saas-provider
# namespace: {{ .Release.Namespace }}
- kind: ServiceAccount
name: kubeplus-saas-consumer
namespace: {{ .Release.Namespace }}
- kind: ServiceAccount
name: kubeplus
namespace: {{ .Release.Namespace }}
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: kubeplus
namespace: {{ .Release.Namespace }}
---
#kind: ServiceAccount
#apiVersion: v1
#metadata:
# name: kubeplus-saas-provider
# namespace: {{ .Release.Namespace }}
#---
kind: ServiceAccount
apiVersion: v1
metadata:
name: kubeplus-saas-consumer
namespace: {{ .Release.Namespace }}
---
kind: Service
apiVersion: v1
metadata:
name: kubeplus
namespace: {{ .Release.Namespace }}
spec:
selector:
app: kubeplus
type: NodePort
ports:
- protocol: TCP
port: 90
targetPort: 8090
---
kind: Service
apiVersion: v1
metadata:
name: kubeconfighelper
namespace: {{ .Release.Namespace }}
spec:
selector:
app: kubeplus
type: NodePort
ports:
- protocol: TCP
port: 91
targetPort: 5005
---
kind: Service
apiVersion: v1
metadata:
name: kubeplus-consumerui
namespace: {{ .Release.Namespace }}
spec:
selector:
app: kubeplus
ports:
- protocol: TCP
port: 5000
targetPort: 5000
---
apiVersion: v1
kind: Service
metadata:
name: crd-hook-service
namespace: {{ .Release.Namespace }}
labels:
app: crd-hook-service
spec:
ports:
- port: 443
targetPort: 443
selector:
app: kubeplus
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: kubeplus-pv
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/resource-policy: "keep"
spec:
capacity:
storage: 1Gi # Adjust the size as needed
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: /kubeplus # This can be a path on the host system where charts will be stored.
volumeMode: Filesystem
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: kubeplus-pvc
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/resource-policy: "keep"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi # Make sure this matches the PV size
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ollama-models-pvc
namespace: {{ .Release.Namespace }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kubeplus-deployment # do not change
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: kubeplus
template:
metadata:
name: kubeplus
labels:
app: kubeplus
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
serviceAccount: kubeplus-saas-provider
initContainers:
#containers:
- name: webhook-cert-setup
image: {{ .Values.WEBHOOK_INIT_CONTAINER }} #gcr.io/cloudark-kubeplus/webhook-tls-getter:3.0.26
imagePullPolicy: IfNotPresent
env:
- name: KUBEPLUS_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
command: ["./webhook-create-self-signed-ca-cert.sh"]
args:
- "--service"
- "crd-hook-service"
- "--namespace"
- "$(KUBEPLUS_NAMESPACE)"
- "--secret"
- "webhook-tls-certificates"
containers:
- name: ollama-ai
image: ollama:latest
imagePullPolicy: IfNotPresent
env:
- name: MODEL_NAME
value: "gemma:2b"
- name: OLLAMA_MODELS
value: "/models"
- name: OLLAMA_MAX_LOADED_MODELS
value: "1"
- name: PORT
value: "8080"
ports:
- name: http
containerPort: 8080
volumeMounts:
- name: ollama-models
mountPath: /models
resources:
requests:
cpu: "1"
memory: "3Gi"
ephemeral-storage: "1Gi"
limits:
cpu: "2"
memory: "5Gi"
ephemeral-storage: "2Gi"
- name: kubeconfiggenerator
image: {{ .Values.CRD_REGISTRATION_HELPER }} #gcr.io/cloudark-kubeplus/kubeconfiggenerator:3.0.27
imagePullPolicy: IfNotPresent
resources:
requests:
ephemeral-storage: "70Mi"
limits:
ephemeral-storage: "75Mi"
env:
- name: KUBEPLUS_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
#command: ["./root/kubeconfiggenerator.sh"]
command: [ "python3", "/root/kubeconfiggenerator.py"]
args:
- "$(KUBEPLUS_NAMESPACE)"
volumeMounts:
- name: shared-data
mountPath: /crdinstances
- name: crd-hook
image: {{ .Values.MUTATING_WEBHOOK }} #gcr.io/cloudark-kubeplus/pac-mutating-admission-webhook:3.0.14
imagePullPolicy: IfNotPresent
resources:
requests:
ephemeral-storage: "10Mi"
limits:
ephemeral-storage: "15Mi"
env:
- name: CHECK_KYVERNO_POLICIES
value: "{{ .Values.CHECK_KYVERNO_POLICIES }}"
args:
- -tlsCertFile=/etc/webhook/certs/cert.pem
- -tlsKeyFile=/etc/webhook/certs/key.pem
- -alsologtostderr
#- -v=4
- 2>&1
volumeMounts:
- name: webhook-certs
mountPath: /etc/webhook/certs
readOnly: true
- name: shared-data
mountPath: /crdinstances
- name: platform-operator
image: {{ .Values.PLATFORM_OPERATOR }} #gcr.io/cloudark-kubeplus/platform-operator:3.0.6
imagePullPolicy: IfNotPresent
resources:
requests:
ephemeral-storage: "5Mi"
limits:
ephemeral-storage: "10Mi"
command: [ "/platform-operator"]
- name: consumerui
image: {{ .Values.CONSUMERUI }} #gcr.io/cloudark-kubeplus/consumerui:0.0.6
imagePullPolicy: IfNotPresent
resources:
requests:
ephemeral-storage: "10Mi"
limits:
ephemeral-storage: "500Mi"
command: [ "python3", "/root/consumerui.py"]
- name: helmer
image: {{ .Values.HELMER }} #gcr.io/cloudark-kubeplus/helm-pod:3.0.17
imagePullPolicy: IfNotPresent
resources:
requests:
ephemeral-storage: "10Mi"
limits:
ephemeral-storage: "15Mi"
command: ["/root/helm-pod"]
volumeMounts:
- mountPath: /chart
name: chart-volume
- name: shared-data
mountPath: /crdinstances
volumes:
- name: shared-data
emptyDir: {}
- name: chart-volume
persistentVolumeClaim:
claimName: kubeplus-pvc
- name: webhook-certs
secret:
secretName: webhook-tls-certificates
- name: ollama-models
persistentVolumeClaim:
claimName: ollama-models-pvc
---
apiVersion: batch/v1
kind: Job
metadata:
name: cleanup-kubeplus-components
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: "{{ .Release.Name }}"
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
restartPolicy: Never
serviceAccountName: kubeplus
containers:
- name: cleanup-kubeplus-components
env:
- name: KUBEPLUS_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: {{ .Values.RESOURCE_CLEANER }} #gcr.io/cloudark-kubeplus/delete-kubeplus-resources:3.0.12
imagePullPolicy: IfNotPresent
command: ["./root/delete-kubeplus-components.sh"]
args:
- "$(KUBEPLUS_NAMESPACE)"