blob: 10626043c0086eda9001d0c1b9ef05f6b270583a [file] [log] [blame]
:py:mod:`airflow.providers.google.cloud.hooks.kubernetes_engine`
================================================================
.. py:module:: airflow.providers.google.cloud.hooks.kubernetes_engine
.. autoapi-nested-parse::
This module contains a Google Kubernetes Engine Hook.
.. spelling::
gapic
enums
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.google.cloud.hooks.kubernetes_engine.GKEHook
Attributes
~~~~~~~~~~
.. autoapisummary::
airflow.providers.google.cloud.hooks.kubernetes_engine.OPERATIONAL_POLL_INTERVAL
.. py:data:: OPERATIONAL_POLL_INTERVAL
:annotation: = 15
.. py:class:: GKEHook(gcp_conn_id = 'google_cloud_default', delegate_to = None, location = None, impersonation_chain = None)
Bases: :py:obj:`airflow.providers.google.common.hooks.base_google.GoogleBaseHook`
Hook for Google Kubernetes Engine APIs.
All the methods in the hook where project_id is used must be called with
keyword arguments rather than positional.
.. py:method:: get_cluster_manager_client()
Returns ClusterManagerClient.
.. py:method:: get_conn()
Returns connection for the hook.
.. py:method:: get_client()
.. py:method:: wait_for_operation(operation, project_id = None)
Given an operation, continuously fetches the status from Google Cloud until either
completion or an error occurring
:param operation: The Operation to wait for
:param project_id: Google Cloud project ID
:return: A new, updated operation fetched from Google Cloud
.. py:method:: get_operation(operation_name, project_id = None)
Fetches the operation from Google Cloud
:param operation_name: Name of operation to fetch
:param project_id: Google Cloud project ID
:return: The new, updated operation from Google Cloud
.. py:method:: delete_cluster(name, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None)
Deletes the cluster, including the Kubernetes endpoint and all
worker nodes. Firewalls and routes that were configured during
cluster creation are also deleted. Other Google Compute Engine
resources that might be in use by the cluster (e.g. load balancer
resources) will not be deleted if they were not present at the
initial create time.
:param name: The name of the cluster to delete
:param project_id: Google Cloud project ID
:param retry: Retry object used to determine when/if to retry requests.
If None is specified, requests will not be retried.
:param timeout: The amount of time, in seconds, to wait for the request to
complete. Note that if retry is specified, the timeout applies to each
individual attempt.
:return: The full url to the delete operation if successful, else None
.. py:method:: create_cluster(cluster, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None)
Creates a cluster, consisting of the specified number and type of Google Compute
Engine instances.
:param cluster: A Cluster protobuf or dict. If dict is provided, it must
be of the same form as the protobuf message
:class:`google.cloud.container_v1.types.Cluster`
:param project_id: Google Cloud project ID
:param retry: A retry object (``google.api_core.retry.Retry``) used to
retry requests.
If None is specified, requests will not be retried.
:param timeout: The amount of time, in seconds, to wait for the request to
complete. Note that if retry is specified, the timeout applies to each
individual attempt.
:return: The full url to the new, or existing, cluster
:raises:
ParseError: On JSON parsing problems when trying to convert dict
AirflowException: cluster is not dict type nor Cluster proto type
.. py:method:: get_cluster(name, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None)
Gets details of specified cluster
:param name: The name of the cluster to retrieve
:param project_id: Google Cloud project ID
:param retry: A retry object used to retry requests. If None is specified,
requests will not be retried.
:param timeout: The amount of time, in seconds, to wait for the request to
complete. Note that if retry is specified, the timeout applies to each
individual attempt.
:return: google.cloud.container_v1.types.Cluster