kaxil commented on a change in pull request #10756:
URL: https://github.com/apache/airflow/pull/10756#discussion_r484852177



##########
File path: docs/concepts.rst
##########
@@ -156,6 +156,44 @@ Example DAG with functional abstraction
         html_content=email_info['body']
     )
 
+.. _concepts:executor_config:
+
+executor_config
+===============
+
+The executor_config is an argument placed into operators that allow airflow 
users to override tasks
+before launch. Currently this is primarily used by the 
:class:`KubernetesExecutor`, but will soon be available
+for other overrides.
+
+.. _concepts:pod_override:
+
+pod_override
+------------
+
+When using the KubernetesExecutor, Airflow offers the ability to override 
system defaults on a per-task basis.
+To utilize this functionality, create a Kubernetes V1pod object and fill in 
your desired overrides.
+Please note that the scheduler will override the ``metadata.name`` of the 
V1pod before launching it.

Review comment:
       ```suggestion
   Please note that the scheduler will override the ``metadata.name`` of the 
V1Pod before launching it.
   ```

##########
File path: docs/concepts.rst
##########
@@ -156,6 +156,44 @@ Example DAG with functional abstraction
         html_content=email_info['body']
     )
 
+.. _concepts:executor_config:
+
+executor_config
+===============
+
+The executor_config is an argument placed into operators that allow airflow 
users to override tasks
+before launch. Currently this is primarily used by the 
:class:`KubernetesExecutor`, but will soon be available
+for other overrides.
+
+.. _concepts:pod_override:
+
+pod_override
+------------
+
+When using the KubernetesExecutor, Airflow offers the ability to override 
system defaults on a per-task basis.
+To utilize this functionality, create a Kubernetes V1pod object and fill in 
your desired overrides.
+Please note that the scheduler will override the ``metadata.name`` of the 
V1pod before launching it.
+
+To overwrite the base container of the pod launched by the KubernetesExecutor,
+create a V1pod with a single container, and overwrite the fields as follows:
+
+.. exampleinclude:: 
/../airflow/example_dags/example_kubernetes_executor_config.py
+    :language: python
+    :start-after: [START task_with_volume]
+    :end-before: [END task_with_volume]
+
+Note that volume mounts environment variables, ports, and devices will all be 
extended instead of overwritten.

Review comment:
       ```suggestion
   Note that volume mounts, environment variables, ports, and devices will all 
be extended instead of overwritten.
   ```

##########
File path: tests/kubernetes/test_pod_generator.py
##########
@@ -270,7 +270,47 @@ def test_from_obj(self):
                 ],
             }
         })
+
+        result_from_pod = PodGenerator.from_obj(
+            {"pod_override":
+                k8s.V1Pod(
+                    metadata=k8s.V1ObjectMeta(
+                        annotations={"test": "annotation"}
+                    ),
+                    spec=k8s.V1PodSpec(
+                        containers=[
+                            k8s.V1Container(
+                                name="base",
+                                volume_mounts=[
+                                    k8s.V1VolumeMount(
+                                        name="example-kubernetes-test-volume",
+                                        mount_path="/foo/"
+                                    )
+                                ]
+                            )
+                        ],
+                        volumes=[
+                            k8s.V1Volume(
+                                name="example-kubernetes-test-volume",
+                                host_path="/tmp/"
+                            )
+                        ]
+                    )
+                )
+             }
+        )
+
         result = self.k8s_client.sanitize_for_serialization(result)
+        result_from_pod = 
self.k8s_client.sanitize_for_serialization(result_from_pod)
+        expected_from_pod = {'metadata': {'annotations': {'test': 
'annotation'}},
+                             'spec': {'containers': [
+                                 {'name': 'base',
+                                  'volumeMounts': [{'mountPath': '/foo/',
+                                                    'name': 
'example-kubernetes-test-volume'}]}],
+                                 'volumes': [{'hostPath': '/tmp/',
+                                              'name': 
'example-kubernetes-test-volume'}]}}
+        self.assertEqual(result_from_pod, expected_from_pod, "There was a 
discrepency"

Review comment:
       ```suggestion
           self.assertEqual(result_from_pod, expected_from_pod, "There was a 
discrepancy"
   ```

##########
File path: docs/concepts.rst
##########
@@ -156,6 +156,44 @@ Example DAG with functional abstraction
         html_content=email_info['body']
     )
 
+.. _concepts:executor_config:
+
+executor_config
+===============
+
+The executor_config is an argument placed into operators that allow airflow 
users to override tasks
+before launch. Currently this is primarily used by the 
:class:`KubernetesExecutor`, but will soon be available
+for other overrides.
+
+.. _concepts:pod_override:
+
+pod_override
+------------
+
+When using the KubernetesExecutor, Airflow offers the ability to override 
system defaults on a per-task basis.
+To utilize this functionality, create a Kubernetes V1pod object and fill in 
your desired overrides.
+Please note that the scheduler will override the ``metadata.name`` of the 
V1pod before launching it.
+
+To overwrite the base container of the pod launched by the KubernetesExecutor,
+create a V1pod with a single container, and overwrite the fields as follows:

Review comment:
       ```suggestion
   create a V1Pod with a single container, and overwrite the fields as follows:
   ```




----------------------------------------------------------------
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.

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


Reply via email to