amoghrajesh commented on code in PR #29809:
URL: https://github.com/apache/airflow/pull/29809#discussion_r1128406711
##########
airflow/kubernetes/kube_client.py:
##########
@@ -105,16 +107,28 @@ def get_kube_client(
if conf.getboolean("kubernetes_executor", "enable_tcp_keepalive"):
_enable_tcp_keepalive()
+ new_client_config = Configuration.get_default_copy()
+ api_client_retry_configuration = conf.getjson("kubernetes",
"api_client_retry_configuration", fallback={})
+
+ if not conf.getboolean("kubernetes_executor", "verify_ssl"):
+ _disable_verify_ssl()
+
+ if isinstance(api_client_retry_configuration, dict) and
api_client_retry_configuration != {}:
+ new_client_config.retries =
urllib3.util.Retry(**api_client_retry_configuration)
+ elif isinstance(api_client_retry_configuration, dict) and
api_client_retry_configuration == {}:
+ pass
Review Comment:
@hussein-awala without these changes, we cannot get the VC working. Should I
revert back this portion?
```
FAILED [100%]
tests/kubernetes/test_client.py:42 (TestClient.test_load_config_disable_ssl)
self = <tests.kubernetes.test_client.TestClient object at 0x10c1b2280>
conf = <MagicMock name='conf' id='4500751600'>
config = <MagicMock name='config' id='4500993264'>
@mock.patch("airflow.kubernetes.kube_client.config")
@mock.patch("airflow.kubernetes.kube_client.conf")
def test_load_config_disable_ssl(self, conf, config):
conf.getboolean.return_value = False
> get_kube_client(in_cluster=False)
test_client.py:47:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
in_cluster = False, cluster_context = None, config_file = None
def get_kube_client(
in_cluster: bool = conf.getboolean("kubernetes_executor",
"in_cluster"),
cluster_context: str | None = None,
config_file: str | None = None,
) -> client.CoreV1Api:
"""
Retrieves Kubernetes client.
:param in_cluster: whether we are in cluster
:param cluster_context: context of the cluster
:param config_file: configuration file
:return kubernetes client
:rtype client.CoreV1Api
"""
if not has_kubernetes:
raise _import_err
if conf.getboolean("kubernetes_executor", "enable_tcp_keepalive"):
_enable_tcp_keepalive()
new_client_config = Configuration.get_default_copy()
api_client_retry_configuration = conf.getjson("kubernetes",
"api_client_retry_configuration", fallback={})
if not conf.getboolean("kubernetes_executor", "verify_ssl"):
_disable_verify_ssl()
if isinstance(api_client_retry_configuration, dict):
new_client_config.retries =
urllib3.util.Retry(**api_client_retry_configuration)
else:
> raise ValueError("api_client_retry_configuration should be a
dictionary")
E ValueError: api_client_retry_configuration should be a dictionary
../../airflow/kubernetes/kube_client.py:119: ValueError
```
--
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]