Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make container securityContext optional for OpenShift compatibility #445

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion charts/cloudnative-pg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ CloudNativePG Operator Helm Chart
| config.data | object | `{}` | The content of the configmap/secret, see https://cloudnative-pg.io/documentation/current/operator_conf/#available-options for all the available options. |
| config.name | string | `"cnpg-controller-manager-config"` | The name of the configmap/secret to use. |
| config.secret | bool | `false` | Specifies whether it should be stored in a secret, instead of a configmap. |
| containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true,"runAsGroup":10001,"runAsUser":10001,"seccompProfile":{"type":"RuntimeDefault"}}` | Container Security Context. |
| containerSecurityContext | object | See below | Container Security Context. |
| containerSecurityContext.enableSecurityContext | bool | `true` | Determines whether the container-level securityContext is included in the Deployment. Set to `false` to disable the container securityContext (useful for OpenShift). |
| containerSecurityContext.allowPrivilegeEscalation | bool | `false` | Controls whether a process can gain more privileges than its parent process. |
| containerSecurityContext.readOnlyRootFilesystem | bool | `true` | Whether the container has a read-only root filesystem. |
| containerSecurityContext.runAsUser | int | `10001` | The user ID to run the container process. |
| containerSecurityContext.runAsGroup | int | `10001` | The group ID for the container process. |
| containerSecurityContext.seccompProfile | object | `{"type":"RuntimeDefault"}` | Seccomp profile for the container. |
| containerSecurityContext.capabilities | object | `{"drop":["ALL"]}` | Linux capabilities to be dropped from the container. |
| crds.create | bool | `true` | Specifies whether the CRDs should be created when installing the chart. |
| dnsPolicy | string | `""` | |
| fullnameOverride | string | `""` | |
Expand Down
5 changes: 4 additions & 1 deletion charts/cloudnative-pg/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 10 }}
{{- if .Values.containerSecurityContext.enableSecurityContext }}
{{- $containerSecurityContext := omit .Values.containerSecurityContext "enableSecurityContext" }}
securityContext:
{{- toYaml .Values.containerSecurityContext | nindent 10 }}
{{- toYaml $containerSecurityContext | nindent 10 }}
{{- end }}
volumeMounts:
- mountPath: /controller
name: scratch-data
Expand Down
1 change: 1 addition & 0 deletions charts/cloudnative-pg/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ podLabels: {}

# -- Container Security Context.
containerSecurityContext:
enableSecurityContext: true
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsUser: 10001
Expand Down