Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/connectedk8s/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Release History

0.2.8
++++++
* Added checks for proxy
* Added checks for proxy and added disable-proxy
* Updated config dataplane endpoint to support other clouds

0.2.7
Expand Down
2 changes: 2 additions & 0 deletions src/connectedk8s/azext_connectedk8s/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@
Kubeconfig_Failed_To_Load_Fault_Type = "failed-to-load-kubeconfig-file"
Proxy_Cert_Path_Does_Not_Exist_Fault_Type = 'proxy-cert-path-does-not-exist-error'
Proxy_Cert_Path_Does_Not_Exist_Error = 'Proxy cert path {} does not exist. Please check the path provided'
No_Param_Error = 'No parmeters were specified with update command. Please run az connectedk8s update --help to check parameters available for update'
EnableProxy_Conflict_Error = 'Conflict detected: --disable-proxy can not be set with --https-proxy, --http-proxy, --proxy-skip-range and --proxy-cert at the same time. Please run az connectedk8s update --help for more information about the parameters'
2 changes: 2 additions & 0 deletions src/connectedk8s/azext_connectedk8s/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
examples:
- name: Update proxy values for the agents
text: az connectedk8s update -g resourceGroupName -n connectedClusterName --proxy-cert /path/to/crt --proxy-https https://proxy-url --proxy-http http://proxy-url --proxy-skip-range excludedIP,excludedCIDR,exampleCIDRfollowed,10.0.0.0/24
- name: Disable proxy settings for agents
text: az connectedk8s update --disable-proxy
"""

helps['connectedk8s list'] = """
Expand Down
1 change: 1 addition & 0 deletions src/connectedk8s/azext_connectedk8s/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def load_arguments(self, _):
c.argument('http_proxy', options_list=['--proxy-http'], help='Http proxy URL to be used.')
c.argument('no_proxy', options_list=['--proxy-skip-range'], help='List of URLs/CIDRs for which proxy should not to be used.')
c.argument('proxy_cert', options_list=['--proxy-cert'], type=file_type, completer=FilesCompleter(), help='Path to the certificate file for proxy')
c.argument('disable_proxy', options_list=['--disable-proxy'], action='store_true', help='Disables proxy settings for agents')

with self.argument_context('connectedk8s list') as c:
pass
Expand Down
14 changes: 13 additions & 1 deletion src/connectedk8s/azext_connectedk8s/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,8 @@ def helm_install_release(chart_path, subscription_id, kubernetes_distro, resourc
cmd_helm_install.extend(["--set", "global.noProxy={}".format(no_proxy)])
if proxy_cert:
cmd_helm_install.extend(["--set-file", "global.proxyCert={}".format(proxy_cert)])
if https_proxy or http_proxy or no_proxy:
cmd_helm_install.extend(["--set", "global.isProxyEnabled={}".format(True)])
if kube_config:
cmd_helm_install.extend(["--kubeconfig", kube_config])
if kube_context:
Expand Down Expand Up @@ -708,7 +710,7 @@ def update_connectedk8s(cmd, instance, tags=None):


def update_agents(cmd, client, resource_group_name, cluster_name, https_proxy="", http_proxy="", no_proxy="", proxy_cert="",
kube_config=None, kube_context=None, no_wait=False):
disable_proxy=False, kube_config=None, kube_context=None, no_wait=False):
logger.warning("Ensure that you have the latest helm version installed before proceeding.")
logger.warning("This operation might take a while...\n")

Expand Down Expand Up @@ -736,6 +738,12 @@ def update_agents(cmd, client, resource_group_name, cluster_name, https_proxy=""

proxy_cert = proxy_cert.replace('\\', r'\\\\')

if https_proxy == "" and http_proxy == "" and no_proxy == "" and proxy_cert == "" and not disable_proxy:
raise CLIError(consts.No_Param_Error)

if (https_proxy or http_proxy or no_proxy or proxy_cert) and disable_proxy:
raise CLIError(consts.EnableProxy_Conflict_Error)

# Checking whether optional extra values file has been provided.
values_file_provided = False
values_file = os.getenv('HELMVALUESPATH')
Expand Down Expand Up @@ -837,6 +845,10 @@ def update_agents(cmd, client, resource_group_name, cluster_name, https_proxy=""
cmd_helm_upgrade.extend(["--set", "global.httpProxy={}".format(http_proxy)])
if no_proxy:
cmd_helm_upgrade.extend(["--set", "global.noProxy={}".format(no_proxy)])
if https_proxy or http_proxy or no_proxy:
cmd_helm_upgrade.extend(["--set", "global.isProxyEnabled={}".format(True)])
if disable_proxy:
cmd_helm_upgrade.extend(["--set", "global.isProxyEnabled={}".format(False)])
Comment thread
Anumita marked this conversation as resolved.
if proxy_cert:
cmd_helm_upgrade.extend(["--set-file", "global.proxyCert={}".format(proxy_cert)])
if kube_config:
Expand Down