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

Pending
+++++++
* Added `--enable-gateway-api` to `az aks create` to enable managed Gateway API installation
* Added `--enable-gateway-api` and `--disable-gateway-api` to `az aks update` to enable/disable managed Gateway API installation

19.0.0b3
+++++++
Expand Down
4 changes: 4 additions & 0 deletions src/aks-preview/azext_aks_preview/_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@
CONST_APP_ROUTING_INTERNAL_NGINX = "Internal"
CONST_APP_ROUTING_NONE_NGINX = "None"

# managed gateway api installation
CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED = "Disabled"
CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD = "Standard"

# all supported addons
ADDONS = {
"http_application_routing": CONST_HTTP_APPLICATION_ROUTING_ADDON_NAME,
Expand Down
15 changes: 15 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,9 @@
- name: --enable-upstream-kubescheduler-user-configuration
type: bool
short-summary: Enable user-defined scheduler configuration for kube-scheduler upstream on the cluster
- name: --enable-gateway-api
type: bool
short-summary: Enable managed installation of Gateway API CRDs from the standard release channel. Requires at least one managed Gateway API ingress provider to be enabled.
examples:
- name: Create a Kubernetes cluster with an existing SSH public key.
text: az aks create -g MyResourceGroup -n MyManagedCluster --ssh-key-value /path/to/publickey
Expand Down Expand Up @@ -775,6 +778,8 @@
text: az aks create -g MyResourceGroup -n MyManagedCluster --vm-set-type VirtualMachines --vm-sizes "VMSize1,VMSize2" --node-count 3
- name: Create a kubernetes cluster with a fully managed system node pool
text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-managed-system-pool
- name: Create a kubernetes cluster with the Azure Service Mesh addon enabled with a managed installation of Gateway API CRDs from the standard release channel.
text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-azure-service-mesh --enable-gateway-api

"""

Expand Down Expand Up @@ -1392,6 +1397,12 @@
- name: --disable-upstream-kubescheduler-user-configuration
type: bool
short-summary: Disable user-defined scheduler configuration for kube-scheduler upstream on the cluster
- name: --enable-gateway-api
type: bool
short-summary: Enable managed installation of Gateway API CRDs from the standard release channel. Requires at least one managed Gateway API ingress provider to be enabled.
- name: --disable-gateway-api
type: bool
short-summary: Disable managed installation of Gateway API CRDs.
examples:
- name: Reconcile the cluster back to its current state.
text: az aks update -g MyResourceGroup -n MyManagedCluster
Expand Down Expand Up @@ -1461,6 +1472,10 @@
text: az aks update -g MyResourceGroup -n MyManagedCluster --disable-azure-monitor-logs
- name: Update a kubernetes cluster to clear any namespaces excluded from safeguards. Assumes azure policy addon is already enabled
text: az aks update -g MyResourceGroup -n MyManagedCluster --safeguards-excluded-ns ""
- name: Update a kubernetes cluster to enable a managed installation of Gateway API CRDs from the standard release channel.
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-gateway-api
- name: Update a kubernetes cluster to disable the managed installation of Gateway API CRDs.
text: az aks update -g MyResourceGroup -n MyManagedCluster --disable-gateway-api
- name: Enable OpenTelemetry metrics collection on an existing cluster
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-opentelemetry-metrics
- name: Enable OpenTelemetry logs collection on an existing cluster
Expand Down
15 changes: 15 additions & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,11 @@ def load_arguments(self, _):
is_preview=True,
deprecate_info=c.deprecate(target="--enable-managed-system-pool", hide=True))
c.argument("enable_upstream_kubescheduler_user_configuration", action="store_true", is_preview=True)
c.argument(
"enable_gateway_api",
action="store_true",
help="Enable managed installation of Gateway API CRDs from the standard release channel."
)

with self.argument_context("aks update") as c:
# managed cluster paramerters
Expand Down Expand Up @@ -1718,6 +1723,16 @@ def load_arguments(self, _):
c.argument("enable_http_proxy", action="store_true", is_preview=True)
c.argument("enable_upstream_kubescheduler_user_configuration", action="store_true", is_preview=True)
c.argument("disable_upstream_kubescheduler_user_configuration", action="store_true", is_preview=True)
c.argument(
"enable_gateway_api",
action="store_true",
help="Enable managed installation of Gateway API CRDs from the standard release channel."
)
c.argument(
"disable_gateway_api",
action="store_true",
help="Disable managed installation of Gateway API CRDs."
)

with self.argument_context("aks upgrade") as c:
c.argument("kubernetes_version", completer=get_k8s_upgrades_completion_list)
Expand Down
5 changes: 5 additions & 0 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,8 @@ def aks_create(
# managed system pool
enable_managed_system_pool=False,
enable_upstream_kubescheduler_user_configuration=False,
# managed gateway installation
enable_gateway_api=False
):
# DO NOT MOVE: get all the original parameters and save them as a dictionary
raw_parameters = locals()
Expand Down Expand Up @@ -1386,6 +1388,9 @@ def aks_update(
migrate_vmas_to_vms=False,
enable_upstream_kubescheduler_user_configuration=False,
disable_upstream_kubescheduler_user_configuration=False,
# managed gateway installation
enable_gateway_api=False,
disable_gateway_api=False,
):
# DO NOT MOVE: get all the original parameters and save them as a dictionary
raw_parameters = locals()
Expand Down
69 changes: 69 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 @@ -44,6 +44,8 @@
CONST_IMDS_RESTRICTION_DISABLED,
CONST_AVAILABILITY_SET,
CONST_VIRTUAL_MACHINES,
CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD,
CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED,
CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH,
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE
)
Expand Down Expand Up @@ -3567,6 +3569,20 @@ def get_disable_upstream_kubescheduler_user_configuration(self) -> bool:
)
return disable_upstream_kubescheduler_user_configuration

def get_enable_gateway_api(self) -> bool:
"""Obtain the value of enable_gateway_api.

:return: bool
"""
return self.raw_param.get("enable_gateway_api", False)

def get_disable_gateway_api(self) -> bool:
"""Obtain the value of disable_gateway_api.

:return: bool
"""
return self.raw_param.get("disable_gateway_api", False)


# pylint: disable=too-many-public-methods
class AKSPreviewManagedClusterCreateDecorator(AKSManagedClusterCreateDecorator):
Expand Down Expand Up @@ -3953,6 +3969,25 @@ def set_up_ingress_web_app_routing(self, mc: ManagedCluster) -> ManagedCluster:

return mc

def set_up_ingress_profile_gateway_api(self, mc: ManagedCluster) -> ManagedCluster:
"""Set up Gateway API configuration in ingress profile for the ManagedCluster object.

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

if self.context.get_enable_gateway_api():
if mc.ingress_profile is None:
mc.ingress_profile = self.models.ManagedClusterIngressProfile() # pylint: disable=no-member
if mc.ingress_profile.gateway_api is None:
mc.ingress_profile.gateway_api = (
self.models.ManagedClusterIngressProfileGatewayConfiguration( # pylint: disable=no-member
installation=CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD
)
)

return mc

def set_up_workload_auto_scaler_profile(self, mc: ManagedCluster) -> ManagedCluster:
"""Set up workload auto-scaler profile for the ManagedCluster object.

Expand Down Expand Up @@ -4600,6 +4635,8 @@ def construct_mc_profile_preview(self, bypass_restore_defaults: bool = False) ->
mc = self.set_up_creationdata_of_cluster_snapshot(mc)
# set up app routing profile
mc = self.set_up_ingress_web_app_routing(mc)
# set up gateway api profile
mc = self.set_up_ingress_profile_gateway_api(mc)
# set up workload auto scaler profile
mc = self.set_up_workload_auto_scaler_profile(mc)
# set up vpa
Expand Down Expand Up @@ -6608,6 +6645,36 @@ def _update_dns_zone_resource_ids(self, mc: ManagedCluster, dns_zone_resource_id
else:
raise CLIError('App Routing must be enabled to modify DNS zone resource IDs.\n')

def update_ingress_profile_gateway_api(self, mc: ManagedCluster) -> ManagedCluster:
"""Update Gateway API configuration in ingress profile for the ManagedCluster object.

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

enable_gateway_api = self.context.get_enable_gateway_api()
disable_gateway_api = self.context.get_disable_gateway_api()

# Check for mutually exclusive arguments
if enable_gateway_api and disable_gateway_api:
raise MutuallyExclusiveArgumentError(
"Cannot specify --enable-gateway-api and --disable-gateway-api at the same time."
)

if enable_gateway_api or disable_gateway_api:
if mc.ingress_profile is None:
mc.ingress_profile = self.models.ManagedClusterIngressProfile() # pylint: disable=no-member
if mc.ingress_profile.gateway_api is None:
mc.ingress_profile.gateway_api = (
self.models.ManagedClusterIngressProfileGatewayConfiguration() # pylint: disable=no-member
)
if enable_gateway_api:
mc.ingress_profile.gateway_api.installation = CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD
elif disable_gateway_api:
mc.ingress_profile.gateway_api.installation = CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED

return mc

def update_node_provisioning_profile(self, mc: ManagedCluster) -> ManagedCluster:
"""Updates the nodeProvisioningProfile field of the managed cluster

Expand Down Expand Up @@ -7069,6 +7136,8 @@ def update_mc_profile_preview(self) -> ManagedCluster:
mc = self.update_nat_gateway_profile(mc)
# update kube proxy config
mc = self.update_kube_proxy_config(mc)
# update ingress profile gateway api
mc = self.update_ingress_profile_gateway_api(mc)
# update custom ca trust certificates
mc = self.update_custom_ca_trust_certificates(mc)
# update run command
Expand Down
Loading
Loading