|
13 | 13 | from typing import Optional, Any, Dict, List
|
14 | 14 |
|
15 | 15 | import kubernetes
|
16 |
| -from kubernetes import config, client |
| 16 | +from kubernetes import client |
17 | 17 | from kubernetes.dynamic import DynamicClient, ResourceInstance
|
18 | 18 | import yaml
|
19 | 19 | from benedict import benedict
|
@@ -79,7 +79,11 @@ def _get_api_version(dyn_client: DynamicClient, api_group: str, kind: str) -> st
|
79 | 79 |
|
80 | 80 |
|
81 | 81 | def get_client(
|
82 |
| - config_file: str = "", config_dict: Dict[str, Any] | None = None, context: str = "", proxy: str = "", **kwargs: Any |
| 82 | + config_file: str = "", |
| 83 | + config_dict: Dict[str, Any] | None = None, |
| 84 | + context: str = "", |
| 85 | + proxy: Optional[str] = "", |
| 86 | + **kwargs: Any, |
83 | 87 | ) -> DynamicClient:
|
84 | 88 | """
|
85 | 89 | Get a kubernetes client.
|
@@ -124,7 +128,9 @@ def get_client(
|
124 | 128 | LOGGER.info("Trying to get client via new_client_from_config")
|
125 | 129 |
|
126 | 130 | return kubernetes.dynamic.DynamicClient(
|
127 |
| - client=kubernetes.config.new_client_from_config(config_file=config_file, client_configuration=client_configuration, context=context or None, **kwargs) |
| 131 | + client=kubernetes.config.new_client_from_config( |
| 132 | + config_file=config_file, client_configuration=client_configuration, context=context or None, **kwargs |
| 133 | + ) |
128 | 134 | )
|
129 | 135 | except MaxRetryError:
|
130 | 136 | # Ref: https://github.com/kubernetes-client/python/blob/v26.1.0/kubernetes/base/config/incluster_config.py
|
|
0 commit comments