kaxil commented on a change in pull request #10393:
URL: https://github.com/apache/airflow/pull/10393#discussion_r484527338
##########
File path: airflow/example_dags/example_kubernetes_executor_config.py
##########
@@ -52,59 +53,68 @@ def test_volume_mount():
start_task = PythonOperator(
task_id="start_task",
python_callable=print_stuff,
- executor_config={
- "KubernetesExecutor": {
- "annotations": {"test": "annotation"}
- }
+ executor_config={"podOverride": k8s.V1Pod(
+ metadata=k8s.V1ObjectMeta(
+ annotations={"test": "annotation"}
+ )
+ )
}
)
# You can mount volume or secret to the worker pod
second_task = PythonOperator(
task_id="four_task",
python_callable=test_volume_mount,
- executor_config={
- "KubernetesExecutor": {
- "volumes": [
- {
- "name": "example-kubernetes-test-volume",
- "hostPath": {"path": "/tmp/"},
- },
+ executor_config={"podOverride": k8s.V1Pod(
+ spec=k8s.V1PodSpec(
+ containers=[
+ k8s.V1Container(
+ name="base",
+ volume_mounts=[
+ k8s.V1VolumeMount(
+ mount_path="/foo/",
+ name="example-kubernetes-test-volume"
+ )
+ ]
+ )
],
- "volume_mounts": [
- {
- "mountPath": "/foo/",
- "name": "example-kubernetes-test-volume",
- },
+ volumes=[
+ k8s.V1Volume(
+ name="example-kubernetes-test-volume",
+ host_path=k8s.V1HostPathVolumeSource(
+ path="/tmp/"
+ )
+ )
]
- }
+ )
+ )
}
)
# Test that we can add labels to pods
third_task = PythonOperator(
task_id="non_root_task",
python_callable=print_stuff,
- executor_config={
- "KubernetesExecutor": {
- "labels": {
+ executor_config={"podOverride": k8s.V1Pod(
+ metadata=k8s.V1ObjectMeta(
+ labels={
"release": "stable"
}
- }
+ )
+ )
}
)
other_ns_task = PythonOperator(
task_id="other_namespace_task",
python_callable=print_stuff,
- executor_config={
- "KubernetesExecutor": {
- "namespace": "test-namespace",
- "labels": {
- "release": "stable"
- }
- }
- }
+ # executor_config={"podOverride": k8s.V1Pod(
Review comment:
is the intention to remove this comments?
##########
File path: airflow/example_dags/example_kubernetes_executor_config.py
##########
@@ -52,59 +53,68 @@ def test_volume_mount():
start_task = PythonOperator(
task_id="start_task",
python_callable=print_stuff,
- executor_config={
- "KubernetesExecutor": {
- "annotations": {"test": "annotation"}
- }
+ executor_config={"podOverride": k8s.V1Pod(
+ metadata=k8s.V1ObjectMeta(
+ annotations={"test": "annotation"}
+ )
+ )
}
)
# You can mount volume or secret to the worker pod
second_task = PythonOperator(
task_id="four_task",
python_callable=test_volume_mount,
- executor_config={
- "KubernetesExecutor": {
- "volumes": [
- {
- "name": "example-kubernetes-test-volume",
- "hostPath": {"path": "/tmp/"},
- },
+ executor_config={"podOverride": k8s.V1Pod(
+ spec=k8s.V1PodSpec(
+ containers=[
+ k8s.V1Container(
+ name="base",
+ volume_mounts=[
+ k8s.V1VolumeMount(
+ mount_path="/foo/",
+ name="example-kubernetes-test-volume"
+ )
+ ]
+ )
],
- "volume_mounts": [
- {
- "mountPath": "/foo/",
- "name": "example-kubernetes-test-volume",
- },
+ volumes=[
+ k8s.V1Volume(
+ name="example-kubernetes-test-volume",
+ host_path=k8s.V1HostPathVolumeSource(
+ path="/tmp/"
+ )
+ )
]
- }
+ )
+ )
}
)
# Test that we can add labels to pods
third_task = PythonOperator(
task_id="non_root_task",
python_callable=print_stuff,
- executor_config={
- "KubernetesExecutor": {
- "labels": {
+ executor_config={"podOverride": k8s.V1Pod(
+ metadata=k8s.V1ObjectMeta(
+ labels={
"release": "stable"
}
- }
+ )
+ )
}
)
other_ns_task = PythonOperator(
task_id="other_namespace_task",
python_callable=print_stuff,
- executor_config={
- "KubernetesExecutor": {
- "namespace": "test-namespace",
- "labels": {
- "release": "stable"
- }
- }
- }
+ # executor_config={"podOverride": k8s.V1Pod(
Review comment:
is the intention to remove these comments?
----------------------------------------------------------------
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]