Skip to content
Open
Changes from 1 commit
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
1 change: 0 additions & 1 deletion kubernetes/client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def __init__(self, host="http://localhost",
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

Copy link

@roccotigger roccotigger Nov 5, 2025

Choose a reason for hiding this comment

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

the script is not handling deleting the self.no_proxy = None when it appends the block to self.proxy section

something like the following is needed

    BLOCK=""
    NOPROXY_BLOCK=""

    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"

      sed -i "${PROXY_LINE}a $BLOCK" "$CONFIG_FILE"

      NOPROXY_BLOCK+="${INDENT}# Load no_proxy from environment variables (if set)\n"
      NOPROXY_BLOCK+="${INDENT}if os.getenv(\"NO_PROXY\"): self.no_proxy = os.getenv(\"NO_PROXY\")\n"
      NOPROXY_BLOCK+="${INDENT}if os.getenv(\"no_proxy\"): self.no_proxy = os.getenv(\"no_proxy\")"

      sed -i "${NO_PROXY_LINE}a $NOPROXY_BLOCK" "$CONFIG_FILE"

      echo "Inserted proxy block after 'self.proxy = None'. and no_proxy block after 'self.no_proxy = None'."
    else

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