Skip to content

Commit

Permalink
fix bugs in update_sku
Browse files Browse the repository at this point in the history
  • Loading branch information
charlili1234 committed Apr 6, 2024
1 parent 2a8094d commit 33f69b0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/aks-preview/azext_aks_preview/managed_cluster_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3197,12 +3197,10 @@ def set_up_sku(self, mc: ManagedCluster) -> ManagedCluster:
skuName = self.context.get_sku_name()
if skuName is not None and skuName == CONST_MANAGED_CLUSTER_SKU_NAME_AUTOMATIC:
mc.sku.name="Automatic"
# passive Kind should always to match sku.name
mc.kind="Automatic"
mc.sku.tier="Standard"
else:
mc.sku.name="Base"
# passive Kind should always match sku.name
mc.kind="Base"
mc.sku.tier="Free"

Expand Down Expand Up @@ -4459,16 +4457,22 @@ def update_sku(self, mc: ManagedCluster) -> ManagedCluster:
:return: the ManagedCluster object
"""
self._ensure_mc(mc)

# there are existing MCs with nil sku, that is Base/Free
if mc.sku is None:
mc.sku = self.models.ManagedClusterSKU(
sku="Base",
tier="Free",
)

skuName = self.context.get_sku_name()
mc.sku = self.models.ManagedClusterSKU()
if skuName is not None and skuName == CONST_MANAGED_CLUSTER_SKU_NAME_AUTOMATIC:
# Existing Automatic SKU or switch from Base to Automatic SKU
mc.sku.name="Automatic"
# passive Kind should always to match sku.name
mc.kind = "Automatic"
mc.sku.tier="Standard"
else:
# Existing Base SKU or switch from Automatic to Base SKU
mc.sku.name="Base"
# passive Kind should always match sku.name
mc.kind="Base"

# Premium without LTS is ok (not vice versa)
Expand Down

0 comments on commit 33f69b0

Please sign in to comment.