mik-laj commented on a change in pull request #10453:
URL: https://github.com/apache/airflow/pull/10453#discussion_r487774433
##########
File path: airflow/providers/cncf/kubernetes/hooks/kubernetes.py
##########
@@ -36,32 +36,56 @@ class KubernetesHook(BaseHook):
"""
Creates Kubernetes API connection.
+ - use in cluster configuration by using ``extra__kubernetes__in_cluster``
in connection
+ - use custom configuration either by providing content of kubeconfig file
via
+ ``extra__kubernetes__kube_config`` in connection
+ - use custom config by providing path to the file using
``extra__kubernetes__kube_config_path``
+ - use default config by providing no extras
+
+ .. seealso::
+ For more information about Kubernetes connection:
+ :ref:`howto/connection:kubernetes`
+
:param conn_id: the connection to Kubernetes cluster
:type conn_id: str
"""
- def __init__(self, conn_id: str = "kubernetes_default"):
+ def __init__(
+ self, conn_id: str = "kubernetes_default", client_configuration:
Optional[client.Configuration] = None
+ ):
super().__init__()
self.conn_id = conn_id
+ self.client_configuration = client_configuration
def get_conn(self):
"""
Returns kubernetes api session for use with requests
"""
connection = self.get_connection(self.conn_id)
extras = connection.extra_dejson
+
+ kubeconfig_path = extras.get("extra__kubernetes__kube_config_path")
+ kubeconfig = extras.get("extra__kubernetes__kube_config")
+
if extras.get("extra__kubernetes__in_cluster"):
Review comment:
Can you look at it?
https://github.com/apache/airflow/pull/10453/commits/9d98d1f819c7f8d92c9c655fc87cfc828e295b14
----------------------------------------------------------------
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]