jedcunningham commented on a change in pull request #20578:
URL: https://github.com/apache/airflow/pull/20578#discussion_r777288232
##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -348,15 +351,17 @@ def launcher(self) -> pod_launcher.PodLauncher:
return pod_launcher.PodLauncher(kube_client=self.client)
@cached_property
- def client(self) -> CoreV1Api:
- # todo: use airflow Connection / hook to authenticate to the cluster
- kwargs: Dict[str, Any] = dict(
+ def k8s_hook(self):
Review comment:
```suggestion
def hook(self):
```
nit, for consistency with other operators?
##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -348,15 +351,17 @@ def launcher(self) -> pod_launcher.PodLauncher:
return pod_launcher.PodLauncher(kube_client=self.client)
@cached_property
- def client(self) -> CoreV1Api:
- # todo: use airflow Connection / hook to authenticate to the cluster
- kwargs: Dict[str, Any] = dict(
+ def k8s_hook(self):
+ return KubernetesHook(
+ conn_id=self.kubernetes_conn_id,
cluster_context=self.cluster_context,
config_file=self.config_file,
+ in_cluster=self.in_cluster,
)
- if self.in_cluster is not None:
- kwargs.update(in_cluster=self.in_cluster)
- return kube_client.get_kube_client(**kwargs)
+
+ @cached_property
+ def client(self) -> CoreV1Api:
+ return self.k8s_hook.core_v1_client
Review comment:
```suggestion
return self.hook.core_v1_client
```
--
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]