ephraimbuddy commented on a change in pull request #19355:
URL: https://github.com/apache/airflow/pull/19355#discussion_r743132527



##########
File path: airflow/example_dags/example_kubernetes_executor.py
##########
@@ -38,57 +47,107 @@ def start_task():
         print_stuff()
 
     # But you can if you want to
-    kube_exec_config_special = {"KubernetesExecutor": {"image": 
"airflow/ci:latest"}}
+    kube_exec_config_special = {
+        "pod_override": k8s.V1Pod(
+            spec=k8s.V1PodSpec(
+                containers=[
+                    k8s.V1Container(
+                        name="base",
+                        # Please note that the image here must be similar to 
the one in your Dockerfile.
+                        # Using, for example, ubuntu:latest as base image
+                        # here would fail because it doesn't have `airflow` 
commands.
+                        # A scenario where changing the base image could be 
needed is if you have a
+                        # special library that you want to run only in this 
task. In that case,
+                        # you build the image with the special library, on top 
the image in your Dockerfile.
+                        image="apache/airflow:2.2.1-python3.9",
+                    ),
+                ]
+            )
+        )
+    }
 
     @task(executor_config=kube_exec_config_special)
     def one_task():
         print_stuff()
 
     # Use the zip binary, which is only found in this special docker image
-    kube_exec_config_zip_binary = {"KubernetesExecutor": {"image": 
"airflow/ci_zip:latest"}}
+    kube_exec_config_zip_binary = {
+        "pod_override": k8s.V1Pod(
+            spec=k8s.V1PodSpec(
+                containers=[
+                    k8s.V1Container(
+                        name="base",
+                        # Please note that the image here must be similar to 
the one in your Dockerfile.
+                        # Using, for example, ubuntu:latest as base image
+                        # here would fail because it doesn't have `airflow` 
commands.
+                        # A scenario where changing the base image could be 
needed is if you have a
+                        # special library that you want to run only in this 
task. In that case,
+                        # you build the image with the special library, on top 
the image in your Dockerfile.
+                        image="apache/airflow:2.2.1-python3.9-zip",

Review comment:
       I couldn't get the env var to work




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to