|
41 | 41 | securityContext: |
42 | 42 | {{- toYaml . | nindent 8 }} |
43 | 43 | {{- end }} |
| 44 | + {{- if .Values.runner.hardenedFs }} |
| 45 | + initContainers: |
| 46 | + - name: setup-venv |
| 47 | + {{- if .Values.runner.image }} |
| 48 | + image: {{ .Values.runner.image }} |
| 49 | + {{ else }} |
| 50 | + image: {{ .Values.image.registry }}/{{ .Values.runner.imageName }} |
| 51 | + {{- end }} |
| 52 | + command: |
| 53 | + - sh |
| 54 | + - -c |
| 55 | + - > |
| 56 | + SRC="/venv/lib/$(python -V | cut -d' ' -f2 | cut -d. -f1,2)/site-packages" && |
| 57 | + cp -a "${SRC}/." /venv-writable/ |
| 58 | + volumeMounts: |
| 59 | + - name: venv-lib-volume |
| 60 | + mountPath: /venv-writable |
| 61 | + {{- end }} |
44 | 62 | containers: |
45 | 63 | - name: runner |
46 | 64 | {{- if .Values.runner.image }} |
|
51 | 69 | imagePullPolicy: {{ .Values.runner.imagePullPolicy }} |
52 | 70 | {{- with .Values.runner.securityContext.container }} |
53 | 71 | securityContext: |
54 | | - {{- toYaml . | nindent 12 }} |
| 72 | + {{- if $.Values.runner.hardenedFs }} |
| 73 | + {{- $hardened := merge (dict "readOnlyRootFilesystem" true) . }} |
| 74 | + {{- toYaml $hardened | nindent 12 }} |
| 75 | + {{- else }} |
| 76 | + {{- toYaml . | nindent 12 }} |
| 77 | + {{- end }} |
55 | 78 | {{- end }} |
56 | 79 | env: |
57 | 80 | - name: PLAYBOOKS_CONFIG_FILE_PATH |
@@ -129,6 +152,16 @@ spec: |
129 | 152 | - name: persistent-playbooks-storage |
130 | 153 | mountPath: /etc/robusta/playbooks/storage |
131 | 154 | {{- end }} |
| 155 | + {{- if .Values.runner.hardenedFs }} |
| 156 | + - name: tmp-volume |
| 157 | + mountPath: /tmp |
| 158 | + - name: app-git-volume |
| 159 | + mountPath: /app/robusta-git |
| 160 | + - name: cache-volume |
| 161 | + mountPath: /root/.cache |
| 162 | + - name: venv-lib-volume |
| 163 | + mountPath: /venv/lib/python3.11/site-packages |
| 164 | + {{- end }} |
132 | 165 | {{- with .Values.runner.extraVolumeMounts }} |
133 | 166 | {{- toYaml . | nindent 10 }} |
134 | 167 | {{- end }} |
@@ -182,6 +215,16 @@ spec: |
182 | 215 | persistentVolumeClaim: |
183 | 216 | claimName: persistent-playbooks-pv-claim |
184 | 217 | {{- end }} |
| 218 | + {{- if .Values.runner.hardenedFs }} |
| 219 | + - name: tmp-volume |
| 220 | + emptyDir: {} |
| 221 | + - name: app-git-volume |
| 222 | + emptyDir: {} |
| 223 | + - name: cache-volume |
| 224 | + emptyDir: {} |
| 225 | + - name: venv-lib-volume |
| 226 | + emptyDir: {} |
| 227 | + {{- end }} |
185 | 228 | {{- with .Values.runner.extraVolumes }} |
186 | 229 | {{- toYaml . | nindent 8 }} |
187 | 230 | {{- end }} |
|
0 commit comments