[#11696] improvement(helm): Make init-postgresql secret name configurable via postgresql.existingSecretName#11697
Conversation
…nfigurable via postgresql.existingSecretName
danhuawang
left a comment
There was a problem hiding this comment.
Thanks for the PR! I see the motivation — making the init container work with external PostgreSQL providers (CloudNativePG, CrunchyData, AWS RDS) is a legitimate need. However, there's a structural issue that makes this change ineffective in that scenario.
The init-postgresql init container is gated on {{ if .Values.postgresql.enabled }} (deployment.yaml L128). This means:
postgresql.enabled=true→ The Bitnami subchart is deployed, it creates the secret{{ .Release.Name }}-postgresqlautomatically, and the hardcoded name already works. The override has no use here.postgresql.enabled=false→ The init container is not rendered at all, so the newexistingSecretNamefield is never evaluated — this is precisely the scenario where an external PostgreSQL provider would be in play.
In other words, the override can never fire in the use case it's designed for.
To properly support external PostgreSQL providers, the init container's condition would need to be decoupled from postgresql.enabled — for example, rendering it whenever the Gravitino entity store targets PostgreSQL, regardless of whether the Bitnami subchart is active. That's a broader change (likely involving an externalPostgresql config section, similar to how many Bitnami-based charts handle this pattern).
I'd suggest either:
- Expanding the scope to decouple the init container guard (e.g.
{{- if or .Values.postgresql.enabled .Values.externalPostgresql.enabled }}), with a corresponding external-postgres values section that holds the secret name/key; or - Closing this in favor of a design discussion on the linked issue about how external PostgreSQL should be supported end-to-end in the chart.
Code Coverage Report
Files
|
What changes were proposed in this pull request?
Make the Kubernetes secret name used by the
init-postgresqlinit container configurable via a newpostgresql.auth.existingSecretNamevalues field, falling back to the Bitnami default{{ .Release.Name }}-postgresqlwhen not set.Why are the changes needed?
The Helm chart's
init-postgresqlinit container hardcodes the secret name as{{ .Release.Name }}-postgresql, which assumes the Bitnami PostgreSQL subchart is always used. This breaks compatibility with external PostgreSQL providers (CloudNativePG, CrunchyData, AWS RDS) where the secret name is user-defined.Fix: #11696
Does this PR introduce any user-facing change?
Yes, adds
postgresql.auth.existingSecretName(default:"") tovalues.yaml.How was this patch tested?
gravitino-postgresqlexistingSecretName=gravitino-cnpg-secretproduces that name