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.0b7
+++++++
* Add option `--disable-http-proxy` to `az aks update`.

18.0.0b6
+++++++
* Quality improvements for `az aks extension` and `az aks extension type` command groups
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 @@ -1262,6 +1262,9 @@
- name: --migrate-vmas-to-vms
type: bool
short-summary: Migrate cluster with VMAS node pool to VMS node pool.
- name: --disable-http-proxy
type: bool
short-summary: Disable 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 @@ -1443,6 +1443,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)

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 @@ -822,6 +822,7 @@ def aks_update(
azure_keyvault_kms_key_vault_network_access=None,
azure_keyvault_kms_key_vault_resource_id=None,
http_proxy_config=None,
disable_http_proxy=False,
bootstrap_artifact_source=None,
bootstrap_container_registry_resource_id=None,
# addons
Expand Down
28 changes: 28 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 @@ -2839,6 +2839,16 @@ def get_migrate_vmas_to_vms(self) -> bool:
"""
return self.raw_param.get("migrate_vmas_to_vms")

def get_disable_http_proxy(self) -> bool:
"""Obtain the value of disable_http_proxy.

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

return disable_http_proxy


# pylint: disable=too-many-public-methods
class AKSPreviewManagedClusterCreateDecorator(AKSManagedClusterCreateDecorator):
Expand Down Expand Up @@ -5322,6 +5332,22 @@ def update_vmas_to_vms(self, mc: ManagedCluster) -> ManagedCluster:

return mc

def update_http_proxy_enabled(self, mc: ManagedCluster) -> ManagedCluster:
"""Update http proxy config for the ManagedCluster object.

:return: the ManagedCluster object
"""
self._ensure_mc(mc)

if self.context.get_disable_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 = False

return mc

def update_mc_profile_preview(self) -> ManagedCluster:
"""The overall controller used to update the preview ManagedCluster profile.

Expand Down Expand Up @@ -5397,6 +5423,8 @@ def update_mc_profile_preview(self) -> ManagedCluster:
mc = self.update_imds_restriction(mc)
# update VMAS to VMS
mc = self.update_vmas_to_vms(mc)
# update http proxy config
mc = self.update_http_proxy_enabled(mc)

return mc

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6022,7 +6022,7 @@ def test_aks_create_with_node_config(self, resource_group, resource_group_locati
# In any case, AKS clirunner will execute this case in live mode every day to ensure that there are no problems,
# so mark this case as live_only.
@live_only()
@AllowLargeResponse()
@AllowLargeResponse(99999)
@AKSCustomResourceGroupPreparer(
random_name_length=17, name_prefix="clitest", location="westus2"
)
Expand Down Expand Up @@ -6129,6 +6129,28 @@ def test_aks_create_and_update_with_http_proxy_config(
],
)

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

disable_cmd = "aks update --resource-group={resource_group} --name={name} --disable-http-proxy --aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/DisableHTTPProxyPreview"

self.cmd(
disable_cmd,
checks=[
self.check("httpProxyConfig.enabled", False),
],
)

# delete
self.cmd(
"aks delete -g {resource_group} -n {name} --yes --no-wait",
checks=[self.is_empty()],
)

@AllowLargeResponse()
@AKSCustomResourceGroupPreparer(
random_name_length=17, name_prefix="clitest", location="westus2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6511,6 +6511,40 @@ def test_update_http_proxy_config(self):
)
self.assertEqual(dec_mc_1, ground_truth_mc_1)

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

mc_2 = 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/",
)
)
dec_2.context.attach_mc(mc_2)
# fail on passing the wrong mc object
with self.assertRaises(CLIInternalError):
dec_2.update_http_proxy_enabled(None)
dec_mc_2 = dec_2.update_http_proxy_enabled(mc_2)

ground_truth_mc_2 = 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/",
)
)
self.assertEqual(dec_mc_2, ground_truth_mc_2)

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 @@ -239,6 +239,9 @@ aks update:
disable_retina_flow_logs:
rule_exclusions:
- option_length_too_long
disable_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.0b6"
VERSION = "18.0.0b7"

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