Skip to content

Commit e85088f

Browse files
committed
opa docs
1 parent ccafd8a commit e85088f

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

docs/modules/demos/pages/airflow-scheduled-job.adoc

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Note that the connection to Kafka (`kafka_conn`) is expected: this has been crea
153153

154154
image::airflow-scheduled-job/airflow_12.png[]
155155

156-
We can use the kafka-producer script bundled with Kafka to write to this topic:
156+
We can use the kafka-producer script bundled with Kafka to write to this topic (note the namespace we chose initially is used consistently in this demo):
157157

158158
[source,bash]
159159
----
@@ -164,23 +164,48 @@ kubectl exec -n airflow-demo kafka-broker-default-0 -c kafka -- bash -c \
164164
--producer.config /stackable/config/client.properties'
165165
----
166166

167+
The triggerer logs will show that this DAG was fired (logging out the message that we wrote to the topic above):
168+
167169
image::airflow-scheduled-job/airflow_13.png[]
168170

171+
The DAG view will show that run was successful.
172+
Note the `kafka_queue_asset` under `Schedule`.
173+
This is an Airflow object (also defined in the DAG code) that wraps the actual trigger/wait mechanism in an generic way for use in DAG code.
174+
169175
image::airflow-scheduled-job/airflow_14.png[]
170176

177+
Clicking on the asset will show the triggers that have been fired, called `Asset Events`:
178+
171179
image::airflow-scheduled-job/airflow_15.png[]
172180

181+
=== `core_deferrable_sleep_demo` DAG
182+
183+
Now log out of the UI. This next section will illustrate user authorization with the Open Policy Agent (OPA) and the OPA Authorizer that is included in Stackable's Airflow product images.
184+
Two other users - other than `admin` - are supplied with this demo: `jane.doe` and `richard.roe` (the passwords are the same as the user names).
185+
`jane.doe` has permission to view all DAGs but only has permission to activate and run `core_deferrable_sleep_demo`.
186+
`richard.roe` does not have permission to view or action any DAGs.
187+
Login in as `jane.doe`.
188+
You will see the list of 4 DAGs as usual, and can enable `core_deferrable_sleep_demo` (the only DAG not automatically enabled when the demo was deployed).
189+
But if you try and run any other DAG, permission will be denied:
190+
173191
image::airflow-scheduled-job/airflow_16.png[]
174192

193+
Enable and run `core_deferrable_sleep_demo`:
194+
175195
image::airflow-scheduled-job/airflow_17.png[]
176196

197+
Click on the DAG, switching to the task view.
198+
This DAG uses a deferrable operator which, in conjunction with the triggerer process, "offloads" the DAG from its worker for a specfic period of time, before being picked up and again and executed.
199+
You will see the task cycle through the following states:
177200

178201
image::airflow-scheduled-job/deferrable_01_running.png[]
179202
image::airflow-scheduled-job/deferrable_02_queued.png[]
180203
image::airflow-scheduled-job/deferrable_03_deferred.png[]
181204
image::airflow-scheduled-job/deferrable_04_queued.png[]
182205
image::airflow-scheduled-job/deferrable_05_running.png[]
183-
image::airflow-scheduled-job/deferrable_06_status.png[]
206+
image::airflow-scheduled-job/deferrable_06_success.png[]
207+
208+
Now log out and log in again as `richard.roe`. On the home screen no DAGs are visible, as expected by the authorization rules defined for this user:
184209

185210
image::airflow-scheduled-job/opa_01.png[]
186211

0 commit comments

Comments
 (0)