Skip to content

Commit 11cb1e5

Browse files
Fix mount path used by codeinsights-db initContainer (#138)
* Fix mount path used by codeinsights-db initContainer * Correct container security context * Quick fix for permissions * Add changelog
1 parent d143681 commit 11cb1e5

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

charts/sourcegraph/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Use `**BREAKING**:` to denote a breaking change
55
# Changelog
66

77
<!-- START CHANGELOG -->
8+
- Fixed mountPath and permissions used by codeinsights-db initContainer [#138](https://github.com/sourcegraph/deploy-sourcegraph-helm/pull/138)
89

910
## 3.40.2-rev.1
1011

charts/sourcegraph/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ In addition to the documented values, all services also support the following va
5151
| codeInsightsDB.existingConfig | string | `""` | Name of existing ConfigMap for `codeinsights-db`. It must contain a `postgresql.conf` key. |
5252
| codeInsightsDB.image.defaultTag | string | `"3.40.1@sha256:36475b0d2b3ccc5d4c5eab6c5c0c6e5dc0b41f8775fc5174c754645b73e78d62"` | Docker image tag for the `codeinsights-db` image |
5353
| codeInsightsDB.image.name | string | `"codeinsights-db"` | Docker image name for the `codeinsights-db` image |
54+
| codeInsightsDB.init.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":70,"runAsUser":70}` | Security context for the `alpine` initContainer, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
5455
| codeInsightsDB.name | string | `"codeinsights-db"` | Name used by resources. Does not affect service names or PVCs. |
5556
| codeInsightsDB.podSecurityContext | object | `{"fsGroup":70,"fsGroupChangePolicy":"OnRootMismatch","runAsUser":70}` | Security context for the `codeinsights-db` pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) |
5657
| codeInsightsDB.postgresExporter | object | `{}` | Configuration for the `pgsql-exporter` sidecar container |

charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ spec:
4949
imagePullPolicy: {{ .Values.sourcegraph.image.pullPolicy }}
5050
command: ["sh", "-c", "if [ -d /var/lib/postgresql/data/pgdata ]; then chmod 750 /var/lib/postgresql/data/pgdata; fi"]
5151
volumeMounts:
52-
- mountPath: /data
52+
- mountPath: /var/lib/postgresql/data/
5353
name: disk
5454
securityContext:
55-
{{- toYaml .Values.alpine.containerSecurityContext | nindent 10 }}
55+
{{- toYaml .Values.codeInsightsDB.init.containerSecurityContext | nindent 10 }}
5656
{{- if not .Values.sourcegraph.localDevMode }}
5757
resources:
5858
{{- toYaml .Values.alpine.resources | nindent 10 }}

charts/sourcegraph/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@ codeInsightsDB:
185185
runAsUser: 70
186186
runAsGroup: 70
187187
readOnlyRootFilesystem: true
188+
init:
189+
# -- Security context for the `alpine` initContainer,
190+
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container)
191+
containerSecurityContext:
192+
allowPrivilegeEscalation: false
193+
runAsUser: 70
194+
runAsGroup: 70
195+
readOnlyRootFilesystem: true
188196
# -- Configuration for the `pgsql-exporter` sidecar container
189197
postgresExporter: {}
190198
# -- Name used by resources. Does not affect service names or PVCs.

0 commit comments

Comments
 (0)