mik-laj commented on a change in pull request #10453:
URL: https://github.com/apache/airflow/pull/10453#discussion_r487793397



##########
File path: airflow/providers/cncf/kubernetes/hooks/kubernetes.py
##########
@@ -36,32 +36,73 @@ class KubernetesHook(BaseHook):
     """
     Creates Kubernetes API connection.
 
+    - use in cluster configuration by using ``extra__kubernetes__in_cluster`` 
in connection
+    - use custom config by providing path to the file using 
``extra__kubernetes__kube_config_path``
+    - use custom configuration by providing content of kubeconfig file via
+        ``extra__kubernetes__kube_config`` in connection
+    - use default config by providing no extras
+
+    This hook check for configuration option in the above order. Once an 
option is present it will
+    use this configuration.
+
+    .. 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
-        if extras.get("extra__kubernetes__in_cluster"):
+        in_cluster = extras.get("extra__kubernetes__in_cluster")
+        kubeconfig_path = extras.get("extra__kubernetes__kube_config_path")
+        kubeconfig = extras.get("extra__kubernetes__kube_config")
+        num_selected_configuration = (
+            int(bool(kubeconfig_path)) + int(bool(kubeconfig)) + 
int(bool(in_cluster))
+        )

Review comment:
       It also works for me if the behavior is similar.




----------------------------------------------------------------
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]


Reply via email to