Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions kubernetes/client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,17 @@ def __init__(self, host="http://localhost",
"""

self.proxy = None
"""Proxy URL
"""
self.no_proxy = None
# Load proxy from environment variables (if set)
if os.getenv("HTTPS_PROXY"): self.proxy = os.getenv("HTTPS_PROXY")
if os.getenv("https_proxy"): self.proxy = os.getenv("https_proxy")
if os.getenv("HTTP_PROXY"): self.proxy = os.getenv("HTTP_PROXY")
if os.getenv("http_proxy"): self.proxy = os.getenv("http_proxy")
self.no_proxy = None
# Load no_proxy from environment variables (if set)
if os.getenv("NO_PROXY"): self.no_proxy = os.getenv("NO_PROXY")
if os.getenv("no_proxy"): self.no_proxy = os.getenv("no_proxy")
"""Proxy URL
"""
self.no_proxy = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change LGTM
This file is generated by openapi-generator. We also need to update the hotfix script to keep the patch: https://github.com/kubernetes-client/python/blob/master/scripts/insert_proxy_config.sh

Copy link
Author

@daezaa daezaa Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roycaihw Thanks for the input. The script looks fine to me and no need changes but if it was executed on v33.1.0,

if [ -z "$NO_PROXY_LINE" ]; then
# self.no_proxy = None is not present → insert full block after self.proxy = None
BLOCK+="${INDENT}# Load proxy from environment variables (if set)\n"
BLOCK+="${INDENT}if os.getenv(\"HTTPS_PROXY\"): self.proxy = os.getenv(\"HTTPS_PROXY\")\n"
BLOCK+="${INDENT}if os.getenv(\"https_proxy\"): self.proxy = os.getenv(\"https_proxy\")\n"
BLOCK+="${INDENT}if os.getenv(\"HTTP_PROXY\"): self.proxy = os.getenv(\"HTTP_PROXY\")\n"
BLOCK+="${INDENT}if os.getenv(\"http_proxy\"): self.proxy = os.getenv(\"http_proxy\")\n"
BLOCK+="${INDENT}self.no_proxy = None\n"
BLOCK+="${INDENT}# Load no_proxy from environment variables (if set)\n"
BLOCK+="${INDENT}if os.getenv(\"NO_PROXY\"): self.no_proxy = os.getenv(\"NO_PROXY\")\n"
BLOCK+="${INDENT}if os.getenv(\"no_proxy\"): self.no_proxy = os.getenv(\"no_proxy\")"
sed -i "${PROXY_LINE}a $BLOCK" "$CONFIG_FILE"
echo "Inserted full proxy + no_proxy block after 'self.proxy = None'."
else
# self.no_proxy = None exists → insert only env logic after that
BLOCK+="${INDENT}# Load proxy from environment variables (if set)\n"
BLOCK+="${INDENT}if os.getenv(\"HTTPS_PROXY\"): self.proxy = os.getenv(\"HTTPS_PROXY\")\n"
BLOCK+="${INDENT}if os.getenv(\"https_proxy\"): self.proxy = os.getenv(\"https_proxy\")\n"
BLOCK+="${INDENT}if os.getenv(\"HTTP_PROXY\"): self.proxy = os.getenv(\"HTTP_PROXY\")\n"
BLOCK+="${INDENT}if os.getenv(\"http_proxy\"): self.proxy = os.getenv(\"http_proxy\")\n"
BLOCK+="${INDENT}# Load no_proxy from environment variables (if set)\n"
BLOCK+="${INDENT}if os.getenv(\"NO_PROXY\"): self.no_proxy = os.getenv(\"NO_PROXY\")\n"
BLOCK+="${INDENT}if os.getenv(\"no_proxy\"): self.no_proxy = os.getenv(\"no_proxy\")"
sed -i "${NO_PROXY_LINE}a $BLOCK" "$CONFIG_FILE"
echo "Inserted environment block after 'self.no_proxy = None'."
fi

the else block should've ran so that there would be no duplicates of self.no_proxy = None. However, somehow, if [ -z "$NO_PROXY_LINE" ]; then has ran even though there was self.no_proxy = None existed.

Nevertheless, I am revising the PR with the result of executing instert_proxy_config.sh script on v33.1.0 tag.
Please re-review

"""bypass proxy for host in the no_proxy list.
"""
self.proxy_headers = None
Expand Down