Commit 473a7d0
Add proxy support to Kubernetes client configuration in get_client (#2291)
* Add proxy support to Kubernetes client configuration in get_client
This update modifies the get_client function to support
setting a proxy for the Kubernetes client configuration.
The client_configuration argument is introduced to allow
passing a client.Configuration object directly, and if not
provided, it defaults to creating a new configuration instance.
Additionally, if the HTTPS_PROXY or HTTP_PROXY environment
variables are set, the proxy is applied to the Kubernetes
client configuration.
This enhancement enables easier integration of Kubernetes
client setup when working behind a proxy.
Signed-off-by: Shahaf Bahar <[email protected]>
* Simplify docstring by removing redundant default value explanation
* Update proxy configuration logic and README documentation
* Simplify use_proxy docstring in get_client method
* Add support for enabling proxy with use_proxy flag
* Remove client_configuration from get_client and initialize only for proxy usage
Signed-off-by: Shahaf Bahar <[email protected]>
* Refactor proxy handling in get_client function
* Refactor docstring to clarify proxy behavior
* Simplify proxy configuration logic in get_client
* Improve error message for missing proxy configuration in get_client
* Remove redundant dot in README
* Remove unnecessary check for client_configuration in get_client
* Update README to clarify proxy enablement instructions
* Clarify proxy enablement in README
* Clarify use_proxy argument type in README
* Retrieve client_configuration from kwargs if provided
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Ensure environment variable overrides use_proxy
* Remove redundant proxy configuration log
* Preserve client_configuration from kwargs when setting proxy
* Update docstring to clarify proxy conf behavior with env var
* Refactor proxy configuration logic for clarity
* Update README with proxy enablement details
* Refactor client_configuration retrieval in get_client
* Refactor proxy configuration in get_client for improved clarity
* Refactor use_proxy argument in get_client to support None as default value
* Remove use_proxy argument from get_client and update README
* Ensure proxy settings are always applied when enabled
* Check for proxy conflicts in client_configuration and environment variable
* Add test to verify proxy conflict raises ValueError for mismatched proxy settings
* Refactor test for proxy conflict in get_client method
Signed-off-by: Shahaf Bahar <[email protected]>
* Refactor test for proxy conflict to use pytest.raises match exp
* Add test for proxy enabled without proxy env variables set
---------
Signed-off-by: Shahaf Bahar <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent 9538cf1 commit 473a7d0
3 files changed
+67
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
96 | 113 | | |
97 | 114 | | |
98 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
80 | 83 | | |
81 | 84 | | |
82 | 85 | | |
| |||
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
| 110 | + | |
107 | 111 | | |
108 | 112 | | |
109 | 113 | | |
| |||
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
115 | 133 | | |
116 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
117 | 140 | | |
118 | 141 | | |
119 | 142 | | |
120 | 143 | | |
121 | 144 | | |
122 | 145 | | |
123 | | - | |
| 146 | + | |
124 | 147 | | |
125 | 148 | | |
126 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
0 commit comments