File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,14 @@ def get_client(
107
107
Returns:
108
108
DynamicClient: a kubernetes client.
109
109
"""
110
+ proxy = os .environ .get ("HTTPS_PROXY" ) or os .environ .get ("HTTP_PROXY" )
111
+
112
+ client_configuration = client_configuration or kubernetes .client .Configuration ()
113
+
114
+ if not client_configuration .proxy and proxy :
115
+ LOGGER .info (f"Setting proxy from environment variable: { proxy } " )
116
+ client_configuration .proxy = proxy
117
+
110
118
# Ref: https://github.com/kubernetes-client/python/blob/v26.1.0/kubernetes/base/config/kube_config.py
111
119
if config_dict :
112
120
_client = kubernetes .config .new_client_from_config_dict (
@@ -132,12 +140,6 @@ def get_client(
132
140
persist_config = persist_config ,
133
141
)
134
142
135
- proxy = os .environ .get ("HTTPS_PROXY" ) or os .environ .get ("HTTP_PROXY" )
136
-
137
- if not _client .configuration .proxy and proxy :
138
- LOGGER .info (f"Setting proxy from environment variable: { proxy } " )
139
- _client .configuration .proxy = proxy
140
-
141
143
try :
142
144
return kubernetes .dynamic .DynamicClient (client = _client )
143
145
except MaxRetryError :
You can’t perform that action at this time.
0 commit comments