Skip to content

Commit ea541dc

Browse files
Update images for KPO and GKEO, make samples compatible with Airflow 3 (GoogleCloudPlatform#13750)
* Make Composer 2/3 examples compatible with Airflow 3 - Change schedule_interval to schedule - Import secrets from airflow.providers.cncf.kubernetes * Update images used by KPO and GKEO examples - Use an image from marketplace.gcr.io/google/ * Fix lint * Ignore Python 3.14 when testing Airflow DAGs * Ignore Python 3.14 when testing Airflow DAGs (Airflow 1 samples)
1 parent 100b397 commit ea541dc

File tree

7 files changed

+12
-10
lines changed

7 files changed

+12
-10
lines changed

composer/airflow_1_samples/gke_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
# project-id as the gcr.io images and the service account that Composer
9393
# uses has permission to access the Google Container Registry
9494
# (the default service account has permission)
95-
image="gcr.io/gcp-runtimes/ubuntu_18_0_4",
95+
image="marketplace.gcr.io/google/ubuntu2204",
9696
)
9797
# [END composer_gkeoperator_minconfig_airflow_1]
9898

composer/airflow_1_samples/kubernetes_pod_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
# project-id as the gcr.io images and the service account that Composer
9494
# uses has permission to access the Google Container Registry
9595
# (the default service account has permission)
96-
image="gcr.io/gcp-runtimes/ubuntu_18_0_4",
96+
image="marketplace.gcr.io/google/ubuntu2204",
9797
)
9898
# [END composer_kubernetespodoperator_minconfig_airflow_1]
9999
# [START composer_kubernetespodoperator_templateconfig_airflow_1]

composer/airflow_1_samples/noxfile_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# You can opt out from the test for specific Python versions.
3333
# Skipping for Python 3.9 due to numpy compilation failure.
3434
# Skipping 3.6 and 3.7, they are more out of date
35-
"ignored_versions": ["2.7", "3.6", "3.7", "3.9", "3.10", "3.11", "3.12", "3.13"],
35+
"ignored_versions": ["2.7", "3.6", "3.7", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"],
3636
# Old samples are opted out of enforcing Python type hints
3737
# All new samples should feature them
3838
"enforce_type_hints": False,

composer/workflows/gke_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
with models.DAG(
3131
"example_gcp_gke",
32-
schedule_interval=None, # Override to match your needs
32+
schedule=None, # Override to match your needs
3333
start_date=days_ago(1),
3434
tags=["example"],
3535
) as dag:
@@ -86,7 +86,7 @@
8686
# project-id as the gcr.io images and the service account that Composer
8787
# uses has permission to access the Google Container Registry
8888
# (the default service account has permission)
89-
image="gcr.io/gcp-runtimes/ubuntu_18_0_4",
89+
image="marketplace.gcr.io/google/ubuntu2204",
9090
)
9191
# [END composer_gkeoperator_minconfig]
9292

composer/workflows/kubernetes_pod_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
# project-id as the gcr.io images and the service account that Composer
9797
# uses has permission to access the Google Container Registry
9898
# (the default service account has permission)
99-
image="gcr.io/gcp-runtimes/ubuntu_18_0_4",
99+
image="marketplace.gcr.io/google/ubuntu2204",
100100
)
101101
# [END composer_kubernetespodoperator_minconfig]
102102
# [START composer_kubernetespodoperator_templateconfig]

composer/workflows/kubernetes_pod_operator_c2.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
import datetime
1818

1919
from airflow import models
20-
from airflow.kubernetes.secret import Secret
20+
2121
from airflow.providers.cncf.kubernetes.operators.pod import (
2222
KubernetesPodOperator,
2323
)
24+
from airflow.providers.cncf.kubernetes.secret import Secret
2425
from kubernetes.client import models as k8s_models
2526

2627
# A Secret is an object that contains a small amount of sensitive data such as
@@ -60,7 +61,7 @@
6061
# required to debug.
6162
with models.DAG(
6263
dag_id="composer_sample_kubernetes_pod",
63-
schedule_interval=datetime.timedelta(days=1),
64+
schedule=datetime.timedelta(days=1),
6465
start_date=YESTERDAY,
6566
) as dag:
6667
# Only name, image, and task_id are required to create a
@@ -88,7 +89,7 @@
8889
# project-id as the gcr.io images and the service account that Composer
8990
# uses has permission to access the Google Container Registry
9091
# (the default service account has permission)
91-
image="gcr.io/gcp-runtimes/ubuntu_20_0_4",
92+
image="marketplace.gcr.io/google/ubuntu2204",
9293
# Specifies path to kubernetes config. The config_file is templated.
9394
config_file="/home/airflow/composer_kube_config",
9495
# Identifier of connection that should be used
@@ -130,7 +131,7 @@
130131
task_id="ex-kube-secrets",
131132
name="ex-kube-secrets",
132133
namespace="composer-user-workloads",
133-
image="gcr.io/gcp-runtimes/ubuntu_20_0_4",
134+
image="marketplace.gcr.io/google/ubuntu2204",
134135
startup_timeout_seconds=300,
135136
# The secrets to pass to Pod, the Pod will fail to create if the
136137
# secrets you specify in a Secret object do not exist in Kubernetes.

composer/workflows/noxfile_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"3.10",
4040
"3.12",
4141
"3.13",
42+
"3.14",
4243
],
4344
# Old samples are opted out of enforcing Python type hints
4445
# All new samples should feature them

0 commit comments

Comments
 (0)