Skip to content

Commit 9dd2085

Browse files
authored
[AKS] Cluster health monitor addon (#9674)
1 parent 1089267 commit 9dd2085

11 files changed

Lines changed: 4319 additions & 3 deletions

src/aks-preview/HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ To release a new version, please select a new version number (usually plus 1 to
1212
Pending
1313
+++++++
1414

15+
19.0.0b25
16+
+++++++
17+
* `az aks create`: Add `--enable-continuous-control-plane-and-addon-monitor` to enable continuous control plane and addon monitor.
18+
* `az aks update`: Add `--enable-continuous-control-plane-and-addon-monitor` and `--disable-continuous-control-plane-and-addon-monitor` to manage continuous control plane and addon monitor.
19+
1520
19.0.0b24
1621
+++++++
1722
* Vendor new SDK and bump API version to 2026-01-02-preview.

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,12 @@ def load_arguments(self, _):
12011201
help="Enable managed installation of Gateway API CRDs from the standard release channel."
12021202
)
12031203
c.argument("enable_hosted_system", action="store_true", is_preview=True)
1204+
c.argument(
1205+
"enable_continuous_control_plane_and_addon_monitor",
1206+
action="store_true",
1207+
is_preview=True,
1208+
help="Enable continuous control plane and addon monitor for the cluster.",
1209+
)
12041210

12051211
with self.argument_context("aks update") as c:
12061212
# managed cluster paramerters
@@ -1779,6 +1785,18 @@ def load_arguments(self, _):
17791785
is_preview=True,
17801786
help="Disable Application Load Balancer (Application Gateway for Containers)."
17811787
)
1788+
c.argument(
1789+
"enable_continuous_control_plane_and_addon_monitor",
1790+
action="store_true",
1791+
is_preview=True,
1792+
help="Enable continuous control plane and addon monitor for the cluster.",
1793+
)
1794+
c.argument(
1795+
"disable_continuous_control_plane_and_addon_monitor",
1796+
action="store_true",
1797+
is_preview=True,
1798+
help="Disable continuous control plane and addon monitor for the cluster.",
1799+
)
17821800

17831801
with self.argument_context("aks upgrade") as c:
17841802
c.argument("kubernetes_version", completer=get_k8s_upgrades_completion_list)

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,9 @@ def aks_create(
11601160
enable_upstream_kubescheduler_user_configuration=False,
11611161
# managed gateway installation
11621162
enable_gateway_api=False,
1163-
enable_hosted_system=False
1163+
enable_hosted_system=False,
1164+
# health monitor
1165+
enable_continuous_control_plane_and_addon_monitor=False,
11641166
):
11651167
# DO NOT MOVE: get all the original parameters and save them as a dictionary
11661168
raw_parameters = locals()
@@ -1404,6 +1406,9 @@ def aks_update(
14041406
# application load balancer
14051407
enable_application_load_balancer=False,
14061408
disable_application_load_balancer=False,
1409+
# health monitor
1410+
enable_continuous_control_plane_and_addon_monitor=False,
1411+
disable_continuous_control_plane_and_addon_monitor=False,
14071412
):
14081413
# DO NOT MOVE: get all the original parameters and save them as a dictionary
14091414
raw_parameters = locals()

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3767,6 +3767,20 @@ def get_enable_hosted_system(self) -> bool:
37673767
raise RequiredArgumentMissingError('"--enable-hosted-system" requires "--sku automatic".')
37683768
return enable_hosted_system
37693769

3770+
def get_enable_continuous_control_plane_and_addon_monitor(self) -> bool:
3771+
"""Obtain the value of enable_continuous_control_plane_and_addon_monitor.
3772+
3773+
:return: bool
3774+
"""
3775+
return self.raw_param.get("enable_continuous_control_plane_and_addon_monitor")
3776+
3777+
def get_disable_continuous_control_plane_and_addon_monitor(self) -> bool:
3778+
"""Obtain the value of disable_continuous_control_plane_and_addon_monitor.
3779+
3780+
:return: bool
3781+
"""
3782+
return self.raw_param.get("disable_continuous_control_plane_and_addon_monitor")
3783+
37703784

37713785
# pylint: disable=too-many-public-methods
37723786
class AKSPreviewManagedClusterCreateDecorator(AKSManagedClusterCreateDecorator):
@@ -4796,6 +4810,22 @@ def set_up_bootstrap_profile(self, mc: ManagedCluster) -> ManagedCluster:
47964810

47974811
return mc
47984812

4813+
def set_up_health_monitor_profile(self, mc: ManagedCluster) -> ManagedCluster:
4814+
"""Set up health monitor profile for the ManagedCluster object.
4815+
4816+
:return: the ManagedCluster object
4817+
"""
4818+
self._ensure_mc(mc)
4819+
4820+
if self.context.get_enable_continuous_control_plane_and_addon_monitor():
4821+
if mc.health_monitor_profile is None:
4822+
mc.health_monitor_profile = (
4823+
self.models.ManagedClusterHealthMonitorProfile() # pylint: disable=no-member
4824+
)
4825+
mc.health_monitor_profile.enable_continuous_control_plane_and_addon_monitor = True
4826+
4827+
return mc
4828+
47994829
def set_up_static_egress_gateway(self, mc: ManagedCluster) -> ManagedCluster:
48004830
self._ensure_mc(mc)
48014831

@@ -4920,6 +4950,8 @@ def construct_mc_profile_preview(self, bypass_restore_defaults: bool = False) ->
49204950
mc = self.set_up_bootstrap_profile(mc)
49214951
# set up static egress gateway profile
49224952
mc = self.set_up_static_egress_gateway(mc)
4953+
# set up health monitor profile
4954+
mc = self.set_up_health_monitor_profile(mc)
49234955
# set up imds restriction(a property in network profile)
49244956
mc = self.set_up_imds_restriction(mc)
49254957
# set up user-defined scheduler configuration for kube-scheduler upstream
@@ -7132,6 +7164,32 @@ def update_static_egress_gateway(self, mc: ManagedCluster) -> ManagedCluster:
71327164
mc.network_profile.static_egress_gateway_profile.enabled = False
71337165
return mc
71347166

7167+
def update_health_monitor_profile(self, mc: ManagedCluster) -> ManagedCluster:
7168+
"""Update health monitor profile for the ManagedCluster object.
7169+
7170+
:return: the ManagedCluster object
7171+
"""
7172+
self._ensure_mc(mc)
7173+
7174+
enable = self.context.get_enable_continuous_control_plane_and_addon_monitor()
7175+
disable = self.context.get_disable_continuous_control_plane_and_addon_monitor()
7176+
7177+
if not enable and not disable:
7178+
return mc
7179+
if enable and disable:
7180+
raise MutuallyExclusiveArgumentError(
7181+
"Cannot specify --enable-continuous-control-plane-and-addon-monitor and "
7182+
"--disable-continuous-control-plane-and-addon-monitor at the same time."
7183+
)
7184+
7185+
if mc.health_monitor_profile is None:
7186+
mc.health_monitor_profile = (
7187+
self.models.ManagedClusterHealthMonitorProfile() # pylint: disable=no-member
7188+
)
7189+
mc.health_monitor_profile.enable_continuous_control_plane_and_addon_monitor = bool(enable)
7190+
7191+
return mc
7192+
71357193
def update_imds_restriction(self, mc: ManagedCluster) -> ManagedCluster:
71367194
"""Update imds restriction for the ManagedCluster object.
71377195
@@ -7552,6 +7610,8 @@ def update_mc_profile_preview(self) -> ManagedCluster:
75527610
mc = self.update_bootstrap_profile(mc)
75537611
# update static egress gateway
75547612
mc = self.update_static_egress_gateway(mc)
7613+
# update health monitor profile
7614+
mc = self.update_health_monitor_profile(mc)
75557615
# update imds restriction
75567616
mc = self.update_imds_restriction(mc)
75577617
# update VMAS to VMS

0 commit comments

Comments
 (0)