Skip to content
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
42 changes: 42 additions & 0 deletions charts/self-host/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,48 @@ component:

You can override the image repository for any component.

#### Extra Volumes

Every long-running service under `component.<name>` accepts `extraVolumeMounts` (added to the container) and `extraVolumes` (added to the pod). The pre-/post-install hook and job pods share a single `jobs.extraVolumeMounts` / `jobs.extraVolumes` pair, and the database (MSSQL) pod uses `database.extraVolumeMounts` / `database.extraVolumes`. All default to `[]`, so leaving them unset changes nothing.

This is useful for hardened deployments that set `readOnlyRootFilesystem: true`, where containers need writable scratch space (typically `/tmp`) mounted as an `emptyDir`. Supply the volume where it is needed instead of patching the chart:

```yaml
# Writable /tmp for the hardened app containers
component:
api:
securityContext:
readOnlyRootFilesystem: true
extraVolumeMounts:
- name: tmp
mountPath: /tmp
extraVolumes:
- name: tmp
emptyDir: {}

# Writable /tmp for every pre-/post-install hook and job pod
jobs:
securityContext:
readOnlyRootFilesystem: true
extraVolumeMounts:
- name: tmp
mountPath: /tmp
extraVolumes:
- name: tmp
emptyDir: {}

# Writable scratch for the MSSQL pod
database:
extraVolumeMounts:
- name: mssql-secrets
mountPath: /var/opt/mssql/secrets
extraVolumes:
- name: mssql-secrets
emptyDir: {}
```

`extraVolumes` accepts any Kubernetes volume source (`emptyDir`, `configMap`, `secret`, `persistentVolumeClaim`, `csi`, etc.), and each `extraVolumeMounts` entry must reference a volume `name` defined in the corresponding `extraVolumes` list.

#### Raw Manifests Files

This chart allows you to include other Kubernetes manifest files either pre- or post-install. To do this, update the `rawManifests` section of the chart
Expand Down
6 changes: 6 additions & 0 deletions charts/self-host/templates/mssql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ spec:
mountPath: "/mnt/secrets-store"
readOnly: true
{{- end }}
{{- with .Values.database.extraVolumeMounts }}
{{ toYaml . | indent 12 }}
{{- end }}
livenessProbe:
tcpSocket:
port: mssql
Expand Down Expand Up @@ -148,6 +151,9 @@ spec:
volumeAttributes:
secretProviderClass: {{ .Values.secrets.secretProviderClass }}
{{- end }}
{{- with .Values.database.extraVolumes }}
{{ toYaml . | indent 8 }}
{{- end }}

---
kind: Service
Expand Down
8 changes: 8 additions & 0 deletions charts/self-host/templates/post-delete-hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,13 @@ spec:
resources:
{{- toYaml .Values.jobs.cleanup.resources | nindent 10 }}
{{- end }}
{{- with .Values.jobs.extraVolumeMounts }}
volumeMounts:
{{ toYaml . | indent 8 }}
{{- end }}
restartPolicy: Never
{{- with .Values.jobs.extraVolumes }}
volumes:
{{ toYaml . | indent 6 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ spec:
- name: mssql-data
mountPath: /db
{{- end }}
{{- with .Values.jobs.extraVolumeMounts }}
{{ toYaml . | indent 10 }}
{{- end }}
containers:
- name: migrate-db
env:
Expand Down Expand Up @@ -129,6 +132,9 @@ spec:
mountPath: "/mnt/secrets-store"
readOnly: true
{{- end }}
{{- with .Values.jobs.extraVolumeMounts }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- if or ( not .Values.database.enabled ) ( and .Values.database.enabled .Release.IsUpgrade ) }}
args: [ "-f", "DbScripts_transition", "-r"]
{{- end }}
Expand All @@ -149,4 +155,7 @@ spec:
volumeAttributes:
secretProviderClass: {{ .Values.secrets.secretProviderClass }}
{{- end }}
{{- with .Values.jobs.extraVolumes }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/self-host/templates/pre-install-db-migrator-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ spec:
mountPath: "/mnt/secrets-store"
readOnly: true
{{- end }}
{{- with .Values.jobs.extraVolumeMounts }}
{{ toYaml . | indent 8 }}
{{- end }}
restartPolicy: Never
volumes:
- name: migrator-extract-dir
Expand All @@ -106,4 +109,7 @@ spec:
volumeAttributes:
secretProviderClass: {{ .Values.secrets.secretProviderClass }}
{{- end }}
{{- with .Values.jobs.extraVolumes }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/self-host/templates/pre-install-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ spec:
volumeMounts:
- name: temp
mountPath: "/bitwarden"
{{- with .Values.jobs.extraVolumeMounts }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}
containers:
- name: create-resources
Expand Down Expand Up @@ -117,9 +120,15 @@ spec:
volumeMounts:
- name: temp
mountPath: "/bitwarden"
{{- with .Values.jobs.extraVolumeMounts }}
{{ toYaml . | indent 8 }}
{{- end }}
restartPolicy: Never
volumes:
- name: temp
emptyDir:
medium: Memory
{{- with .Values.jobs.extraVolumes }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/self-host/templates/pre-install-secret-sql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ spec:
mountPath: "/mnt/secrets-store"
readOnly: true
{{- end }}
{{- with .Values.jobs.extraVolumeMounts }}
{{ toYaml . | indent 8 }}
{{- end }}
restartPolicy: Never
volumes:
- name: temp
Expand All @@ -106,4 +109,7 @@ spec:
volumeAttributes:
secretProviderClass: {{ .Values.secrets.secretProviderClass }}
{{- end }}
{{- with .Values.jobs.extraVolumes }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}
Loading
Loading