Skip to content

Conversation

@0xf1e
Copy link

@0xf1e 0xf1e commented Feb 11, 2025

Currently, the first initContainer of the matrix-synapse deployment postgresql-isready tries to respect a potential databaseHostname environment variable, if .Values.postgresql.global.postgresql.auth.existingSecret is set. However, this had lead to a bit of a goose chase on my side, as trying to use existingSecret will produce the following error when trying to perform an ArgoCD sync:

Failed to compare desired state to live state: failed to calculate diff: error calculating server side diff: serverSideDiff error: error running server side apply in dryrun mode for resource Deployment/matrix-synapse-synapse: Deployment.apps "matrix-synapse-synapse" is invalid: spec.template.spec.initContainers[0].env[1].valueFrom: Invalid value: "": may not be specified when `value` is not empty

I found this issue really hard to debug, as running my Values-file from helm actually does not result in this issue. However, when playing around with a fork of this repo, I realized that the second initContainer add-secret-vlaues-to-config does not respect the databaseHostbase in the existingSecret, meaning that if someone where to make the first initContainer working with a custom databaseHostname, they would then realize that the second initContainer will always ignore their custom hostname anyways.

Therefore, I propose the "lazy fix" to also ignore a potential custom hostname in the first initContainer. This way, potential issues for users who just want to set a custom postgres password in existingSecret will be avoided. And it won't be a breaking change, as nobody could be using custom hostnames to begin with.

@@ -1,2 +1,3 @@
.idea/
.DS_Store
.aider*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.aider*
.aider*

🤔 what's this?

Comment on lines 66 to -74
- name: DATABASE_HOSTNAME
{{- if not .Values.postgresql.global.postgresql.auth.existingSecret }}
value: {{ template "postgresql.v1.primary.fullname" .Subcharts.postgresql }}
{{ else }}
valueFrom:
secretKeyRef:
name: {{ include "matrix.postgresql.secretName" . }}
key: {{ .Values.postgresql.global.postgresql.auth.secretKeys.databaseHostname }}
{{- end }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this break people using an external database though?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants