mrk-andreev commented on code in PR #43853:
URL: https://github.com/apache/airflow/pull/43853#discussion_r1837318245
##########
providers/src/airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -620,6 +625,9 @@ def execute_sync(self, context: Context):
self.callbacks.on_pod_creation(
pod=self.remote_pod, client=self.client,
mode=ExecutionMode.SYNC
)
+
+ self.await_init_containers_completion(pod=self.pod)
+
Review Comment:
Look like we can use `Waiting` instead. While init_container `Waiting` we
should wait.
> If a container is not in either the Running or Terminated state, it is
Waiting. A container in the Waiting state is still running the operations it
requires in order to complete start up: for example, pulling the container
image from a container image registry, or applying
[Secret](https://kubernetes.io/docs/concepts/configuration/secret/) data. When
you use kubectl to query a Pod with a container that is Waiting, you also see a
Reason field to summarize why the container is in that state.
ref:
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-state-waiting
So we can have `self._await_init_container_start(pod=pod, container_name=c)`
that will wait non-empty non-wait status :
```
# sort by spec.initContainers because containers runs sequentially
containers_to_log = sorted(containers_to_log, key=lambda cn:
all_containers.index(cn))
for c in containers_to_log:
self._await_init_container_start(pod=pod, container_name=c)
status = self.fetch_container_logs(pod=pod, container_name=c,
follow=follow_logs)
pod_logging_statuses.append(status)
```
--
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]