apache-airflow-providers-google 14.0.0__py3-none-any.whl → 19.1.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airflow/providers/google/3rd-party-licenses/LICENSES.txt +14 -0
- airflow/providers/google/3rd-party-licenses/NOTICE +5 -0
- airflow/providers/google/__init__.py +3 -3
- airflow/providers/google/_vendor/__init__.py +0 -0
- airflow/providers/google/_vendor/json_merge_patch.py +91 -0
- airflow/providers/google/ads/hooks/ads.py +52 -43
- airflow/providers/google/ads/operators/ads.py +2 -2
- airflow/providers/google/ads/transfers/ads_to_gcs.py +3 -19
- airflow/providers/google/assets/gcs.py +1 -11
- airflow/providers/google/cloud/_internal_client/secret_manager_client.py +3 -2
- airflow/providers/google/cloud/bundles/gcs.py +161 -0
- airflow/providers/google/cloud/hooks/alloy_db.py +2 -3
- airflow/providers/google/cloud/hooks/bigquery.py +195 -318
- airflow/providers/google/cloud/hooks/bigquery_dts.py +8 -8
- airflow/providers/google/cloud/hooks/bigtable.py +3 -2
- airflow/providers/google/cloud/hooks/cloud_batch.py +8 -9
- airflow/providers/google/cloud/hooks/cloud_build.py +6 -65
- airflow/providers/google/cloud/hooks/cloud_composer.py +292 -24
- airflow/providers/google/cloud/hooks/cloud_logging.py +109 -0
- airflow/providers/google/cloud/hooks/cloud_memorystore.py +4 -3
- airflow/providers/google/cloud/hooks/cloud_run.py +20 -11
- airflow/providers/google/cloud/hooks/cloud_sql.py +136 -64
- airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +35 -15
- airflow/providers/google/cloud/hooks/compute.py +7 -6
- airflow/providers/google/cloud/hooks/compute_ssh.py +7 -4
- airflow/providers/google/cloud/hooks/datacatalog.py +12 -3
- airflow/providers/google/cloud/hooks/dataflow.py +87 -242
- airflow/providers/google/cloud/hooks/dataform.py +9 -14
- airflow/providers/google/cloud/hooks/datafusion.py +7 -9
- airflow/providers/google/cloud/hooks/dataplex.py +13 -12
- airflow/providers/google/cloud/hooks/dataprep.py +2 -2
- airflow/providers/google/cloud/hooks/dataproc.py +76 -74
- airflow/providers/google/cloud/hooks/dataproc_metastore.py +4 -3
- airflow/providers/google/cloud/hooks/dlp.py +5 -4
- airflow/providers/google/cloud/hooks/gcs.py +144 -33
- airflow/providers/google/cloud/hooks/gen_ai.py +196 -0
- airflow/providers/google/cloud/hooks/kms.py +3 -2
- airflow/providers/google/cloud/hooks/kubernetes_engine.py +22 -17
- airflow/providers/google/cloud/hooks/looker.py +6 -1
- airflow/providers/google/cloud/hooks/managed_kafka.py +227 -3
- airflow/providers/google/cloud/hooks/mlengine.py +7 -8
- airflow/providers/google/cloud/hooks/natural_language.py +3 -2
- airflow/providers/google/cloud/hooks/os_login.py +3 -2
- airflow/providers/google/cloud/hooks/pubsub.py +6 -6
- airflow/providers/google/cloud/hooks/secret_manager.py +105 -12
- airflow/providers/google/cloud/hooks/spanner.py +75 -10
- airflow/providers/google/cloud/hooks/speech_to_text.py +3 -2
- airflow/providers/google/cloud/hooks/stackdriver.py +18 -18
- airflow/providers/google/cloud/hooks/tasks.py +4 -3
- airflow/providers/google/cloud/hooks/text_to_speech.py +3 -2
- airflow/providers/google/cloud/hooks/translate.py +8 -17
- airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +8 -222
- airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +9 -15
- airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +33 -283
- airflow/providers/google/cloud/hooks/vertex_ai/dataset.py +5 -12
- airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py +6 -12
- airflow/providers/google/cloud/hooks/vertex_ai/experiment_service.py +202 -0
- airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +311 -10
- airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +79 -75
- airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +7 -13
- airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +8 -12
- airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +6 -12
- airflow/providers/google/cloud/hooks/vertex_ai/prediction_service.py +3 -2
- airflow/providers/google/cloud/hooks/vertex_ai/ray.py +223 -0
- airflow/providers/google/cloud/hooks/video_intelligence.py +3 -2
- airflow/providers/google/cloud/hooks/vision.py +7 -7
- airflow/providers/google/cloud/hooks/workflows.py +4 -3
- airflow/providers/google/cloud/links/alloy_db.py +0 -46
- airflow/providers/google/cloud/links/base.py +77 -7
- airflow/providers/google/cloud/links/bigquery.py +0 -47
- airflow/providers/google/cloud/links/bigquery_dts.py +0 -20
- airflow/providers/google/cloud/links/bigtable.py +0 -48
- airflow/providers/google/cloud/links/cloud_build.py +0 -73
- airflow/providers/google/cloud/links/cloud_functions.py +0 -33
- airflow/providers/google/cloud/links/cloud_memorystore.py +0 -58
- airflow/providers/google/cloud/links/{life_sciences.py → cloud_run.py} +5 -27
- airflow/providers/google/cloud/links/cloud_sql.py +0 -33
- airflow/providers/google/cloud/links/cloud_storage_transfer.py +17 -46
- airflow/providers/google/cloud/links/cloud_tasks.py +7 -26
- airflow/providers/google/cloud/links/compute.py +0 -58
- airflow/providers/google/cloud/links/data_loss_prevention.py +0 -169
- airflow/providers/google/cloud/links/datacatalog.py +23 -54
- airflow/providers/google/cloud/links/dataflow.py +0 -34
- airflow/providers/google/cloud/links/dataform.py +0 -64
- airflow/providers/google/cloud/links/datafusion.py +1 -90
- airflow/providers/google/cloud/links/dataplex.py +0 -154
- airflow/providers/google/cloud/links/dataprep.py +0 -24
- airflow/providers/google/cloud/links/dataproc.py +11 -89
- airflow/providers/google/cloud/links/datastore.py +0 -31
- airflow/providers/google/cloud/links/kubernetes_engine.py +11 -61
- airflow/providers/google/cloud/links/managed_kafka.py +11 -51
- airflow/providers/google/cloud/links/mlengine.py +0 -70
- airflow/providers/google/cloud/links/pubsub.py +0 -32
- airflow/providers/google/cloud/links/spanner.py +0 -33
- airflow/providers/google/cloud/links/stackdriver.py +0 -30
- airflow/providers/google/cloud/links/translate.py +17 -187
- airflow/providers/google/cloud/links/vertex_ai.py +28 -195
- airflow/providers/google/cloud/links/workflows.py +0 -52
- airflow/providers/google/cloud/log/gcs_task_handler.py +166 -118
- airflow/providers/google/cloud/log/stackdriver_task_handler.py +14 -9
- airflow/providers/google/cloud/openlineage/CloudStorageTransferJobFacet.json +68 -0
- airflow/providers/google/cloud/openlineage/CloudStorageTransferRunFacet.json +60 -0
- airflow/providers/google/cloud/openlineage/DataFusionRunFacet.json +32 -0
- airflow/providers/google/cloud/openlineage/facets.py +141 -40
- airflow/providers/google/cloud/openlineage/mixins.py +14 -13
- airflow/providers/google/cloud/openlineage/utils.py +19 -3
- airflow/providers/google/cloud/operators/alloy_db.py +76 -61
- airflow/providers/google/cloud/operators/bigquery.py +104 -667
- airflow/providers/google/cloud/operators/bigquery_dts.py +12 -12
- airflow/providers/google/cloud/operators/bigtable.py +38 -7
- airflow/providers/google/cloud/operators/cloud_base.py +22 -1
- airflow/providers/google/cloud/operators/cloud_batch.py +18 -18
- airflow/providers/google/cloud/operators/cloud_build.py +80 -36
- airflow/providers/google/cloud/operators/cloud_composer.py +157 -71
- airflow/providers/google/cloud/operators/cloud_logging_sink.py +341 -0
- airflow/providers/google/cloud/operators/cloud_memorystore.py +74 -46
- airflow/providers/google/cloud/operators/cloud_run.py +39 -20
- airflow/providers/google/cloud/operators/cloud_sql.py +46 -61
- airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +92 -14
- airflow/providers/google/cloud/operators/compute.py +18 -50
- airflow/providers/google/cloud/operators/datacatalog.py +167 -29
- airflow/providers/google/cloud/operators/dataflow.py +38 -15
- airflow/providers/google/cloud/operators/dataform.py +19 -7
- airflow/providers/google/cloud/operators/datafusion.py +43 -43
- airflow/providers/google/cloud/operators/dataplex.py +212 -126
- airflow/providers/google/cloud/operators/dataprep.py +1 -5
- airflow/providers/google/cloud/operators/dataproc.py +134 -207
- airflow/providers/google/cloud/operators/dataproc_metastore.py +102 -84
- airflow/providers/google/cloud/operators/datastore.py +22 -6
- airflow/providers/google/cloud/operators/dlp.py +24 -45
- airflow/providers/google/cloud/operators/functions.py +21 -14
- airflow/providers/google/cloud/operators/gcs.py +15 -12
- airflow/providers/google/cloud/operators/gen_ai.py +389 -0
- airflow/providers/google/cloud/operators/kubernetes_engine.py +115 -106
- airflow/providers/google/cloud/operators/looker.py +1 -1
- airflow/providers/google/cloud/operators/managed_kafka.py +362 -40
- airflow/providers/google/cloud/operators/natural_language.py +5 -3
- airflow/providers/google/cloud/operators/pubsub.py +69 -21
- airflow/providers/google/cloud/operators/spanner.py +53 -45
- airflow/providers/google/cloud/operators/speech_to_text.py +5 -4
- airflow/providers/google/cloud/operators/stackdriver.py +5 -11
- airflow/providers/google/cloud/operators/tasks.py +6 -15
- airflow/providers/google/cloud/operators/text_to_speech.py +4 -3
- airflow/providers/google/cloud/operators/translate.py +46 -20
- airflow/providers/google/cloud/operators/translate_speech.py +4 -3
- airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +44 -34
- airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +34 -12
- airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +62 -53
- airflow/providers/google/cloud/operators/vertex_ai/dataset.py +75 -11
- airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +48 -12
- airflow/providers/google/cloud/operators/vertex_ai/experiment_service.py +435 -0
- airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +532 -1
- airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +135 -116
- airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +16 -12
- airflow/providers/google/cloud/operators/vertex_ai/model_service.py +62 -14
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +35 -10
- airflow/providers/google/cloud/operators/vertex_ai/ray.py +393 -0
- airflow/providers/google/cloud/operators/video_intelligence.py +5 -3
- airflow/providers/google/cloud/operators/vision.py +7 -5
- airflow/providers/google/cloud/operators/workflows.py +24 -19
- airflow/providers/google/cloud/secrets/secret_manager.py +2 -1
- airflow/providers/google/cloud/sensors/bigquery.py +2 -2
- airflow/providers/google/cloud/sensors/bigquery_dts.py +6 -4
- airflow/providers/google/cloud/sensors/bigtable.py +14 -6
- airflow/providers/google/cloud/sensors/cloud_composer.py +535 -33
- airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +6 -5
- airflow/providers/google/cloud/sensors/dataflow.py +27 -10
- airflow/providers/google/cloud/sensors/dataform.py +2 -2
- airflow/providers/google/cloud/sensors/datafusion.py +4 -4
- airflow/providers/google/cloud/sensors/dataplex.py +7 -5
- airflow/providers/google/cloud/sensors/dataprep.py +2 -2
- airflow/providers/google/cloud/sensors/dataproc.py +10 -9
- airflow/providers/google/cloud/sensors/dataproc_metastore.py +4 -3
- airflow/providers/google/cloud/sensors/gcs.py +22 -21
- airflow/providers/google/cloud/sensors/looker.py +5 -5
- airflow/providers/google/cloud/sensors/pubsub.py +20 -20
- airflow/providers/google/cloud/sensors/tasks.py +2 -2
- airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +2 -2
- airflow/providers/google/cloud/sensors/workflows.py +6 -4
- airflow/providers/google/cloud/transfers/adls_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +11 -8
- airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +14 -13
- airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +7 -3
- airflow/providers/google/cloud/transfers/bigquery_to_mysql.py +12 -1
- airflow/providers/google/cloud/transfers/bigquery_to_postgres.py +24 -10
- airflow/providers/google/cloud/transfers/bigquery_to_sql.py +104 -5
- airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +18 -22
- airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +4 -5
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +45 -38
- airflow/providers/google/cloud/transfers/gcs_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/gcs_to_local.py +5 -3
- airflow/providers/google/cloud/transfers/gcs_to_sftp.py +10 -4
- airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +6 -2
- airflow/providers/google/cloud/transfers/gdrive_to_local.py +2 -2
- airflow/providers/google/cloud/transfers/http_to_gcs.py +193 -0
- airflow/providers/google/cloud/transfers/local_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/mssql_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/oracle_to_gcs.py +36 -11
- airflow/providers/google/cloud/transfers/postgres_to_gcs.py +44 -12
- airflow/providers/google/cloud/transfers/s3_to_gcs.py +12 -6
- airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/sftp_to_gcs.py +36 -14
- airflow/providers/google/cloud/transfers/sheets_to_gcs.py +3 -3
- airflow/providers/google/cloud/transfers/sql_to_gcs.py +10 -10
- airflow/providers/google/cloud/triggers/bigquery.py +75 -34
- airflow/providers/google/cloud/triggers/bigquery_dts.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_batch.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_build.py +3 -2
- airflow/providers/google/cloud/triggers/cloud_composer.py +303 -47
- airflow/providers/google/cloud/triggers/cloud_run.py +2 -2
- airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +96 -5
- airflow/providers/google/cloud/triggers/dataflow.py +125 -2
- airflow/providers/google/cloud/triggers/datafusion.py +1 -1
- airflow/providers/google/cloud/triggers/dataplex.py +16 -3
- airflow/providers/google/cloud/triggers/dataproc.py +124 -53
- airflow/providers/google/cloud/triggers/kubernetes_engine.py +46 -28
- airflow/providers/google/cloud/triggers/mlengine.py +1 -1
- airflow/providers/google/cloud/triggers/pubsub.py +17 -20
- airflow/providers/google/cloud/triggers/vertex_ai.py +8 -7
- airflow/providers/google/cloud/utils/bigquery.py +5 -7
- airflow/providers/google/cloud/utils/bigquery_get_data.py +1 -1
- airflow/providers/google/cloud/utils/credentials_provider.py +4 -3
- airflow/providers/google/cloud/utils/dataform.py +1 -1
- airflow/providers/google/cloud/utils/external_token_supplier.py +0 -1
- airflow/providers/google/cloud/utils/field_validator.py +1 -2
- airflow/providers/google/cloud/utils/validators.py +43 -0
- airflow/providers/google/common/auth_backend/google_openid.py +26 -9
- airflow/providers/google/common/consts.py +2 -1
- airflow/providers/google/common/deprecated.py +2 -1
- airflow/providers/google/common/hooks/base_google.py +40 -43
- airflow/providers/google/common/hooks/operation_helpers.py +78 -0
- airflow/providers/google/common/links/storage.py +0 -22
- airflow/providers/google/common/utils/get_secret.py +31 -0
- airflow/providers/google/common/utils/id_token_credentials.py +4 -5
- airflow/providers/google/firebase/operators/firestore.py +2 -2
- airflow/providers/google/get_provider_info.py +61 -216
- airflow/providers/google/go_module_utils.py +35 -3
- airflow/providers/google/leveldb/hooks/leveldb.py +30 -6
- airflow/providers/google/leveldb/operators/leveldb.py +2 -2
- airflow/providers/google/marketing_platform/hooks/analytics_admin.py +3 -2
- airflow/providers/google/marketing_platform/hooks/display_video.py +3 -109
- airflow/providers/google/marketing_platform/hooks/search_ads.py +1 -1
- airflow/providers/google/marketing_platform/links/analytics_admin.py +4 -5
- airflow/providers/google/marketing_platform/operators/analytics_admin.py +7 -6
- airflow/providers/google/marketing_platform/operators/campaign_manager.py +5 -5
- airflow/providers/google/marketing_platform/operators/display_video.py +28 -489
- airflow/providers/google/marketing_platform/operators/search_ads.py +2 -2
- airflow/providers/google/marketing_platform/sensors/campaign_manager.py +2 -2
- airflow/providers/google/marketing_platform/sensors/display_video.py +4 -64
- airflow/providers/google/suite/hooks/calendar.py +1 -1
- airflow/providers/google/suite/hooks/drive.py +2 -2
- airflow/providers/google/suite/hooks/sheets.py +15 -1
- airflow/providers/google/suite/operators/sheets.py +8 -3
- airflow/providers/google/suite/sensors/drive.py +2 -2
- airflow/providers/google/suite/transfers/gcs_to_gdrive.py +2 -2
- airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
- airflow/providers/google/suite/transfers/local_to_drive.py +3 -3
- airflow/providers/google/suite/transfers/sql_to_sheets.py +5 -4
- airflow/providers/google/version_compat.py +15 -1
- {apache_airflow_providers_google-14.0.0.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/METADATA +117 -72
- apache_airflow_providers_google-19.1.0rc1.dist-info/RECORD +331 -0
- {apache_airflow_providers_google-14.0.0.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/WHEEL +1 -1
- apache_airflow_providers_google-19.1.0rc1.dist-info/licenses/NOTICE +5 -0
- airflow/providers/google/cloud/example_dags/example_cloud_task.py +0 -54
- airflow/providers/google/cloud/hooks/automl.py +0 -679
- airflow/providers/google/cloud/hooks/life_sciences.py +0 -159
- airflow/providers/google/cloud/links/automl.py +0 -193
- airflow/providers/google/cloud/operators/automl.py +0 -1360
- airflow/providers/google/cloud/operators/life_sciences.py +0 -119
- airflow/providers/google/cloud/operators/mlengine.py +0 -1515
- airflow/providers/google/cloud/utils/mlengine_operator_utils.py +0 -273
- apache_airflow_providers_google-14.0.0.dist-info/RECORD +0 -318
- /airflow/providers/google/cloud/{example_dags → bundles}/__init__.py +0 -0
- {apache_airflow_providers_google-14.0.0.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/entry_points.txt +0 -0
- {airflow/providers/google → apache_airflow_providers_google-19.1.0rc1.dist-info/licenses}/LICENSE +0 -0
|
@@ -24,6 +24,7 @@ from collections.abc import Sequence
|
|
|
24
24
|
from functools import cached_property
|
|
25
25
|
from typing import TYPE_CHECKING, Any
|
|
26
26
|
|
|
27
|
+
from google.api_core.exceptions import AlreadyExists
|
|
27
28
|
from kubernetes.client import V1JobList, models as k8s
|
|
28
29
|
from packaging.version import parse as parse_version
|
|
29
30
|
|
|
@@ -56,11 +57,9 @@ from airflow.providers.google.cloud.triggers.kubernetes_engine import (
|
|
|
56
57
|
GKEOperationTrigger,
|
|
57
58
|
GKEStartPodTrigger,
|
|
58
59
|
)
|
|
59
|
-
from airflow.providers.google.common.deprecated import deprecated
|
|
60
60
|
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
|
61
61
|
from airflow.providers_manager import ProvidersManager
|
|
62
62
|
from airflow.utils.timezone import utcnow
|
|
63
|
-
from google.api_core.exceptions import AlreadyExists
|
|
64
63
|
|
|
65
64
|
try:
|
|
66
65
|
from airflow.providers.cncf.kubernetes.operators.job import KubernetesDeleteJobOperator
|
|
@@ -73,11 +72,11 @@ except ImportError:
|
|
|
73
72
|
)
|
|
74
73
|
|
|
75
74
|
if TYPE_CHECKING:
|
|
75
|
+
from google.cloud.container_v1.types import Cluster
|
|
76
76
|
from kubernetes.client.models import V1Job
|
|
77
77
|
from pendulum import DateTime
|
|
78
78
|
|
|
79
|
-
from airflow.
|
|
80
|
-
from google.cloud.container_v1.types import Cluster
|
|
79
|
+
from airflow.providers.common.compat.sdk import Context
|
|
81
80
|
|
|
82
81
|
KUBE_CONFIG_ENV_VAR = "KUBECONFIG"
|
|
83
82
|
|
|
@@ -89,6 +88,7 @@ class GKEClusterAuthDetails:
|
|
|
89
88
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
90
89
|
:param project_id: The Google Developers Console project id.
|
|
91
90
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
91
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
92
92
|
:param cluster_hook: airflow hook for working with kubernetes cluster.
|
|
93
93
|
"""
|
|
94
94
|
|
|
@@ -97,11 +97,13 @@ class GKEClusterAuthDetails:
|
|
|
97
97
|
cluster_name: str,
|
|
98
98
|
project_id: str,
|
|
99
99
|
use_internal_ip: bool,
|
|
100
|
+
use_dns_endpoint: bool,
|
|
100
101
|
cluster_hook: GKEHook,
|
|
101
102
|
):
|
|
102
103
|
self.cluster_name = cluster_name
|
|
103
104
|
self.project_id = project_id
|
|
104
105
|
self.use_internal_ip = use_internal_ip
|
|
106
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
105
107
|
self.cluster_hook = cluster_hook
|
|
106
108
|
self._cluster_url: str
|
|
107
109
|
self._ssl_ca_cert: str
|
|
@@ -113,10 +115,14 @@ class GKEClusterAuthDetails:
|
|
|
113
115
|
project_id=self.project_id,
|
|
114
116
|
)
|
|
115
117
|
|
|
116
|
-
if
|
|
117
|
-
self._cluster_url =
|
|
118
|
-
|
|
118
|
+
if self.use_dns_endpoint:
|
|
119
|
+
self._cluster_url = (
|
|
120
|
+
f"https://{cluster.control_plane_endpoints_config.dns_endpoint_config.endpoint}"
|
|
121
|
+
)
|
|
122
|
+
elif self.use_internal_ip:
|
|
119
123
|
self._cluster_url = f"https://{cluster.private_cluster_config.private_endpoint}"
|
|
124
|
+
else:
|
|
125
|
+
self._cluster_url = f"https://{cluster.endpoint}"
|
|
120
126
|
self._ssl_ca_cert = cluster.master_auth.cluster_ca_certificate
|
|
121
127
|
return self._cluster_url, self._ssl_ca_cert
|
|
122
128
|
|
|
@@ -130,6 +136,7 @@ class GKEOperatorMixin:
|
|
|
130
136
|
"location",
|
|
131
137
|
"cluster_name",
|
|
132
138
|
"use_internal_ip",
|
|
139
|
+
"use_dns_endpoint",
|
|
133
140
|
"project_id",
|
|
134
141
|
"gcp_conn_id",
|
|
135
142
|
"impersonation_chain",
|
|
@@ -151,6 +158,7 @@ class GKEOperatorMixin:
|
|
|
151
158
|
cluster_url=self.cluster_url,
|
|
152
159
|
ssl_ca_cert=self.ssl_ca_cert,
|
|
153
160
|
enable_tcp_keepalive=self.enable_tcp_keepalive,
|
|
161
|
+
use_dns_endpoint=self.use_dns_endpoint, # type: ignore[attr-defined]
|
|
154
162
|
)
|
|
155
163
|
|
|
156
164
|
@cached_property
|
|
@@ -160,6 +168,7 @@ class GKEOperatorMixin:
|
|
|
160
168
|
cluster_name=self.cluster_name, # type: ignore[attr-defined]
|
|
161
169
|
project_id=self.project_id, # type: ignore[attr-defined]
|
|
162
170
|
use_internal_ip=self.use_internal_ip, # type: ignore[attr-defined]
|
|
171
|
+
use_dns_endpoint=self.use_dns_endpoint, # type: ignore[attr-defined]
|
|
163
172
|
cluster_hook=self.cluster_hook,
|
|
164
173
|
)
|
|
165
174
|
return auth_details.fetch_cluster_info()
|
|
@@ -200,6 +209,7 @@ class GKEDeleteClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
200
209
|
cluster resides, e.g. 'us-central1-a'
|
|
201
210
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
202
211
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
212
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
203
213
|
:param project_id: The Google Developers Console project id
|
|
204
214
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
205
215
|
users to specify a service account.
|
|
@@ -211,7 +221,6 @@ class GKEDeleteClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
211
221
|
If set as a sequence, the identities from the list must grant
|
|
212
222
|
Service Account Token Creator IAM role to the directly preceding identity, with first
|
|
213
223
|
account from the list granting this role to the originating account (templated).
|
|
214
|
-
:param name: (Deprecated) The name of the resource to delete, in this case cluster name
|
|
215
224
|
:param api_version: The api version to use
|
|
216
225
|
:param deferrable: Run operator in the deferrable mode.
|
|
217
226
|
:param poll_interval: Interval size which defines how often operation status is checked.
|
|
@@ -225,11 +234,11 @@ class GKEDeleteClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
225
234
|
self,
|
|
226
235
|
location: str,
|
|
227
236
|
use_internal_ip: bool = False,
|
|
237
|
+
use_dns_endpoint: bool = False,
|
|
228
238
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
229
239
|
gcp_conn_id: str = "google_cloud_default",
|
|
230
240
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
231
241
|
cluster_name: str | None = None,
|
|
232
|
-
name: str | None = None,
|
|
233
242
|
api_version: str = "v2",
|
|
234
243
|
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
|
|
235
244
|
poll_interval: int = 10,
|
|
@@ -239,35 +248,17 @@ class GKEDeleteClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
239
248
|
super().__init__(*args, **kwargs)
|
|
240
249
|
|
|
241
250
|
self.location = location
|
|
242
|
-
self.cluster_name = cluster_name
|
|
251
|
+
self.cluster_name = cluster_name
|
|
243
252
|
self.use_internal_ip = use_internal_ip
|
|
253
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
244
254
|
self.project_id = project_id
|
|
245
255
|
self.gcp_conn_id = gcp_conn_id
|
|
246
256
|
self.impersonation_chain = impersonation_chain
|
|
247
|
-
self._name = name
|
|
248
257
|
self.api_version = api_version
|
|
249
258
|
self.deferrable = deferrable
|
|
250
259
|
self.poll_interval = poll_interval
|
|
251
260
|
self._check_input()
|
|
252
261
|
|
|
253
|
-
@property
|
|
254
|
-
@deprecated(
|
|
255
|
-
planned_removal_date="May 01, 2025",
|
|
256
|
-
use_instead="cluster_name",
|
|
257
|
-
category=AirflowProviderDeprecationWarning,
|
|
258
|
-
)
|
|
259
|
-
def name(self) -> str | None:
|
|
260
|
-
return self._name
|
|
261
|
-
|
|
262
|
-
@name.setter
|
|
263
|
-
@deprecated(
|
|
264
|
-
planned_removal_date="May 01, 2025",
|
|
265
|
-
use_instead="cluster_name",
|
|
266
|
-
category=AirflowProviderDeprecationWarning,
|
|
267
|
-
)
|
|
268
|
-
def name(self, name: str) -> None:
|
|
269
|
-
self._name = name
|
|
270
|
-
|
|
271
262
|
def _check_input(self) -> None:
|
|
272
263
|
if not all([self.project_id, self.cluster_name, self.location]):
|
|
273
264
|
self.log.error("One of (project_id, cluster_name, location) is missing or incorrect")
|
|
@@ -347,6 +338,7 @@ class GKECreateClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
347
338
|
:param location: The name of the Google Kubernetes Engine zone or region in which the
|
|
348
339
|
cluster resides, e.g. 'us-central1-a'
|
|
349
340
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
341
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
350
342
|
:param project_id: The Google Developers Console project id
|
|
351
343
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
352
344
|
users to specify a service account.
|
|
@@ -375,6 +367,7 @@ class GKECreateClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
375
367
|
body: dict | Cluster,
|
|
376
368
|
location: str,
|
|
377
369
|
use_internal_ip: bool = False,
|
|
370
|
+
use_dns_endpoint: bool = False,
|
|
378
371
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
379
372
|
gcp_conn_id: str = "google_cloud_default",
|
|
380
373
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
@@ -387,6 +380,7 @@ class GKECreateClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
387
380
|
self.body = body
|
|
388
381
|
self.location = location
|
|
389
382
|
self.use_internal_ip = use_internal_ip
|
|
383
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
390
384
|
self.cluster_name = body.get("name") if isinstance(body, dict) else getattr(body, "name", None)
|
|
391
385
|
self.project_id = project_id
|
|
392
386
|
self.gcp_conn_id = gcp_conn_id
|
|
@@ -441,8 +435,7 @@ class GKECreateClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
441
435
|
"""Extract the value of the given field name."""
|
|
442
436
|
if isinstance(self.body, dict):
|
|
443
437
|
return self.body.get(field_name, default_value)
|
|
444
|
-
|
|
445
|
-
return getattr(self.body, field_name, default_value)
|
|
438
|
+
return getattr(self.body, field_name, default_value)
|
|
446
439
|
|
|
447
440
|
def _alert_deprecated_body_fields(self) -> None:
|
|
448
441
|
"""Generate warning messages if deprecated fields were used in the body."""
|
|
@@ -460,8 +453,15 @@ class GKECreateClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
460
453
|
stacklevel=2,
|
|
461
454
|
)
|
|
462
455
|
|
|
456
|
+
@property
|
|
457
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
458
|
+
return {
|
|
459
|
+
"project_id": self.project_id,
|
|
460
|
+
"location": self.location,
|
|
461
|
+
}
|
|
462
|
+
|
|
463
463
|
def execute(self, context: Context) -> str:
|
|
464
|
-
KubernetesEngineClusterLink.persist(context=context,
|
|
464
|
+
KubernetesEngineClusterLink.persist(context=context, cluster=self.body)
|
|
465
465
|
|
|
466
466
|
try:
|
|
467
467
|
operation = self.cluster_hook.create_cluster(
|
|
@@ -519,6 +519,7 @@ class GKEStartKueueInsideClusterOperator(GKEOperatorMixin, KubernetesInstallKueu
|
|
|
519
519
|
cluster resides, e.g. 'us-central1-a'
|
|
520
520
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
521
521
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
522
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
522
523
|
:param project_id: The Google Developers Console project id
|
|
523
524
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
524
525
|
users to specify a service account.
|
|
@@ -543,6 +544,7 @@ class GKEStartKueueInsideClusterOperator(GKEOperatorMixin, KubernetesInstallKueu
|
|
|
543
544
|
location: str,
|
|
544
545
|
cluster_name: str,
|
|
545
546
|
use_internal_ip: bool = False,
|
|
547
|
+
use_dns_endpoint: bool = False,
|
|
546
548
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
547
549
|
gcp_conn_id: str = "google_cloud_default",
|
|
548
550
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
@@ -555,11 +557,19 @@ class GKEStartKueueInsideClusterOperator(GKEOperatorMixin, KubernetesInstallKueu
|
|
|
555
557
|
self.cluster_name = cluster_name
|
|
556
558
|
self.gcp_conn_id = gcp_conn_id
|
|
557
559
|
self.use_internal_ip = use_internal_ip
|
|
560
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
558
561
|
self.impersonation_chain = impersonation_chain
|
|
559
562
|
|
|
563
|
+
@property
|
|
564
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
565
|
+
return {
|
|
566
|
+
"project_id": self.project_id,
|
|
567
|
+
"location": self.location,
|
|
568
|
+
}
|
|
569
|
+
|
|
560
570
|
def execute(self, context: Context):
|
|
561
571
|
cluster = self.cluster_hook.get_cluster(name=self.cluster_name, project_id=self.project_id)
|
|
562
|
-
KubernetesEngineClusterLink.persist(context=context,
|
|
572
|
+
KubernetesEngineClusterLink.persist(context=context, cluster=cluster)
|
|
563
573
|
|
|
564
574
|
if self.cluster_hook.check_cluster_autoscaling_ability(cluster=cluster):
|
|
565
575
|
super().execute(context)
|
|
@@ -592,6 +602,7 @@ class GKEStartPodOperator(GKEOperatorMixin, KubernetesPodOperator):
|
|
|
592
602
|
cluster resides, e.g. 'us-central1-a'
|
|
593
603
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
594
604
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
605
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
595
606
|
:param project_id: The Google Developers Console project id
|
|
596
607
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
597
608
|
users to specify a service account.
|
|
@@ -603,21 +614,15 @@ class GKEStartPodOperator(GKEOperatorMixin, KubernetesPodOperator):
|
|
|
603
614
|
If set as a sequence, the identities from the list must grant
|
|
604
615
|
Service Account Token Creator IAM role to the directly preceding identity, with first
|
|
605
616
|
account from the list granting this role to the originating account (templated).
|
|
606
|
-
:param regional: (Deprecated) The location param is region name.
|
|
607
617
|
:param on_finish_action: What to do when the pod reaches its final state, or the execution is interrupted.
|
|
608
618
|
If "delete_pod", the pod will be deleted regardless its state; if "delete_succeeded_pod",
|
|
609
619
|
only succeeded pod will be deleted. You can set to "keep_pod" to keep the pod.
|
|
610
|
-
Current default is `
|
|
611
|
-
:param is_delete_operator_pod: (Deprecated) What to do when the pod reaches its final
|
|
612
|
-
state, or the execution is interrupted. If True, delete the
|
|
613
|
-
pod; if False, leave the pod. Current default is False, but this will be
|
|
614
|
-
changed in the next major release of this provider.
|
|
615
|
-
Deprecated - use `on_finish_action` instead.
|
|
620
|
+
Current default is `delete_pod`, but this will be changed in the next major release of this provider.
|
|
616
621
|
:param deferrable: Run operator in the deferrable mode.
|
|
617
622
|
"""
|
|
618
623
|
|
|
619
624
|
template_fields: Sequence[str] = tuple(
|
|
620
|
-
{"
|
|
625
|
+
{"deferrable"}
|
|
621
626
|
| (set(KubernetesPodOperator.template_fields) - {"is_delete_operator_pod", "regional"})
|
|
622
627
|
| set(GKEOperatorMixin.template_fields)
|
|
623
628
|
)
|
|
@@ -628,43 +633,27 @@ class GKEStartPodOperator(GKEOperatorMixin, KubernetesPodOperator):
|
|
|
628
633
|
location: str,
|
|
629
634
|
cluster_name: str,
|
|
630
635
|
use_internal_ip: bool = False,
|
|
636
|
+
use_dns_endpoint: bool = False,
|
|
631
637
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
632
638
|
gcp_conn_id: str = "google_cloud_default",
|
|
633
639
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
634
|
-
regional: bool | None = None,
|
|
635
640
|
on_finish_action: str | None = None,
|
|
636
|
-
is_delete_operator_pod: bool | None = None,
|
|
637
641
|
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
|
|
638
642
|
*args,
|
|
639
643
|
**kwargs,
|
|
640
644
|
) -> None:
|
|
641
|
-
if
|
|
642
|
-
kwargs["on_finish_action"] = (
|
|
643
|
-
OnFinishAction.DELETE_POD if is_delete_operator_pod else OnFinishAction.KEEP_POD
|
|
644
|
-
)
|
|
645
|
-
elif on_finish_action is not None:
|
|
645
|
+
if on_finish_action is not None:
|
|
646
646
|
kwargs["on_finish_action"] = OnFinishAction(on_finish_action)
|
|
647
647
|
else:
|
|
648
|
-
|
|
649
|
-
f"You have not set parameter `on_finish_action` in class {self.__class__.__name__}. "
|
|
650
|
-
"Currently the default for this parameter is `keep_pod` but in a future release"
|
|
651
|
-
" the default will be changed to `delete_pod`. To ensure pods are not deleted in"
|
|
652
|
-
" the future you will need to set `on_finish_action=keep_pod` explicitly.",
|
|
653
|
-
AirflowProviderDeprecationWarning,
|
|
654
|
-
stacklevel=2,
|
|
655
|
-
)
|
|
656
|
-
kwargs["on_finish_action"] = OnFinishAction.KEEP_POD
|
|
657
|
-
|
|
648
|
+
kwargs["on_finish_action"] = OnFinishAction.DELETE_POD
|
|
658
649
|
super().__init__(*args, **kwargs)
|
|
659
650
|
self.project_id = project_id
|
|
660
651
|
self.location = location
|
|
661
652
|
self.cluster_name = cluster_name
|
|
662
653
|
self.gcp_conn_id = gcp_conn_id
|
|
663
654
|
self.use_internal_ip = use_internal_ip
|
|
655
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
664
656
|
self.impersonation_chain = impersonation_chain
|
|
665
|
-
self._regional = regional
|
|
666
|
-
if is_delete_operator_pod is not None:
|
|
667
|
-
self.is_delete_operator_pod = is_delete_operator_pod
|
|
668
657
|
self.deferrable = deferrable
|
|
669
658
|
|
|
670
659
|
# There is no need to manage the kube_config file, as it will be generated automatically.
|
|
@@ -672,42 +661,6 @@ class GKEStartPodOperator(GKEOperatorMixin, KubernetesPodOperator):
|
|
|
672
661
|
if self.config_file:
|
|
673
662
|
raise AirflowException("config_file is not an allowed parameter for the GKEStartPodOperator.")
|
|
674
663
|
|
|
675
|
-
@property
|
|
676
|
-
@deprecated(
|
|
677
|
-
planned_removal_date="May 01, 2025",
|
|
678
|
-
use_instead="on_finish_action",
|
|
679
|
-
category=AirflowProviderDeprecationWarning,
|
|
680
|
-
)
|
|
681
|
-
def is_delete_operator_pod(self) -> bool | None:
|
|
682
|
-
return self._is_delete_operator_pod
|
|
683
|
-
|
|
684
|
-
@is_delete_operator_pod.setter
|
|
685
|
-
@deprecated(
|
|
686
|
-
planned_removal_date="May 01, 2025",
|
|
687
|
-
use_instead="on_finish_action",
|
|
688
|
-
category=AirflowProviderDeprecationWarning,
|
|
689
|
-
)
|
|
690
|
-
def is_delete_operator_pod(self, is_delete_operator_pod) -> None:
|
|
691
|
-
self._is_delete_operator_pod = is_delete_operator_pod
|
|
692
|
-
|
|
693
|
-
@property
|
|
694
|
-
@deprecated(
|
|
695
|
-
planned_removal_date="May 01, 2025",
|
|
696
|
-
reason="The parameter is not in actual use.",
|
|
697
|
-
category=AirflowProviderDeprecationWarning,
|
|
698
|
-
)
|
|
699
|
-
def regional(self) -> bool | None:
|
|
700
|
-
return self._regional
|
|
701
|
-
|
|
702
|
-
@regional.setter
|
|
703
|
-
@deprecated(
|
|
704
|
-
planned_removal_date="May 01, 2025",
|
|
705
|
-
reason="The parameter is not in actual use.",
|
|
706
|
-
category=AirflowProviderDeprecationWarning,
|
|
707
|
-
)
|
|
708
|
-
def regional(self, regional) -> None:
|
|
709
|
-
self._regional = regional
|
|
710
|
-
|
|
711
664
|
def invoke_defer_method(self, last_log_time: DateTime | None = None):
|
|
712
665
|
"""Redefine triggers which are being used in child classes."""
|
|
713
666
|
trigger_start_time = utcnow()
|
|
@@ -760,6 +713,7 @@ class GKEStartJobOperator(GKEOperatorMixin, KubernetesJobOperator):
|
|
|
760
713
|
cluster resides, e.g. 'us-central1-a'
|
|
761
714
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
762
715
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
716
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
763
717
|
:param project_id: The Google Developers Console project id
|
|
764
718
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
765
719
|
users to specify a service account.
|
|
@@ -788,6 +742,7 @@ class GKEStartJobOperator(GKEOperatorMixin, KubernetesJobOperator):
|
|
|
788
742
|
location: str,
|
|
789
743
|
cluster_name: str,
|
|
790
744
|
use_internal_ip: bool = False,
|
|
745
|
+
use_dns_endpoint: bool = False,
|
|
791
746
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
792
747
|
gcp_conn_id: str = "google_cloud_default",
|
|
793
748
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
@@ -804,6 +759,7 @@ class GKEStartJobOperator(GKEOperatorMixin, KubernetesJobOperator):
|
|
|
804
759
|
self.cluster_name = cluster_name
|
|
805
760
|
self.gcp_conn_id = gcp_conn_id
|
|
806
761
|
self.use_internal_ip = use_internal_ip
|
|
762
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
807
763
|
self.impersonation_chain = impersonation_chain
|
|
808
764
|
|
|
809
765
|
# There is no need to manage the kube_config file, as it will be generated automatically.
|
|
@@ -831,10 +787,10 @@ class GKEStartJobOperator(GKEOperatorMixin, KubernetesJobOperator):
|
|
|
831
787
|
trigger=GKEJobTrigger(
|
|
832
788
|
cluster_url=self.cluster_url,
|
|
833
789
|
ssl_ca_cert=self.ssl_ca_cert,
|
|
834
|
-
job_name=self.job.metadata.name,
|
|
835
|
-
job_namespace=self.job.metadata.namespace,
|
|
836
|
-
|
|
837
|
-
pod_namespace=self.
|
|
790
|
+
job_name=self.job.metadata.name,
|
|
791
|
+
job_namespace=self.job.metadata.namespace,
|
|
792
|
+
pod_names=[pod.metadata.name for pod in self.pods],
|
|
793
|
+
pod_namespace=self.pods[0].metadata.namespace,
|
|
838
794
|
base_container_name=self.base_container_name,
|
|
839
795
|
gcp_conn_id=self.gcp_conn_id,
|
|
840
796
|
poll_interval=self.job_poll_interval,
|
|
@@ -860,6 +816,7 @@ class GKEDescribeJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
860
816
|
cluster resides, e.g. 'us-central1-a'
|
|
861
817
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
862
818
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
819
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
863
820
|
:param project_id: The Google Developers Console project id
|
|
864
821
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
865
822
|
users to specify a service account.
|
|
@@ -883,6 +840,7 @@ class GKEDescribeJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
883
840
|
location: str,
|
|
884
841
|
cluster_name: str,
|
|
885
842
|
use_internal_ip: bool = False,
|
|
843
|
+
use_dns_endpoint: bool = False,
|
|
886
844
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
887
845
|
gcp_conn_id: str = "google_cloud_default",
|
|
888
846
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
@@ -898,6 +856,7 @@ class GKEDescribeJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
898
856
|
self.cluster_name = cluster_name
|
|
899
857
|
self.gcp_conn_id = gcp_conn_id
|
|
900
858
|
self.use_internal_ip = use_internal_ip
|
|
859
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
901
860
|
self.impersonation_chain = impersonation_chain
|
|
902
861
|
self.job: V1Job | None = None
|
|
903
862
|
|
|
@@ -909,7 +868,14 @@ class GKEDescribeJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
909
868
|
self.cluster_name,
|
|
910
869
|
self.job,
|
|
911
870
|
)
|
|
912
|
-
KubernetesEngineJobLink.persist(
|
|
871
|
+
KubernetesEngineJobLink.persist(
|
|
872
|
+
context=context,
|
|
873
|
+
location=self.location,
|
|
874
|
+
cluster_name=self.cluster_name,
|
|
875
|
+
namespace=self.job.metadata.namespace,
|
|
876
|
+
job_name=self.job.metadata.name,
|
|
877
|
+
project_id=self.project_id,
|
|
878
|
+
)
|
|
913
879
|
return None
|
|
914
880
|
|
|
915
881
|
|
|
@@ -928,6 +894,7 @@ class GKEListJobsOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
928
894
|
cluster resides, e.g. 'us-central1-a'
|
|
929
895
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
930
896
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
897
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
931
898
|
:param project_id: The Google Developers Console project id
|
|
932
899
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
933
900
|
users to specify a service account.
|
|
@@ -951,6 +918,7 @@ class GKEListJobsOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
951
918
|
location: str,
|
|
952
919
|
cluster_name: str,
|
|
953
920
|
use_internal_ip: bool = False,
|
|
921
|
+
use_dns_endpoint: bool = False,
|
|
954
922
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
955
923
|
gcp_conn_id: str = "google_cloud_default",
|
|
956
924
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
@@ -966,10 +934,20 @@ class GKEListJobsOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
966
934
|
self.cluster_name = cluster_name
|
|
967
935
|
self.gcp_conn_id = gcp_conn_id
|
|
968
936
|
self.use_internal_ip = use_internal_ip
|
|
937
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
969
938
|
self.impersonation_chain = impersonation_chain
|
|
970
939
|
self.namespace = namespace
|
|
971
940
|
self.do_xcom_push = do_xcom_push
|
|
972
941
|
|
|
942
|
+
@property
|
|
943
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
944
|
+
return {
|
|
945
|
+
"location": self.location,
|
|
946
|
+
"cluster_name": self.cluster_name,
|
|
947
|
+
"namespace": self.namespace,
|
|
948
|
+
"project_id": self.project_id,
|
|
949
|
+
}
|
|
950
|
+
|
|
973
951
|
def execute(self, context: Context) -> dict:
|
|
974
952
|
if self.namespace:
|
|
975
953
|
jobs = self.hook.list_jobs_from_namespace(namespace=self.namespace)
|
|
@@ -980,7 +958,7 @@ class GKEListJobsOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
980
958
|
if self.do_xcom_push:
|
|
981
959
|
ti = context["ti"]
|
|
982
960
|
ti.xcom_push(key="jobs_list", value=V1JobList.to_dict(jobs))
|
|
983
|
-
KubernetesEngineWorkloadsLink.persist(context=context
|
|
961
|
+
KubernetesEngineWorkloadsLink.persist(context=context)
|
|
984
962
|
return V1JobList.to_dict(jobs)
|
|
985
963
|
|
|
986
964
|
|
|
@@ -1003,6 +981,7 @@ class GKECreateCustomResourceOperator(GKEOperatorMixin, KubernetesCreateResource
|
|
|
1003
981
|
cluster resides, e.g. 'us-central1-a'
|
|
1004
982
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
1005
983
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
984
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
1006
985
|
:param project_id: The Google Developers Console project id
|
|
1007
986
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
1008
987
|
users to specify a service account.
|
|
@@ -1025,6 +1004,7 @@ class GKECreateCustomResourceOperator(GKEOperatorMixin, KubernetesCreateResource
|
|
|
1025
1004
|
location: str,
|
|
1026
1005
|
cluster_name: str,
|
|
1027
1006
|
use_internal_ip: bool = False,
|
|
1007
|
+
use_dns_endpoint: bool = False,
|
|
1028
1008
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
1029
1009
|
gcp_conn_id: str = "google_cloud_default",
|
|
1030
1010
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
@@ -1038,6 +1018,7 @@ class GKECreateCustomResourceOperator(GKEOperatorMixin, KubernetesCreateResource
|
|
|
1038
1018
|
self.cluster_name = cluster_name
|
|
1039
1019
|
self.gcp_conn_id = gcp_conn_id
|
|
1040
1020
|
self.use_internal_ip = use_internal_ip
|
|
1021
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
1041
1022
|
self.impersonation_chain = impersonation_chain
|
|
1042
1023
|
|
|
1043
1024
|
if self.gcp_conn_id is None:
|
|
@@ -1073,6 +1054,7 @@ class GKEDeleteCustomResourceOperator(GKEOperatorMixin, KubernetesDeleteResource
|
|
|
1073
1054
|
cluster resides, e.g. 'us-central1-a'
|
|
1074
1055
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
1075
1056
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
1057
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
1076
1058
|
:param project_id: The Google Developers Console project id
|
|
1077
1059
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
1078
1060
|
users to specify a service account.
|
|
@@ -1095,6 +1077,7 @@ class GKEDeleteCustomResourceOperator(GKEOperatorMixin, KubernetesDeleteResource
|
|
|
1095
1077
|
location: str,
|
|
1096
1078
|
cluster_name: str,
|
|
1097
1079
|
use_internal_ip: bool = False,
|
|
1080
|
+
use_dns_endpoint: bool = False,
|
|
1098
1081
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
1099
1082
|
gcp_conn_id: str = "google_cloud_default",
|
|
1100
1083
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
@@ -1108,6 +1091,7 @@ class GKEDeleteCustomResourceOperator(GKEOperatorMixin, KubernetesDeleteResource
|
|
|
1108
1091
|
self.cluster_name = cluster_name
|
|
1109
1092
|
self.gcp_conn_id = gcp_conn_id
|
|
1110
1093
|
self.use_internal_ip = use_internal_ip
|
|
1094
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
1111
1095
|
self.impersonation_chain = impersonation_chain
|
|
1112
1096
|
|
|
1113
1097
|
if self.gcp_conn_id is None:
|
|
@@ -1132,6 +1116,7 @@ class GKEStartKueueJobOperator(GKEOperatorMixin, KubernetesStartKueueJobOperator
|
|
|
1132
1116
|
cluster resides, e.g. 'us-central1-a'
|
|
1133
1117
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
1134
1118
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
1119
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
1135
1120
|
:param project_id: The Google Developers Console project id
|
|
1136
1121
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
1137
1122
|
users to specify a service account.
|
|
@@ -1154,6 +1139,7 @@ class GKEStartKueueJobOperator(GKEOperatorMixin, KubernetesStartKueueJobOperator
|
|
|
1154
1139
|
location: str,
|
|
1155
1140
|
cluster_name: str,
|
|
1156
1141
|
use_internal_ip: bool = False,
|
|
1142
|
+
use_dns_endpoint: bool = False,
|
|
1157
1143
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
1158
1144
|
gcp_conn_id: str = "google_cloud_default",
|
|
1159
1145
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
@@ -1166,6 +1152,7 @@ class GKEStartKueueJobOperator(GKEOperatorMixin, KubernetesStartKueueJobOperator
|
|
|
1166
1152
|
self.cluster_name = cluster_name
|
|
1167
1153
|
self.gcp_conn_id = gcp_conn_id
|
|
1168
1154
|
self.use_internal_ip = use_internal_ip
|
|
1155
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
1169
1156
|
self.impersonation_chain = impersonation_chain
|
|
1170
1157
|
|
|
1171
1158
|
|
|
@@ -1192,6 +1179,7 @@ class GKEDeleteJobOperator(GKEOperatorMixin, KubernetesDeleteJobOperator):
|
|
|
1192
1179
|
cluster resides, e.g. 'us-central1-a'
|
|
1193
1180
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
1194
1181
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
1182
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
1195
1183
|
:param project_id: The Google Developers Console project id
|
|
1196
1184
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
1197
1185
|
users to specify a service account.
|
|
@@ -1214,6 +1202,7 @@ class GKEDeleteJobOperator(GKEOperatorMixin, KubernetesDeleteJobOperator):
|
|
|
1214
1202
|
location: str,
|
|
1215
1203
|
cluster_name: str,
|
|
1216
1204
|
use_internal_ip: bool = False,
|
|
1205
|
+
use_dns_endpoint: bool = False,
|
|
1217
1206
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
1218
1207
|
gcp_conn_id: str = "google_cloud_default",
|
|
1219
1208
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
@@ -1227,6 +1216,7 @@ class GKEDeleteJobOperator(GKEOperatorMixin, KubernetesDeleteJobOperator):
|
|
|
1227
1216
|
self.cluster_name = cluster_name
|
|
1228
1217
|
self.gcp_conn_id = gcp_conn_id
|
|
1229
1218
|
self.use_internal_ip = use_internal_ip
|
|
1219
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
1230
1220
|
self.impersonation_chain = impersonation_chain
|
|
1231
1221
|
|
|
1232
1222
|
if self.gcp_conn_id is None:
|
|
@@ -1255,6 +1245,7 @@ class GKESuspendJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
1255
1245
|
cluster resides, e.g. 'us-central1-a'
|
|
1256
1246
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
1257
1247
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
1248
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
1258
1249
|
:param project_id: The Google Developers Console project id
|
|
1259
1250
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
1260
1251
|
users to specify a service account.
|
|
@@ -1278,6 +1269,7 @@ class GKESuspendJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
1278
1269
|
location: str,
|
|
1279
1270
|
cluster_name: str,
|
|
1280
1271
|
use_internal_ip: bool = False,
|
|
1272
|
+
use_dns_endpoint: bool = False,
|
|
1281
1273
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
1282
1274
|
gcp_conn_id: str = "google_cloud_default",
|
|
1283
1275
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
@@ -1293,6 +1285,7 @@ class GKESuspendJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
1293
1285
|
self.cluster_name = cluster_name
|
|
1294
1286
|
self.gcp_conn_id = gcp_conn_id
|
|
1295
1287
|
self.use_internal_ip = use_internal_ip
|
|
1288
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
1296
1289
|
self.impersonation_chain = impersonation_chain
|
|
1297
1290
|
self.job: V1Job | None = None
|
|
1298
1291
|
|
|
@@ -1307,8 +1300,14 @@ class GKESuspendJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
1307
1300
|
self.name,
|
|
1308
1301
|
self.cluster_name,
|
|
1309
1302
|
)
|
|
1310
|
-
KubernetesEngineJobLink.persist(
|
|
1311
|
-
|
|
1303
|
+
KubernetesEngineJobLink.persist(
|
|
1304
|
+
context=context,
|
|
1305
|
+
location=self.location,
|
|
1306
|
+
cluster_name=self.cluster_name,
|
|
1307
|
+
namespace=self.job.metadata.namespace,
|
|
1308
|
+
job_name=self.job.metadata.name,
|
|
1309
|
+
project_id=self.project_id,
|
|
1310
|
+
)
|
|
1312
1311
|
return k8s.V1Job.to_dict(self.job)
|
|
1313
1312
|
|
|
1314
1313
|
|
|
@@ -1326,6 +1325,7 @@ class GKEResumeJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
1326
1325
|
cluster resides, e.g. 'us-central1-a'
|
|
1327
1326
|
:param cluster_name: The name of the Google Kubernetes Engine cluster.
|
|
1328
1327
|
:param use_internal_ip: Use the internal IP address as the endpoint.
|
|
1328
|
+
:param use_dns_endpoint: Use the DNS address as the endpoint.
|
|
1329
1329
|
:param project_id: The Google Developers Console project id
|
|
1330
1330
|
:param gcp_conn_id: The Google cloud connection id to use. This allows for
|
|
1331
1331
|
users to specify a service account.
|
|
@@ -1349,6 +1349,7 @@ class GKEResumeJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
1349
1349
|
location: str,
|
|
1350
1350
|
cluster_name: str,
|
|
1351
1351
|
use_internal_ip: bool = False,
|
|
1352
|
+
use_dns_endpoint: bool = False,
|
|
1352
1353
|
project_id: str = PROVIDE_PROJECT_ID,
|
|
1353
1354
|
gcp_conn_id: str = "google_cloud_default",
|
|
1354
1355
|
impersonation_chain: str | Sequence[str] | None = None,
|
|
@@ -1364,6 +1365,7 @@ class GKEResumeJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
1364
1365
|
self.cluster_name = cluster_name
|
|
1365
1366
|
self.gcp_conn_id = gcp_conn_id
|
|
1366
1367
|
self.use_internal_ip = use_internal_ip
|
|
1368
|
+
self.use_dns_endpoint = use_dns_endpoint
|
|
1367
1369
|
self.impersonation_chain = impersonation_chain
|
|
1368
1370
|
self.job: V1Job | None = None
|
|
1369
1371
|
|
|
@@ -1378,6 +1380,13 @@ class GKEResumeJobOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
|
1378
1380
|
self.name,
|
|
1379
1381
|
self.cluster_name,
|
|
1380
1382
|
)
|
|
1381
|
-
KubernetesEngineJobLink.persist(
|
|
1383
|
+
KubernetesEngineJobLink.persist(
|
|
1384
|
+
context=context,
|
|
1385
|
+
location=self.location,
|
|
1386
|
+
cluster_name=self.cluster_name,
|
|
1387
|
+
namespace=self.job.metadata.namespace,
|
|
1388
|
+
job_name=self.job.metadata.name,
|
|
1389
|
+
project_id=self.project_id,
|
|
1390
|
+
)
|
|
1382
1391
|
|
|
1383
1392
|
return k8s.V1Job.to_dict(self.job)
|
|
@@ -26,7 +26,7 @@ from airflow.providers.google.cloud.hooks.looker import LookerHook
|
|
|
26
26
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
|
27
27
|
|
|
28
28
|
if TYPE_CHECKING:
|
|
29
|
-
from airflow.
|
|
29
|
+
from airflow.providers.common.compat.sdk import Context
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class LookerStartPdtBuildOperator(GoogleCloudBaseOperator):
|