[bitnami/flux] feat: 🔒 Add automatic adaptation for Openshift restricted-v2 SCC (#24084)

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>
This commit is contained in:
Javier J. Salmerón-García
2024-03-05 16:07:57 +01:00
committed by GitHub
parent 1b1bd9fbcb
commit 8d96934cc8
10 changed files with 33 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.16.1
digest: sha256:f808a6fdc9c374d158ad7ff2f2c53a6c409e41da778d768b232dd20f86ef8b47
generated: "2024-02-21T14:36:17.997342206Z"
version: 2.18.0
digest: sha256:f489ae7394a4eceb24fb702901483c67a5b4fff605f19d5e2545e3a6778e1280
generated: "2024-03-05T13:52:25.634017515+01:00"

View File

@@ -43,4 +43,4 @@ maintainers:
name: flux
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/flux
version: 1.8.2
version: 1.9.0

View File

@@ -55,11 +55,12 @@ The command removes all the Kubernetes components associated with the chart and
### Global parameters
| Name | Description | Value |
| ------------------------- | ----------------------------------------------- | ----- |
| `global.imageRegistry` | Global Docker image registry | `""` |
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` |
| `global.storageClass` | Global StorageClass for Persistent Volume(s) | `""` |
| Name | Description | Value |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `global.imageRegistry` | Global Docker image registry | `""` |
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` |
| `global.storageClass` | Global StorageClass for Persistent Volume(s) | `""` |
| `global.compatibility.openshift.adaptSecurityContext` | Adapt the securityContext sections of the deployment to make them compatible with Openshift restricted-v2 SCC: remove runAsUser, runAsGroup and fsGroup and let the platform use their allowed default IDs. Possible values: auto (apply if the detected running cluster is Openshift), force (perform the adaptation always), disabled (do not perform adaptation) | `disabled` |
### Common parameters

View File

@@ -66,7 +66,7 @@ spec:
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.helmController.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.helmController.podSecurityContext.enabled }}
securityContext: {{- omit .Values.helmController.podSecurityContext "enabled" | toYaml | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.helmController.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.helmController.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.helmController.terminationGracePeriodSeconds }}
@@ -80,7 +80,7 @@ spec:
image: {{ template "flux.helm-controller.image" . }}
imagePullPolicy: {{ .Values.helmController.image.pullPolicy }}
{{- if .Values.helmController.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.helmController.containerSecurityContext "enabled" | toYaml | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.helmController.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}

View File

@@ -66,7 +66,7 @@ spec:
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.imageAutomationController.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.imageAutomationController.podSecurityContext.enabled }}
securityContext: {{- omit .Values.imageAutomationController.podSecurityContext "enabled" | toYaml | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.imageAutomationController.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.imageAutomationController.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.imageAutomationController.terminationGracePeriodSeconds }}
@@ -80,7 +80,7 @@ spec:
image: {{ template "flux.image-automation-controller.image" . }}
imagePullPolicy: {{ .Values.imageAutomationController.image.pullPolicy }}
{{- if .Values.imageAutomationController.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.imageAutomationController.containerSecurityContext "enabled" | toYaml | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.imageAutomationController.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}

View File

@@ -66,7 +66,7 @@ spec:
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.imageReflectorController.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.imageReflectorController.podSecurityContext.enabled }}
securityContext: {{- omit .Values.imageReflectorController.podSecurityContext "enabled" | toYaml | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.imageReflectorController.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.imageReflectorController.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.imageReflectorController.terminationGracePeriodSeconds }}
@@ -85,7 +85,7 @@ spec:
mkdir -p {{ .Values.imageReflectorController.persistence.mountPath }}
find {{ .Values.imageReflectorController.persistence.mountPath }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs -r chown -R {{ .Values.imageReflectorController.containerSecurityContext.runAsUser }}:{{ .Values.imageReflectorController.podSecurityContext.fsGroup }}
{{- if .Values.volumePermissions.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.volumePermissions.containerSecurityContext "enabled" | toYaml | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.volumePermissions.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
@@ -105,7 +105,7 @@ spec:
image: {{ template "flux.image-reflector-controller.image" . }}
imagePullPolicy: {{ .Values.imageReflectorController.image.pullPolicy }}
{{- if .Values.imageReflectorController.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.imageReflectorController.containerSecurityContext "enabled" | toYaml | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.imageReflectorController.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}

View File

@@ -66,7 +66,7 @@ spec:
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.kustomizeController.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.kustomizeController.podSecurityContext.enabled }}
securityContext: {{- omit .Values.kustomizeController.podSecurityContext "enabled" | toYaml | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.kustomizeController.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.kustomizeController.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.kustomizeController.terminationGracePeriodSeconds }}
@@ -80,7 +80,7 @@ spec:
image: {{ template "flux.kustomize-controller.image" . }}
imagePullPolicy: {{ .Values.kustomizeController.image.pullPolicy }}
{{- if .Values.kustomizeController.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.kustomizeController.containerSecurityContext "enabled" | toYaml | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.kustomizeController.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}

View File

@@ -66,7 +66,7 @@ spec:
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.notificationController.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.notificationController.podSecurityContext.enabled }}
securityContext: {{- omit .Values.notificationController.podSecurityContext "enabled" | toYaml | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.notificationController.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.notificationController.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.notificationController.terminationGracePeriodSeconds }}
@@ -80,7 +80,7 @@ spec:
image: {{ template "flux.notification-controller.image" . }}
imagePullPolicy: {{ .Values.notificationController.image.pullPolicy }}
{{- if .Values.notificationController.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.notificationController.containerSecurityContext "enabled" | toYaml | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.notificationController.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}

View File

@@ -66,7 +66,7 @@ spec:
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.sourceController.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.sourceController.podSecurityContext.enabled }}
securityContext: {{- omit .Values.sourceController.podSecurityContext "enabled" | toYaml | nindent 8 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.sourceController.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.sourceController.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.sourceController.terminationGracePeriodSeconds }}
@@ -85,7 +85,7 @@ spec:
mkdir -p {{ .Values.sourceController.persistence.mountPath }}
find {{ .Values.sourceController.persistence.mountPath }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs -r chown -R {{ .Values.sourceController.containerSecurityContext.runAsUser }}:{{ .Values.sourceController.podSecurityContext.fsGroup }}
{{- if .Values.volumePermissions.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.volumePermissions.containerSecurityContext "enabled" | toYaml | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.volumePermissions.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
@@ -105,7 +105,7 @@ spec:
image: {{ template "flux.source-controller.image" . }}
imagePullPolicy: {{ .Values.sourceController.image.pullPolicy }}
{{- if .Values.sourceController.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.sourceController.containerSecurityContext "enabled" | toYaml | nindent 12 }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.sourceController.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}

View File

@@ -19,6 +19,15 @@ global:
##
imagePullSecrets: []
storageClass: ""
## Compatibility adaptations for Kubernetes platforms
##
compatibility:
## Compatibility adaptations for Openshift
##
openshift:
## @param global.compatibility.openshift.adaptSecurityContext Adapt the securityContext sections of the deployment to make them compatible with Openshift restricted-v2 SCC: remove runAsUser, runAsGroup and fsGroup and let the platform use their allowed default IDs. Possible values: auto (apply if the detected running cluster is Openshift), force (perform the adaptation always), disabled (do not perform adaptation)
##
adaptSecurityContext: disabled
## @section Common parameters
##