Skip to content

Commit 0008a85

Browse files
committed
Some docs
1 parent e82310a commit 0008a85

3 files changed

Lines changed: 92 additions & 12 deletions

File tree

docs/modules/airflow/pages/getting_started/first_steps.adoc

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ With the external dependencies required by Airflow (Postgresql and Redis) instal
1010

1111
Supported versions for PostgreSQL and Redis can be found in the https://airflow.apache.org/docs/apache-airflow/stable/installation/prerequisites.html#prerequisites[Airflow documentation].
1212

13-
== Secret with Airflow credentials
13+
== Airflow secrets
1414

15-
Create a Secret with the necessary credentials, this entails database connection credentials as well as an admin account for Airflow itself.
15+
Secrets are required for the mandatory metadata database connection and the Airflow admin user.
16+
When using celery executors it's also required to provide information for the celery database and broker.
1617
Create a file called `airflow-credentials.yaml`:
1718

1819
[source,yaml]
@@ -23,15 +24,14 @@ And apply it:
2324
[source,bash]
2425
include::example$getting_started/code/getting_started.sh[tag=apply-airflow-credentials]
2526

26-
`connections.sqlalchemyDatabaseUri` must contain the connection string to the SQL database storing the Airflow metadata.
27+
`airflow-postgresql-credentials` contains credentials for the SQL database storing the Airflow metadata.
28+
In this example we will use the same database for both the Airflow job metadata as well as the Celery broker metadata.
2729

28-
`connections.celeryResultBackend` must contain the connection string to the SQL database storing the job metadata (the example above uses the same PostgreSQL database for both).
30+
`airflow-redis-credentials` contains credentials for the the Redis instance used for queuing the jobs submitted to the Airflow executor(s).
2931

30-
`connections.celeryBrokerUrl` must contain the connection string to the Redis instance used for queuing the jobs submitted to the airflow executor(s).
32+
`airflow-admin-credentials`: the `adminUser.*` fields are used to create the initial admin user.
3133

32-
The `adminUser` fields are used to create an admin user.
33-
34-
NOTE: The admin user is disabled if you use a non-default authentication mechanism like LDAP.
34+
NOTE: The admin user is disabled if you use a non-default authentication mechanism like LDAP or OIDC.
3535

3636
== Airflow
3737

@@ -60,21 +60,27 @@ include::example$getting_started/code/getting_started.sh[tag=install-airflow]
6060

6161
Where:
6262

63-
* `metadata.name` contains the name of the Airflow cluster.
63+
* `metadata.name`: contains the name of the Airflow cluster.
64+
* `spec.clusterConfig.metadataDatabase`: specifies one of the supported database types (in this case, `postgresql`) along with references to the host, database and the secret containing the connection credentials.
6465
* the product version of the Docker image provided by Stackable must be set in `spec.image.productVersion`.
6566
* `spec.celeryExecutors`: deploy executors managed by Airflow's Celery engine.
6667
Alternatively you can use `kuberenetesExectors` that use Airflow's Kubernetes engine for executor management.
6768
For more information see https://airflow.apache.org/docs/apache-airflow/stable/executor/index.html#executor-types).
68-
* the `spec.clusterConfig.loadExamples` key is optional and defaults to `false`.
69+
* `spec.celeryExecutors.celeryResultBackend`: specifies one of the supported database types (in this case, `postgresql`) along with references to the host, database and the secret containing the connection credentials.
70+
* `spec.celeryExecutors.celeryBroker`: specifies one of the supported queue/broker types (in this case, `redis`) along with references to the host and the secret containing the connection credentials.
71+
* `spec.clusterConfig.loadExamples`: this key is optional and defaults to `false`.
6972
It is set to `true` here as the example DAGs are used when verifying the installation.
70-
* the `spec.clusterConfig.exposeConfig` key is optional and defaults to `false`. It is set to `true` only as an aid to verify the configuration and should never be used as such in anything other than test or demo clusters.
71-
* the previously created secret must be referenced in `spec.clusterConfig.credentialsSecret`.
73+
* `spec.clusterConfig.exposeConfig`: this key is optional and defaults to `false`.
74+
It is set to `true` only as an aid to verify the configuration and should never be used as such in anything other than test or demo clusters.
75+
* `spec.clusterConfig.credentialsSecret`: specifies the secret containing the Airflow admin user information.
7276

7377
NOTE: The version you need to specify for `spec.image.productVersion` is the desired version of Apache Airflow.
7478
You can optionally specify the `spec.image.stackableVersion` to a certain release like `23.11.0` but it is recommended to leave it out and use the default provided by the operator.
7579
Check our https://oci.stackable.tech/[image registry,window=_blank] for a list of available versions. Information on how to browse the registry can be found xref:contributor:project-overview.adoc#docker-images[here,window=_blank].
7680
It should generally be safe to simply use the latest version that is available.
7781

82+
NOTE: Refer to xref:usage-guide/database-connections.adoc[] for more information about database/broker connections.
83+
7884
This creates the actual Airflow cluster.
7985

8086
After a while, all the Pods in the StatefulSets should be ready:
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
= Database connections
2+
:description: Configure Airflow Database connectivity.
3+
4+
Airflow requires a metadata database for storing e.g. DAG, task and job data.
5+
The actual connection string is calculated by the operator so that the user does not need to remember the exact structure.
6+
7+
== Typed connections
8+
9+
[source,yaml]
10+
----
11+
spec:
12+
clusterConfig:
13+
metadataDatabase:
14+
postgresql: # <1>
15+
host: airflow-postgresql
16+
database: airflow
17+
credentialsSecret: airflow-postgresql-credentials # <2>
18+
----
19+
<1> A reference to one of the supported database backends (e.g. `postgresql`).
20+
<2> A reference to a Secret which must contain the two fields `username` and `password`.
21+
22+
The queue/broker metadata and URL is only needed when running the celery executor.
23+
The `celeryResultBackend` definition uses the same structure as `metadataDatabase` shown above.
24+
The `celeryBroker` definition is similar but does not require a `databaseName`.
25+
26+
[source,yaml]
27+
----
28+
spec:
29+
celeryExecutors:
30+
celeryResultBackend:
31+
postgresql: # <1>
32+
host: airflow-postgresql
33+
database: airflow
34+
credentialsSecret: airflow-postgresql-credentials # <2>
35+
celeryBroker:
36+
redis: # <3>
37+
host: airflow-redis-master
38+
credentialsSecret: airflow-redis-credentials # <2>
39+
----
40+
<1> A reference to one of the supported database backends (e.g. `postgresql`).
41+
<2> A reference to a secret which must contain the two fields `username` and `password`.
42+
<3> A reference to one of the supported queue brokers (e.g. `redis`).
43+
44+
== Generic connections
45+
46+
Alternatively, these connections can also be defined in full in a referenced secret:
47+
48+
[source,yaml]
49+
----
50+
spec:
51+
clusterConfig:
52+
metadataDatabase:
53+
generic:
54+
uriSecret: postgresql-metadata # <1>
55+
----
56+
57+
[source,yaml]
58+
----
59+
spec:
60+
celeryResultBackend:
61+
generic:
62+
uriSecret: postgresql-celery # <2>
63+
celeryBroker:
64+
generic:
65+
uriSecret: redis-celery # <3>
66+
----
67+
68+
<1> A reference to a secret which must contain the single fields `uri` e.g.
69+
`uri: postgresql+psycopg2://airflow:airflow@airflow-postgresql/airflow`
70+
<2> A reference to a secret which must contain the single fields `uri` e.g.
71+
`uri: db+postgresql://airflow:airflow@airflow-postgresql/airflow`
72+
<3> A reference to a secret which must contain the single fields `uri` e.g.
73+
`uri: redis://:redis@airflow-redis-master:6379/0`

docs/modules/airflow/partials/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* xref:airflow:required-external-components.adoc[]
55
* xref:airflow:usage-guide/index.adoc[]
66
** xref:airflow:usage-guide/db-init.adoc[]
7+
** xref:airflow:usage-guide/database-connections.adoc[]
78
** xref:airflow:usage-guide/mounting-dags.adoc[]
89
** xref:airflow:usage-guide/applying-custom-resources.adoc[]
910
** xref:airflow:usage-guide/listenerclass.adoc[]

0 commit comments

Comments
 (0)