hussein-awala commented on code in PR #31187:
URL: https://github.com/apache/airflow/pull/31187#discussion_r1190360911


##########
airflow/providers/cncf/kubernetes/hooks/kubernetes.py:
##########
@@ -141,6 +142,22 @@ def _coalesce_param(*params):
             if param is not None:
                 return param
 
+    @classmethod
+    def get_connection(cls, conn_id: str) -> Connection:
+        """
+        Return requested connection.
+
+        If missing and conn_id is "kubernetes_default", will return empty 
connection so that hook will
+        default to cluster-derived credentials.
+        """
+        try:
+            return super().get_connection(conn_id)
+        except AirflowNotFoundException:
+            if conn_id == cls.default_conn_name:
+                return Connection(conn_id=cls.default_conn_name)
+            else:
+                raise

Review Comment:
   IMO we should raise the active exception with the original stack trace
   ```suggestion
                   raise
   ```
   



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to