Skip to content

Commit 6b3a238

Browse files
committed
(manifests): populate pod security configs dynamically
This PR: * introduces a chart value that decides if the --set-workload-user-id flag to true or false for the catalog-operator container * introduces chart values to fill in the psa enforce level/version for the namespaces Closes #2827 Signed-off-by: Anik Bhattacharjee <[email protected]>
1 parent 67177c0 commit 6b3a238

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

deploy/chart/templates/0000_50_olm_00-namespace.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ kind: Namespace
33
metadata:
44
name: {{ .Values.namespace }}
55
labels:
6-
pod-security.kubernetes.io/enforce: restricted
7-
pod-security.kubernetes.io/enforce-version: latest
6+
{{- if .Values.namespace_psa }}
7+
pod-security.kubernetes.io/enforce: {{ .Values.namespace_psa.enforceLevel }}
8+
pod-security.kubernetes.io/enforce-version: {{ .Values.namespace_psa.enforceVersion }}
9+
{{- end }}
810

911
---
1012
apiVersion: v1
1113
kind: Namespace
1214
metadata:
1315
name: {{ .Values.operator_namespace }}
1416
labels:
15-
pod-security.kubernetes.io/enforce: baseline
16-
pod-security.kubernetes.io/enforce-version: latest
17+
{{- if .Values.operator_namespace_psa }}
18+
pod-security.kubernetes.io/enforce: {{ .Values.namespace_psa.enforceLevel }}
19+
pod-security.kubernetes.io/enforce-version: {{ .Values.namespace_psa.enforceVersion }}
20+
{{- end }}

deploy/chart/templates/0000_50_olm_08-catalog-operator.deployment.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,11 @@ spec:
8484
- --client-ca
8585
- /profile-collector-cert/tls.crt
8686
{{- end }}
87-
- --set-workload-user-id
88-
- "true"
87+
{{- if eq .Values.catalog.setWorkloadUserID true }}
88+
- --set-workload-user-id=true
89+
{{- else }}
90+
- --set-workload-user-id=false
91+
{{ end }}
8992
image: {{ .Values.catalog.image.ref }}
9093
imagePullPolicy: {{ .Values.catalog.image.pullPolicy }}
9194
ports:

deploy/chart/values.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
rbacApiVersion: rbac.authorization.k8s.io
22
namespace: operator-lifecycle-manager
3+
# see https://kubernetes.io/docs/concepts/security/pod-security-admission/ for more details
4+
namespace_psa:
5+
enforceLevel: restricted
6+
enforceVersion: '"v1.24"'
37
catalog_namespace: operator-lifecycle-manager
48
operator_namespace: operators
9+
# see https://kubernetes.io/docs/concepts/security/pod-security-admission/ for more details
10+
operator_namespace_psa:
11+
enforceLevel: baseline
12+
enforceVersion: '"v1.24"'
513
minKubeVersion: 1.11.0
614
writeStatusName: '""'
715
imagestream: false
@@ -25,6 +33,7 @@ olm:
2533
memory: 160Mi
2634

2735
catalog:
36+
setWorkloadUserID: true
2837
replicaCount: 1
2938
commandArgs: --configmapServerImage=quay.io/operator-framework/configmap-operator-registry:latest
3039
image:

deploy/upstream/values.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
installType: upstream
22
rbacApiVersion: rbac.authorization.k8s.io
33
namespace: olm
4+
# see https://kubernetes.io/docs/concepts/security/pod-security-admission/ for more details
5+
namespace_psa:
6+
enforceLevel: restricted
7+
enforceVersion: '"v1.24"'
48
catalog_namespace: olm
59
operator_namespace: operators
10+
# see https://kubernetes.io/docs/concepts/security/pod-security-admission/ for more details
11+
operator_namespace_psa:
12+
enforceLevel: baseline
13+
enforceVersion: '"v1.24"'
614
imagestream: false
715
writeStatusName: '""'
816
writePackageServerStatusName: ""
@@ -14,6 +22,7 @@ olm:
1422
service:
1523
internalPort: 8080
1624
catalog:
25+
setWorkloadUserID: true
1726
replicaCount: 1
1827
image:
1928
ref: quay.io/operator-framework/olm@sha256:e74b2ac57963c7f3ba19122a8c31c9f2a0deb3c0c5cac9e5323ccffd0ca198ed

0 commit comments

Comments
 (0)