Skip to content

Commit

Permalink
Merge branch 'main' into 42559/aip-84/delete-connection-to-fast-api
Browse files Browse the repository at this point in the history
  • Loading branch information
bugraoz93 authored Sep 30, 2024
2 parents a02bfba + 6808619 commit c5e598b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions airflow/providers/cncf/kubernetes/hooks/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ def get_conn(self) -> client.ApiClient:
if kubeconfig is not None:
with tempfile.NamedTemporaryFile() as temp_config:
self.log.debug("loading kube_config from: connection kube_config")
if isinstance(kubeconfig, dict):
kubeconfig = json.dumps(kubeconfig)
temp_config.write(kubeconfig.encode())
temp_config.flush()
self._is_in_cluster = False
Expand Down
2 changes: 2 additions & 0 deletions tests/providers/cncf/kubernetes/hooks/test_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def setup_class(cls) -> None:
("in_cluster", {"in_cluster": True}),
("in_cluster_empty", {"in_cluster": ""}),
("kube_config", {"kube_config": '{"test": "kube"}'}),
("kube_config_dict", {"kube_config": {"test": "kube"}}),
("kube_config_path", {"kube_config_path": "path/to/file"}),
("kube_config_empty", {"kube_config": ""}),
("kube_config_path_empty", {"kube_config_path": ""}),
Expand Down Expand Up @@ -285,6 +286,7 @@ def test_kube_config_path(
(
(None, False),
("kube_config", True),
("kube_config_dict", True),
("kube_config_empty", False),
),
)
Expand Down

0 comments on commit c5e598b

Please sign in to comment.