Skip to content

fix: postgres connection string to use db name set in values #37

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

Merged
merged 2 commits into from
May 23, 2025
Merged
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
4 changes: 2 additions & 2 deletions coder-observability/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ Create the name of the service account to use
{{/* Postgres connector string */}}
{{- define "postgres-connector-string" -}}
{{- if .Values.global.postgres.password -}}
postgresql://{{ .Values.global.postgres.username }}:{{ urlquery .Values.global.postgres.password }}@{{ .Values.global.postgres.hostname }}:{{ .Values.global.postgres.port }}/postgres?sslmode={{ .Values.global.postgres.sslmode }}
postgresql://{{ .Values.global.postgres.username }}:{{ urlquery .Values.global.postgres.password }}@{{ .Values.global.postgres.hostname }}:{{ .Values.global.postgres.port }}/{{ .Values.global.postgres.database }}?sslmode={{ .Values.global.postgres.sslmode }}
{{- else if .Values.global.postgres.mountSecret -}}
postgresql://{{ .Values.global.postgres.username }}@{{ .Values.global.postgres.hostname }}:{{ .Values.global.postgres.port }}/postgres?sslmode={{ .Values.global.postgres.sslmode }}
postgresql://{{ .Values.global.postgres.username }}@{{ .Values.global.postgres.hostname }}:{{ .Values.global.postgres.port }}/{{ .Values.global.postgres.database }}?sslmode={{ .Values.global.postgres.sslmode }}
{{- else -}}
{{ fail "either postgres.password or postgres.mountSecret must be defined" }}
{{- end -}}
Expand Down
6 changes: 3 additions & 3 deletions compiled/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ data:
global:
target:
name: postgres
data_source_name: 'postgresql://coder@localhost:5432/postgres?sslmode=disable'
data_source_name: 'postgresql://coder@localhost:5432/coder?sslmode=disable'
collectors:
- notify
collectors:
Expand Down Expand Up @@ -12215,7 +12215,7 @@ spec:
name: exporter
env:
- name: DATA_SOURCE_NAME
value: 'postgresql://coder@localhost:5432/postgres?sslmode=disable'
value: 'postgresql://coder@localhost:5432/coder?sslmode=disable'
envFrom:
- secretRef:
name: secret-postgres
Expand Down Expand Up @@ -12270,7 +12270,7 @@ spec:
metadata:
annotations:
prometheus.io/scrape: 'true'
checksum/config: e12c0044ef2cab3438ffdc8f5e16c24c5acf5ee36dcc8bee77294f27e53ce4a2
checksum/config: 71bb9e7579b6e138ae28c623aa29d72025be00387da6c1b8dd5aa168c96ca1e0
labels:
app: sql-exporter
app.kubernetes.io/name: "database-stats"
Expand Down