You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jeff-cook (via GitHub)" <gi...@apache.org> on 2025/10/16 22:36:59 UTC
[D] How to set connection string [airflow]
GitHub user jeff-cook created a discussion: How to set connection string
I have an existing secret in the airflow namespace with
- endpoint
- password
- port
- username
When I do the following the
```yaml
extraEnv: |
- name: rds_username
valueFrom:
secretKeyRef:
name: airflow-v3-base-rds-access
key: username
- name: rds_password
valueFrom:
secretKeyRef:
name: airflow-v3-base-rds-access
key: password
- name: rds_address
valueFrom:
secretKeyRef:
name: airflow-v3-base-rds-access
key: endpoint
- name: rds_port
valueFrom:
secretKeyRef:
name: airflow-v3-base-rds-access
key: port
- name: connection
value: "postgresql://${rds_username}:${rds_password@$(rds_endpoint):${rds_port}/airflow?sslmode=disable"
```
I get
```
env | grep conn
connection=postgresql://${rds_username}:${rds_password@$(rds_endpoint):${rds_port}/airflow?sslmode=disable
```
How can I get airflow to use the existing secret values?
GitHub link: https://github.com/apache/airflow/discussions/56747
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] How to set connection string [airflow]
Posted by "jeff-cook (via GitHub)" <gi...@apache.org>.
GitHub user jeff-cook added a comment to the discussion: How to set connection string
The answer was to
- use the `_CMD` variables
- Set the non `_CMD` vars to false under `enableBuiltInSecretEnvVars`
- Use `extraConfigMaps` to add the script
- `volumes` and `volumeMounts` to add the script/configmap to the pods
- Add `extraEnvFrom` to load the whole existing secret to the env
GitHub link: https://github.com/apache/airflow/discussions/56747#discussioncomment-14820884
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] How to set connection string [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
GitHub user potiuk added a comment to the discussion: How to set connection string
Just make sure your _CMD script does not produce value with \n (use echo -n). Common issue when you are dealing with this .
GitHub link: https://github.com/apache/airflow/discussions/56747#discussioncomment-14705025
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] How to set connection string [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
GitHub user potiuk added a comment to the discussion: How to set connection string
You could likely use the _CMD version of the connection variable - it should point to a bash script that would combine the variables.
GitHub link: https://github.com/apache/airflow/discussions/56747#discussioncomment-14705023
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] How to set connection string [airflow]
Posted by "jeff-cook (via GitHub)" <gi...@apache.org>.
GitHub user jeff-cook added a comment to the discussion: How to set connection string
In our bitnami based airflow we were able to use the following env vars. But that looks to only be supported by bitnami
- AIRFLOW_DATABASE_HOST
- AIRFLOW_DATABASE_USERNAME
- AIRFLOW_DATABASE_PASWORD
- AIRFLOW_DATABASE_PORT
GitHub link: https://github.com/apache/airflow/discussions/56747#discussioncomment-14703783
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org