j-y-matsubara commented on a change in pull request #8757:
URL: https://github.com/apache/airflow/pull/8757#discussion_r422455491
##########
File path: docs/kubernetes.rst
##########
@@ -40,11 +40,44 @@ that has the ability to mutate pod objects before sending
them to the Kubernetes
for scheduling. It receives a single argument as a reference to pod objects,
and
is expected to alter its attributes.
-This could be used, for instance, to add sidecar or init containers
+This could be used, for instance, to add init containers
Review comment:
How is it used for sidecar?
We can mutation pod object by using pod_mutation_hook, but I think we can
not add any containers (sidecars), excluding the init container. ( In the case
of using kubernetes_request_factory.py※, pod object of argument of
pod_mutation_hook is not V1Pod. **Part of the contents of** req object creating
in pod_request_factory.py is overwritten with this pod object, and launch "Pod"
based on **req object.** To this overwrite, there is no function to add new
containers (sidecars).)
In the version 2.0, We can directly edit the pod object used to launch
"Pod". ( the pod object of argument of pod_mutation_hook is V1Pod ) Therefore,
we can add any containaers (sidecar).
If my understanding is mistaken, please tell me.
※Supplementary information (version 1.10.10)
If we set the following to the operator,
```
k2 = KubernetesPodOperator(namespace='airflow01',
task_id='test-kwsk',
name='test-kwsk',
image="airflowworker:1.0.0",
image_pull_policy="IfNotPresent",
cmds=["bash", "-cx"],
arguments=['sleep 10000'],
do_xcom_push=True,
....
..
```
The pod object of argument of pod_mutation_hook is already set as follows.
```
affinity: {}
annotations: {}
args: ['sleep 10000']
cmds: ['bash', '-cx']
configmaps: []
dnspolicy: None
envs: {}
hostnetwork: False
image: airflowworker:1.0.0
image_pull_policy: IfNotPresent
...
..
```
----------------------------------------------------------------
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]