From ea9378c695dd45dd0ee6ddbad0c8582d7293fdf3 Mon Sep 17 00:00:00 2001 From: Mitchell Nielsen Date: Tue, 23 Jul 2024 14:12:00 -0500 Subject: [PATCH] Create PostgreSQL Secret even if postgresql.enabled=false Ensures that the PostgreSQL Secret is created, even if `postgresql.enabled=false`. This ensures that we support a use case where folks want to use an external instance of PostgreSQL, but still want the Secret to automatically be generated with the proper connection string. With a recent change, we would skip creation of this secret if PostgreSQL was disabled which forced users to create a Secret themselves. This change now allows them to continue providing the `auth` values and letting the chart build the Secret with the correct connection string. Closes https://github.com/PrefectHQ/prefect-helm/issues/358 --- charts/prefect-server/README.md | 8 +++++++- charts/prefect-server/README.md.gotmpl | 8 +++++++- charts/prefect-server/templates/secret.yaml | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/charts/prefect-server/README.md b/charts/prefect-server/README.md index adeadfd6..08cd5982 100644 --- a/charts/prefect-server/README.md +++ b/charts/prefect-server/README.md @@ -45,9 +45,15 @@ prefect-server: postgresql: # Disable the objects from the bundled PostgreSQL chart enabled: false + auth: - # Provide the name of an existing secret following the instructions above. + # Option 1: provide the name of an existing secret following the instructions above. existingSecret: + + # Option 2: provide the connection string details directly + username: myuser + password: mypass + database: mydb ``` Two secrets are created when not providing an existing secret name: diff --git a/charts/prefect-server/README.md.gotmpl b/charts/prefect-server/README.md.gotmpl index d8594b57..34e835de 100644 --- a/charts/prefect-server/README.md.gotmpl +++ b/charts/prefect-server/README.md.gotmpl @@ -44,9 +44,15 @@ prefect-server: postgresql: # Disable the objects from the bundled PostgreSQL chart enabled: false + auth: - # Provide the name of an existing secret following the instructions above. + # Option 1: provide the name of an existing secret following the instructions above. existingSecret: + + # Option 2: provide the connection string details directly + username: myuser + password: mypass + database: mydb ``` Two secrets are created when not providing an existing secret name: diff --git a/charts/prefect-server/templates/secret.yaml b/charts/prefect-server/templates/secret.yaml index 462b59d8..d5ffe4f4 100644 --- a/charts/prefect-server/templates/secret.yaml +++ b/charts/prefect-server/templates/secret.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.postgresql.enabled (not .Values.postgresql.auth.existingSecret) }} +{{- if not .Values.postgresql.auth.existingSecret }} apiVersion: v1 kind: Secret metadata: