Skip to content

Commit 500ee4f

Browse files
committed
Refactor function argument to use configuration object
Signed-off-by: Shahaf Bahar <[email protected]>
1 parent 3109d00 commit 500ee4f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ocp_resources/resource.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def _get_api_version(dyn_client: DynamicClient, api_group: str, kind: str) -> st
8181
def get_client(
8282
config_file: str = "",
8383
config_dict: Dict[str, Any] | None = None,
84+
client_configuration: client.Configuration | None = None,
8485
context: str = "",
85-
proxy: Optional[str] = "",
8686
**kwargs: Any,
8787
) -> DynamicClient:
8888
"""
@@ -99,8 +99,8 @@ def get_client(
9999
Args:
100100
config_file (str): path to a kubeconfig file.
101101
config_dict (dict): dict with kubeconfig configuration.
102+
client_configuration: The kubernetes.client.Configuration to set configs to.
102103
context (str): name of the context to use.
103-
proxy (str): the URL to the proxy to be used for all requests made by this client.
104104
105105
Returns:
106106
DynamicClient: a kubernetes client.
@@ -117,8 +117,8 @@ def get_client(
117117
# If `KUBECONFIG` environment variable is set via code, the `KUBE_CONFIG_DEFAULT_LOCATION` will be None since
118118
# is populated during import which comes before setting the variable in code.
119119
config_file = config_file or os.environ.get("KUBECONFIG", "~/.kube/config")
120-
proxy = proxy or os.environ.get("HTTPS_PROXY") or os.environ.get("HTTP_PROXY")
121-
client_configuration = client.Configuration()
120+
client_configuration = client_configuration or client.Configuration()
121+
proxy = os.environ.get("HTTPS_PROXY") or os.environ.get("HTTP_PROXY")
122122

123123
if proxy:
124124
LOGGER.info(f"Trying to get client using proxy {proxy}")

0 commit comments

Comments
 (0)