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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
CONST_PRIVATE_DNS_ZONE_CONTRIBUTOR_ROLE,
CONST_DNS_ZONE_CONTRIBUTOR_ROLE,
CONST_ARTIFACT_SOURCE_CACHE,
CONST_NONE_UPGRADE_CHANNEL,
)
from azure.cli.command_modules.acs._helpers import (
check_is_managed_aad_cluster,
Expand Down Expand Up @@ -8482,6 +8483,38 @@ def update_mc_profile_default(self) -> ManagedCluster:
mc = self.update_node_resource_group_profile(mc)
# update bootstrap profile
mc = self.update_bootstrap_profile(mc)
# update kubernetes version and orchestrator version
mc = self.update_kubernetes_version_and_orchestrator_version(mc)
return mc

def update_kubernetes_version_and_orchestrator_version(self, mc: ManagedCluster) -> ManagedCluster:
Comment thread
yewmsft marked this conversation as resolved.
"""Update kubernetes version and orchestrator version for the ManagedCluster object.

:param mc: The ManagedCluster object to be updated.
:return: The updated ManagedCluster object.
"""
self._ensure_mc(mc)

# Check if auto_upgrade_channel is set to "none"
auto_upgrade_channel = self.context.get_auto_upgrade_channel()
if auto_upgrade_channel == CONST_NONE_UPGRADE_CHANNEL:
warning_message = (
"Since auto-upgrade-channel is set to none, cluster kubernetesVersion will be set to the value of "
"currentKubernetesVersion, all agent pools orchestratorVersion will be set to the value of "
"currentOrchestratorVersion respectively. Continue?"
)
if not self.context.get_yes() and not prompt_y_n(warning_message, default="n"):
raise DecoratorEarlyExitException()

# Set kubernetes version to match the current kubernetes version if it has a value
if mc.current_kubernetes_version:
mc.kubernetes_version = mc.current_kubernetes_version
Comment thread
yewmsft marked this conversation as resolved.

# Set orchestrator version for each agent pool to match the current orchestrator version if it has a value
for agent_pool in mc.agent_pool_profiles:
if agent_pool.current_orchestrator_version:
agent_pool.orchestrator_version = agent_pool.current_orchestrator_version

return mc

def check_is_postprocessing_required(self, mc: ManagedCluster) -> bool:
Expand Down
Loading