mik-laj commented on a change in pull request #10453:
URL: https://github.com/apache/airflow/pull/10453#discussion_r482849435
##########
File path: airflow/providers/cncf/kubernetes/hooks/kubernetes.py
##########
@@ -60,11 +66,15 @@ def get_conn(self):
self.log.debug("loading kube_config from: default file")
config.load_kube_config()
else:
- with tempfile.NamedTemporaryFile() as temp_config:
- self.log.debug("loading kube_config from: connection
kube_config")
-
temp_config.write(extras.get("extra__kubernetes__kube_config").encode())
- temp_config.flush()
- config.load_kube_config(temp_config.name)
+ path_or_payload = extras.get("extra__kubernetes__kube_config")
+ if not os.path.isfile(path_or_payload):
+ with tempfile.NamedTemporaryFile() as temp_config:
+ self.log.debug("loading kube_config from: connection
kube_config")
+ temp_config.write(path_or_payload.encode())
+ temp_config.flush()
+ config.load_kube_config(temp_config.name)
Review comment:
```suggestion
self.log.debug("loading kube_config from: connection
kube_config")
config.load_kube_config_dict(path_or_payload.encode())
```
----------------------------------------------------------------
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]