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
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ To release a new version, please select a new version number (usually plus 1 to
Pending
+++++++

18.0.0b13
+++++++
* Add option `--enable-http-proxy` to `az aks update`.

18.0.0b12
+++++++
* Add option `--acns-transit-encryption-type <None|WireGuard>` to `az aks create/update`
Expand Down
3 changes: 3 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,9 @@
- name: --disable-http-proxy
type: bool
short-summary: Disable HTTP Proxy Configuration on the cluster.
- name: --enable-http-proxy
type: bool
short-summary: Enable HTTP Proxy Configuration on the cluster.
examples:
- name: Reconcile the cluster back to its current state.
text: az aks update -g MyResourceGroup -n MyManagedCluster
Expand Down
1 change: 1 addition & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,7 @@ def load_arguments(self, _):

c.argument('migrate_vmas_to_vms', is_preview=True, action='store_true')
c.argument("disable_http_proxy", action="store_true", is_preview=True)
c.argument("enable_http_proxy", action="store_true", is_preview=True)

with self.argument_context("aks upgrade") as c:
c.argument("kubernetes_version", completer=get_k8s_upgrades_completion_list)
Expand Down
1 change: 1 addition & 0 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ def aks_update(
azure_keyvault_kms_key_vault_resource_id=None,
http_proxy_config=None,
disable_http_proxy=False,
enable_http_proxy=False,
bootstrap_artifact_source=None,
bootstrap_container_registry_resource_id=None,
# addons
Expand Down
17 changes: 17 additions & 0 deletions src/aks-preview/azext_aks_preview/managed_cluster_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2863,6 +2863,16 @@ def get_disable_http_proxy(self) -> bool:

return disable_http_proxy

def get_enable_http_proxy(self) -> bool:
"""Obtain the value of enable_http_proxy.

:return: bool
"""
# read the original value passed by the command
enable_http_proxy = self.raw_param.get("enable_http_proxy")

return enable_http_proxy


# pylint: disable=too-many-public-methods
class AKSPreviewManagedClusterCreateDecorator(AKSManagedClusterCreateDecorator):
Expand Down Expand Up @@ -5350,6 +5360,13 @@ def update_http_proxy_enabled(self, mc: ManagedCluster) -> ManagedCluster:
)
mc.http_proxy_config.enabled = False

if self.context.get_enable_http_proxy():
if mc.http_proxy_config is None:
mc.http_proxy_config = (
self.models.ManagedClusterHTTPProxyConfig() # pylint: disable=no-member
)
mc.http_proxy_config.enabled = True

return mc

def update_mc_profile_preview(self) -> ManagedCluster:
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6143,6 +6143,22 @@ def test_aks_create_and_update_with_http_proxy_config(
],
)

self.kwargs.update(
{
"resource_group": resource_group,
"name": aks_name,
}
)

reenable_cmd = "aks update --resource-group={resource_group} --name={name} --enable-http-proxy"

self.cmd(
reenable_cmd,
checks=[
self.check("httpProxyConfig.enabled", True),
],
)

# delete
self.cmd(
"aks delete -g {resource_group} -n {name} --yes --no-wait",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6502,6 +6502,40 @@ def test_update_http_proxy_config(self):
)
self.assertEqual(dec_mc_2, ground_truth_mc_2)

# custom value
dec_3 = AKSPreviewManagedClusterUpdateDecorator(
self.cmd,
self.client,
{
"enable_http_proxy": True,
},
CUSTOM_MGMT_AKS_PREVIEW,
)

mc_3 = self.models.ManagedCluster(
location="test_location",
http_proxy_config = self.models.ManagedClusterHTTPProxyConfig(
enabled=False,
httpProxy="http://cli-proxy-vm:3128/",
httpsProxy="https://cli-proxy-vm:3129/",
)
)
dec_3.context.attach_mc(mc_3)
# fail on passing the wrong mc object
with self.assertRaises(CLIInternalError):
dec_3.update_http_proxy_enabled(None)
dec_mc_3 = dec_3.update_http_proxy_enabled(mc_3)

ground_truth_mc_3 = self.models.ManagedCluster(
location="test_location",
http_proxy_config = self.models.ManagedClusterHTTPProxyConfig(
enabled=True,
httpProxy="http://cli-proxy-vm:3128/",
httpsProxy="https://cli-proxy-vm:3129/",
)
)
self.assertEqual(dec_mc_3, ground_truth_mc_3)

def test_update_pod_identity_profile(self):
# default value in `aks_update`
dec_1 = AKSPreviewManagedClusterUpdateDecorator(
Expand Down
3 changes: 3 additions & 0 deletions src/aks-preview/linter_exclusions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ aks update:
disable_http_proxy:
rule_exclusions:
- option_length_too_long
enable_http_proxy:
rule_exclusions:
- option_length_too_long
aks delete:
parameters:
ignore_pod_disruption_budget:
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from setuptools import setup, find_packages

VERSION = "18.0.0b12"
VERSION = "18.0.0b13"

CLASSIFIERS = [
"Development Status :: 4 - Beta",
Expand Down
Loading