|
25 | 25 | CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY, |
26 | 26 | CONST_OUTBOUND_TYPE_USER_ASSIGNED_NAT_GATEWAY, |
27 | 27 | CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING, |
| 28 | + CONST_OUTBOUND_TYPE_NONE, |
28 | 29 | CONST_PRIVATE_DNS_ZONE_NONE, |
29 | 30 | CONST_PRIVATE_DNS_ZONE_SYSTEM, |
30 | 31 | CONST_AZURE_KEYVAULT_NETWORK_ACCESS_PRIVATE, |
|
39 | 40 | CONST_AZURE_SERVICE_MESH_UPGRADE_COMMAND_ROLLBACK, |
40 | 41 | CONST_PRIVATE_DNS_ZONE_CONTRIBUTOR_ROLE, |
41 | 42 | CONST_DNS_ZONE_CONTRIBUTOR_ROLE, |
| 43 | + CONST_ARTIFACT_SOURCE_CACHE, |
42 | 44 | ) |
43 | 45 | from azure.cli.command_modules.acs._helpers import ( |
44 | 46 | check_is_managed_aad_cluster, |
@@ -2147,8 +2149,8 @@ def _get_outbound_type( |
2147 | 2149 | CONST_OUTBOUND_TYPE_LOAD_BALANCER. |
2148 | 2150 |
|
2149 | 2151 | This function supports the option of enable_validation. When enabled, if the value of outbound_type is |
2150 | | - CONST_OUTBOUND_TYPE_LOAD_BALANCER,CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY, CONST_OUTBOUND_TYPE_USER_ASSIGNED_NAT_GATEWAY or |
2151 | | - CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING, the following checks will be performed. If load_balancer_sku is set |
| 2152 | + CONST_OUTBOUND_TYPE_LOAD_BALANCER, CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY, CONST_OUTBOUND_TYPE_USER_ASSIGNED_NAT_GATEWAY |
| 2153 | + CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING or CONST_OUTBOUND_TYPE_NONE, the following checks will be performed. If load_balancer_sku is set |
2152 | 2154 | to basic, an InvalidArgumentValueError will be raised. If vnet_subnet_id is not assigned, |
2153 | 2155 | a RequiredArgumentMissingError will be raised. If any of load_balancer_managed_outbound_ip_count, |
2154 | 2156 | This function supports the option of read_only. When enabled, it will skip dynamic completion and validation. |
@@ -2185,11 +2187,11 @@ def _get_outbound_type( |
2185 | 2187 | CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY, |
2186 | 2188 | CONST_OUTBOUND_TYPE_USER_ASSIGNED_NAT_GATEWAY, |
2187 | 2189 | CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING, |
2188 | | - "none" |
| 2190 | + CONST_OUTBOUND_TYPE_NONE, |
2189 | 2191 | ]: |
2190 | 2192 | raise InvalidArgumentValueError( |
2191 | | - "Invalid outbound type, supported values are loadBalancer, managedNATGateway, userAssignedNATGateway and " |
2192 | | - "userDefinedRouting. Please refer to " |
| 2193 | + "Invalid outbound type, supported values are loadBalancer, managedNATGateway, userAssignedNATGateway, " |
| 2194 | + "userDefinedRouting and none. Please refer to " |
2193 | 2195 | "https://learn.microsoft.com/en-us/azure/aks/egress-outboundtype#updating-outboundtype-after-cluster-creation " # pylint:disable=line-too-long |
2194 | 2196 | "for more details." |
2195 | 2197 | ) |
@@ -5248,6 +5250,16 @@ def get_if_none_match(self) -> Union[str, None]: |
5248 | 5250 | # this parameter does not need validation |
5249 | 5251 | return self.raw_param.get("if_none_match") |
5250 | 5252 |
|
| 5253 | + def get_bootstrap_artifact_source(self) -> Union[str, None]: |
| 5254 | + """Obtain the value of bootstrap_artifact_source. |
| 5255 | + """ |
| 5256 | + return self.raw_param.get("bootstrap_artifact_source") |
| 5257 | + |
| 5258 | + def get_bootstrap_container_registry_resource_id(self) -> Union[str, None]: |
| 5259 | + """Obtain the value of bootstrap_container_registry_resource_id. |
| 5260 | + """ |
| 5261 | + return self.raw_param.get("bootstrap_container_registry_resource_id") |
| 5262 | + |
5251 | 5263 |
|
5252 | 5264 | class AKSManagedClusterCreateDecorator(BaseAKSManagedClusterDecorator): |
5253 | 5265 | def __init__( |
@@ -6510,6 +6522,24 @@ def set_up_node_resource_group_profile(self, mc: ManagedCluster) -> ManagedClust |
6510 | 6522 | mc.node_resource_group_profile = node_resource_group_profile |
6511 | 6523 | return mc |
6512 | 6524 |
|
| 6525 | + def set_up_bootstrap_profile(self, mc: ManagedCluster) -> ManagedCluster: |
| 6526 | + self._ensure_mc(mc) |
| 6527 | + |
| 6528 | + bootstrap_artifact_source = self.context.get_bootstrap_artifact_source() |
| 6529 | + bootstrap_container_registry_resource_id = self.context.get_bootstrap_container_registry_resource_id() |
| 6530 | + if hasattr(mc, "bootstrap_profile") and bootstrap_artifact_source is not None: |
| 6531 | + if bootstrap_artifact_source != CONST_ARTIFACT_SOURCE_CACHE and bootstrap_container_registry_resource_id: |
| 6532 | + raise MutuallyExclusiveArgumentError( |
| 6533 | + "Cannot specify --bootstrap-container-registry-resource-id when " |
| 6534 | + "--bootstrap-artifact-source is not Cache." |
| 6535 | + ) |
| 6536 | + if mc.bootstrap_profile is None: |
| 6537 | + mc.bootstrap_profile = self.models.ManagedClusterBootstrapProfile() # pylint: disable=no-member |
| 6538 | + mc.bootstrap_profile.artifact_source = bootstrap_artifact_source |
| 6539 | + mc.bootstrap_profile.container_registry_id = bootstrap_container_registry_resource_id |
| 6540 | + |
| 6541 | + return mc |
| 6542 | + |
6513 | 6543 | def construct_mc_profile_default(self, bypass_restore_defaults: bool = False) -> ManagedCluster: |
6514 | 6544 | """The overall controller used to construct the default ManagedCluster profile. |
6515 | 6545 |
|
@@ -6590,6 +6620,8 @@ def construct_mc_profile_default(self, bypass_restore_defaults: bool = False) -> |
6590 | 6620 | mc = self.set_up_metrics_profile(mc) |
6591 | 6621 | # set up node resource group profile |
6592 | 6622 | mc = self.set_up_node_resource_group_profile(mc) |
| 6623 | + # set up bootstrap profile |
| 6624 | + mc = self.set_up_bootstrap_profile(mc) |
6593 | 6625 |
|
6594 | 6626 | # DO NOT MOVE: keep this at the bottom, restore defaults |
6595 | 6627 | if not bypass_restore_defaults: |
@@ -8351,6 +8383,24 @@ def update_metrics_profile(self, mc: ManagedCluster) -> ManagedCluster: |
8351 | 8383 |
|
8352 | 8384 | return mc |
8353 | 8385 |
|
| 8386 | + def update_bootstrap_profile(self, mc: ManagedCluster) -> ManagedCluster: |
| 8387 | + self._ensure_mc(mc) |
| 8388 | + |
| 8389 | + bootstrap_artifact_source = self.context.get_bootstrap_artifact_source() |
| 8390 | + bootstrap_container_registry_resource_id = self.context.get_bootstrap_container_registry_resource_id() |
| 8391 | + if hasattr(mc, "bootstrap_profile") and bootstrap_artifact_source is not None: |
| 8392 | + if bootstrap_artifact_source != CONST_ARTIFACT_SOURCE_CACHE and bootstrap_container_registry_resource_id: |
| 8393 | + raise MutuallyExclusiveArgumentError( |
| 8394 | + "Cannot specify --bootstrap-container-registry-resource-id when " |
| 8395 | + "--bootstrap-artifact-source is not Cache." |
| 8396 | + ) |
| 8397 | + if mc.bootstrap_profile is None: |
| 8398 | + mc.bootstrap_profile = self.models.ManagedClusterBootstrapProfile() # pylint: disable=no-member |
| 8399 | + mc.bootstrap_profile.artifact_source = bootstrap_artifact_source |
| 8400 | + mc.bootstrap_profile.container_registry_id = bootstrap_container_registry_resource_id |
| 8401 | + |
| 8402 | + return mc |
| 8403 | + |
8354 | 8404 | def update_mc_profile_default(self) -> ManagedCluster: |
8355 | 8405 | """The overall controller used to update the default ManagedCluster profile. |
8356 | 8406 |
|
@@ -8430,6 +8480,8 @@ def update_mc_profile_default(self) -> ManagedCluster: |
8430 | 8480 | mc = self.update_metrics_profile(mc) |
8431 | 8481 | # update node resource group profile |
8432 | 8482 | mc = self.update_node_resource_group_profile(mc) |
| 8483 | + # update bootstrap profile |
| 8484 | + mc = self.update_bootstrap_profile(mc) |
8433 | 8485 | return mc |
8434 | 8486 |
|
8435 | 8487 | def check_is_postprocessing_required(self, mc: ManagedCluster) -> bool: |
|
0 commit comments