Respect postgres.passwordSecretName in presence of rr.agentSandbox.externalSecret#332
Respect postgres.passwordSecretName in presence of rr.agentSandbox.externalSecret#332ryanartecona wants to merge 2 commits into
Conversation
|
| Filename | Overview |
|---|---|
| charts/retool/Chart.yaml | Patch version bump from 6.11.0 to 6.11.1 to reflect the bugfix change. |
| charts/retool/templates/_helpers.tpl | Adds PGPASSWORD env var support to the externalSecret branch of retool.agentSandbox.postgresUrlEnv; the urlSecretName branch gets no equivalent treatment, creating an asymmetry. |
| charts/retool/values.yaml | Comment-only update documenting that the postgres-url from externalSecret can omit the embedded password and use passwordSecretName instead. |
| values.yaml | Mirrors the same comment-only update as charts/retool/values.yaml. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[retool.agentSandbox.postgresUrlEnv] --> B{pg.url set?}
B -- Yes --> C[AGENT_SANDBOX_POSTGRES_URL = plaintext url]
B -- No --> D{pg.host set?}
D -- Yes --> E{passwordSecretName?}
E -- Yes --> F[PGPASSWORD from secret]
E -- No --> G{pg.password?}
G -- Yes --> H[PGPASSWORD plaintext]
F --> I[AGENT_SANDBOX_POSTGRES_URL assembled from host/user/db]
H --> I
G -- No --> I
D -- No --> J{pg.urlSecretName set?}
J -- Yes --> K[AGENT_SANDBOX_POSTGRES_URL from secret - NO PGPASSWORD support]
J -- No --> L{externalSecret.name set?}
L -- Yes --> M[AGENT_SANDBOX_POSTGRES_URL from external secret]
M --> N{passwordSecretName? NEW}
N -- Yes --> O[PGPASSWORD from passwordSecretName secret]
N -- No --> P[no PGPASSWORD]
L -- No --> Q[Inherit backend postgres - PGPASSWORD from config.postgresql secret]
Comments Outside Diff (2)
-
charts/retool/templates/_helpers.tpl, line 701-702 (link)The docblock says "plus a PGPASSWORD entry when assembling from fields" but after this PR,
PGPASSWORDcan also be emitted in theexternalSecretpath. The phrase "when assembling from fields" now understates the scope — callers reading this comment before theexternalSecretbranch won't expectPGPASSWORDto appear there.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
charts/retool/templates/_helpers.tpl, line 738-743 (link)urlSecretNamebranch silently ignorespasswordSecretNameThe
externalSecretbranch (just below) now respectspasswordSecretName, but theurlSecretNamebranch does not. A user who stores a passwordless DSN in a Kubernetes secret viaurlSecretNameand setspasswordSecretNameto provide the password separately will get noPGPASSWORDenv var and a silent connection failure at runtime. TheurlSecretNamepath could apply the same{{- if $pg.passwordSecretName }}block that was just added to theexternalSecretpath.
Reviews (1): Last reviewed commit: "bump patch" | Re-trigger Greptile
…cretName the fromExternalSecret boolean was redundant with the existing Option-3 postgres.urlSecretName/urlSecretKey: 'read postgres-url from externalSecret.name' is identical to pointing urlSecretName at that same secret (urlSecretKey already defaults to postgres-url). drop the bespoke flag and the externalSecret postgres branch entirely, so externalSecret.name covers ONLY the JWT/encryption keys and never sources postgres. - remove rr.agentSandbox.postgres.fromExternalSecret (both values.yaml copies) - postgresUrlEnv: delete the externalSecret postgres branch; move the passwordSecretName PGPASSWORD support (#332) into the urlSecretName branch, so 'DSN from a secret + auto-rotated password from another secret' uses Option 3 - validateSecrets: drop the externalSecret term from $explicitPg; repoint both fail hints to postgres.urlSecretName - ci: test-agent-sandbox-enabled-option uses postgres.urlSecretName (Option 3) pointed at its JWT secret instead of the removed flag
…cretName the fromExternalSecret boolean was redundant with the existing Option-3 postgres.urlSecretName/urlSecretKey: 'read postgres-url from externalSecret.name' is identical to pointing urlSecretName at that same secret (urlSecretKey already defaults to postgres-url). drop the bespoke flag and the externalSecret postgres branch entirely, so externalSecret.name covers ONLY the JWT/encryption keys and never sources postgres. - remove rr.agentSandbox.postgres.fromExternalSecret (both values.yaml copies) - postgresUrlEnv: delete the externalSecret postgres branch; move the passwordSecretName PGPASSWORD support (#332) into the urlSecretName branch, so 'DSN from a secret + auto-rotated password from another secret' uses Option 3 - validateSecrets: drop the externalSecret term from $explicitPg; repoint both fail hints to postgres.urlSecretName - ci: test-agent-sandbox-enabled-option uses postgres.urlSecretName (Option 3) pointed at its JWT secret instead of the removed flag
In blueprints, we want the agentSandbox secrets to come from different places: jwt-public-key, jwt-private-key, and postgres-url from an agent-sandbox secret, but specifically the postgres password from the main retool secret, as that is the only one that gets auto rotated by e.g. RDS.
This allows agentSandbox.externalSecret to also be used with agentSandbox.postgres.passwordSecretName when both are present.