Skip to content

Commit bbc52d1

Browse files
fix: add references to sslmode for postgres dbs (#617)
[REL-638](https://linear.app/sourcegraph/issue/REL-638/configure-aws-rds-databases-for-tls-connections-in-helm-chart) raised issues that this flag did not get mentioned in the docs where a customer wanted to use TLS. It also outlined the recommended fixes that this commit implements. This PR has an accompanying [docs PR](sourcegraph/docs#900) ### Checklist - [x] Follow the [manual testing process](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/TEST.md) - [ ] Update [changelog](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/charts/sourcegraph/CHANGELOG.md) - [ ] Update [Kubernetes update doc](https://docs.sourcegraph.com/admin/updates/kubernetes) ### Test plan Manually test this out? Would require spinning up an RDS instance or something, but that's fine. I'm in the process of doing so now. <!-- As part of SOC2/GN-104 and SOC2/GN-105 requirements, all pull requests are REQUIRED to provide a "test plan". A test plan is a loose explanation of what you have done or implemented to test this, as outlined in our Testing principles and guidelines: https://docs.sourcegraph.com/dev/background-information/testing_principles Write your test plan here after the "Test plan" header. -->
1 parent e215bde commit bbc52d1

File tree

10 files changed

+31
-8
lines changed

10 files changed

+31
-8
lines changed

charts/sourcegraph-migrator/templates/_helpers.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,9 @@ useGlobalTagAsDefault configuration
9191
secretKeyRef:
9292
key: user
9393
name: {{ $secretName }}
94+
- name: {{ printf "%sSSLMODE" $prefix }}
95+
valueFrom:
96+
secretKeyRef:
97+
key: sslmode
98+
name: {{ $secretName }}
9499
{{- end }}

charts/sourcegraph/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ In addition to the documented values, all services also support the following va
5656
| codeInsightsDB.auth.host | string | `"codeinsights-db"` | Sets codeinsights-db host |
5757
| codeInsightsDB.auth.password | string | `"password"` | Sets codeinsights-db password |
5858
| codeInsightsDB.auth.port | string | `"5432"` | Sets codeinsights-db port |
59+
| codeInsightsDB.auth.sslmode | string | `"disable"` | Sets codeinsights-db SSL mode |
5960
| codeInsightsDB.auth.user | string | `"postgres"` | Sets codeinsights-db username |
6061
| codeInsightsDB.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":70,"runAsUser":70}` | Security context for the `codeinsights-db` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
6162
| codeInsightsDB.enabled | bool | `true` | Enable `codeinsights-db` PostgreSQL server |
@@ -77,6 +78,7 @@ In addition to the documented values, all services also support the following va
7778
| codeIntelDB.auth.host | string | `"codeintel-db"` | Sets codeintel-db host |
7879
| codeIntelDB.auth.password | string | `"password"` | Sets codeintel-db password |
7980
| codeIntelDB.auth.port | string | `"5432"` | Sets codeintel-db port |
81+
| codeIntelDB.auth.sslmode | string | `"disable"` | Sets codeintel-db SSL mode |
8082
| codeIntelDB.auth.user | string | `"sg"` | Sets codeintel-db username |
8183
| codeIntelDB.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":999,"runAsUser":999}` | Security context for the `codeintel-db` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
8284
| codeIntelDB.enabled | bool | `true` | Enable `codeintel-db` PostgreSQL server |
@@ -219,6 +221,7 @@ In addition to the documented values, all services also support the following va
219221
| pgsql.auth.host | string | `"pgsql"` | Sets postgres host |
220222
| pgsql.auth.password | string | `"password"` | Sets postgres password |
221223
| pgsql.auth.port | string | `"5432"` | Sets postgres port |
224+
| pgsql.auth.sslmode | string | `"disable"` | Sets postgres SSL mode |
222225
| pgsql.auth.user | string | `"sg"` | Sets postgres username |
223226
| pgsql.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":999,"runAsUser":999}` | Security context for the `pgsql` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
224227
| pgsql.enabled | bool | `true` | Enable `pgsql` PostgreSQL server |

charts/sourcegraph/examples/external-databases/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ data:
3030
password: ""
3131
port: ""
3232
user: ""
33+
pgsslmode: "require" # optional, enable if using SSL
3334
```
3435
3536
The Secret name should be set in your override file in the `auth.existingSecret` key for each database. See the [override.yaml] for an example.

charts/sourcegraph/templates/_helpers.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ app.kubernetes.io/name: jaeger
211211
secretKeyRef:
212212
key: user
213213
name: {{ $secretName }}
214+
- name: {{ printf "%sSSLMODE" $prefix }}
215+
valueFrom:
216+
secretKeyRef:
217+
key: sslmode
218+
name: {{ $secretName }}
214219
{{- if eq $service "grafana" }}
215220
- name: {{ printf "%sSSLMODE" $prefix }}
216221
valueFrom:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ data:
1414
password: {{ .Values.codeInsightsDB.auth.password | toString | b64enc | quote }}
1515
port: {{ .Values.codeInsightsDB.auth.port | toString | b64enc | quote }}
1616
user: {{ .Values.codeInsightsDB.auth.user | toString | b64enc | quote }}
17+
sslmode: {{ .Values.codeInsightsDB.auth.sslmode | toString | b64enc | quote }}
1718
{{- end -}}

charts/sourcegraph/templates/codeintel-db/codeintel-db.Secret.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ data:
1414
password: {{ .Values.codeIntelDB.auth.password | toString | b64enc | quote }}
1515
port: {{ .Values.codeIntelDB.auth.port | toString | b64enc | quote }}
1616
user: {{ .Values.codeIntelDB.auth.user | toString | b64enc | quote }}
17+
sslmode: {{ .Values.codeIntelDB.auth.sslmode | toString | b64enc | quote }}
1718
{{- end -}}

charts/sourcegraph/templates/pgsql/pgsql.Secret.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ data:
1414
password: {{ .Values.pgsql.auth.password | toString | b64enc | quote }}
1515
port: {{ .Values.pgsql.auth.port | toString | b64enc | quote }}
1616
user: {{ .Values.pgsql.auth.user | toString | b64enc | quote }}
17+
sslmode: {{ .Values.pgsql.auth.sslmode | toString | b64enc | quote }}
1718
{{- end -}}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
should update checksum when codeinsights-db secret is modified:
22
1: |
3-
b60668796ecf6c0c43c250feeb4f61583494b50c518d145753612c0f3e10d2d1
3+
29f56ffb20b2f033b6f54a3b8e4f049734a9330390bc4e4b162a792e073b9447
44
should update checksum when codeintel-db secret is modified:
55
1: |
6-
393b4697f158c0151c67f84d2caf81894565f9928a68fe4cea86de62c2784c3c
6+
839b4e7703dfa58ea8513e436a017af6183d7e5c3d8560a8d580bef8299242fb
77
should update checksum when pgsql secret is modified:
88
1: |
9-
9edce55c26da40c6a2f12025db322495f2f2a50183f234d7476d486134434aa2
9+
54b0ee5944d429d618699fa4e18a406fb817668d9111bb43b46eac363415e5b2
1010
should update checksum when redis-cache secret is modified:
1111
1: |
12-
cffe7781e068ed7f9b5cff231361a3973a2a3378a28cf047a9a5ad77c832732c
12+
97d7112d6b8b0d3e6251d9062aaba1a7205fda567b701d70eecc4540878228c0
1313
should update checksum when redis-store secret is modified:
1414
1: |
15-
cffe7781e068ed7f9b5cff231361a3973a2a3378a28cf047a9a5ad77c832732c
15+
97d7112d6b8b0d3e6251d9062aaba1a7205fda567b701d70eecc4540878228c0
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
should reference default secret name when existingSecret is blank:
22
1: |
3-
180940fdb956526d197a8efaf15bc2f14a3db83e09610917f8b9040fa5232d39
3+
0fa09c505c8e425627c62e0bb13c3ecb575b6c117a2b976fd1a4e71dd41561f6
44
should reference existing secret name when existingSecret is passed:
55
1: |
6-
e5de6930e808d2ef402f404c12b53ff96e57ac6818a72ed19ab0aa4caf588596
6+
75d732cb063b4c32166d42a620df3c0b2b9fa139f28a560c9c566d36b150e6c3

charts/sourcegraph/values.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ codeInsightsDB:
164164
password: "password"
165165
# -- Sets codeinsights-db port
166166
port: "5432"
167+
# -- Sets codeinsights-db SSL mode
168+
sslmode: "disable" # set to "require" to enable SSL
167169
# -- Environment variables for the `codeinsights-db` container
168170
env: {}
169171
# -- Name of existing ConfigMap for `codeinsights-db`. It must contain a `postgresql.conf` key.
@@ -237,6 +239,8 @@ codeIntelDB:
237239
password: "password"
238240
# -- Sets codeintel-db port
239241
port: "5432"
242+
# -- Sets codeintel-db SSL mode
243+
sslmode: "disable" # set to "require" to enable SSL
240244
# -- Name of existing ConfigMap for `codeintel-db`. It must contain a `postgresql.conf` key
241245
existingConfig: ""
242246
# -- Additional PostgreSQL configuration. This will override or extend our default configuration.
@@ -721,8 +725,10 @@ pgsql:
721725
password: "password"
722726
# -- Sets postgres port
723727
port: "5432"
728+
# -- Sets postgres SSL mode
729+
sslmode: "disable" # set to "require" to enable SSL
724730
# -- Name of existing ConfigMap for `pgsql`. It must contain a `postgresql.conf` key
725-
existingConfig: "" # Name of an existing configmap
731+
existingConfig: "" # Name of an existing configmap
726732
# -- Additional PostgreSQL configuration. This will override or extend our default configuration.
727733
# Notes: This is expecting a multiline string.
728734
# Learn more from our [recommended PostgreSQL configuration](https://docs.sourcegraph.com/admin/config/postgres-conf) and [PostgreSQL documentation](https://www.postgresql.org/docs/12/config-setting.html)

0 commit comments

Comments
 (0)