From b2bf657953d9f3f81516419d41e4f49ebe9cd272 Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Tue, 29 Nov 2022 13:56:04 +0530 Subject: [PATCH 1/3] Update logic Signed-off-by: Shubham Sharma --- .../azext_k8s_extension/partner_extensions/Dapr.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py index cd693bb1336..aca4893c042 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py @@ -161,16 +161,26 @@ def Update(self, cmd, resource_group_name: str, cluster_name: str, auto_upgrade_ configuration_settings = {} # If we are downgrading the extension, then we need to disable the apply-CRDs hook. + # Additionally, if we are disabling auto-upgrades, we need to disable the apply-CRDs hook (as auto-upgrade is always on the latest version). # This is because CRD updates while downgrading can cause issues. # As CRDs are additive, skipping their removal while downgrading is safe. original_version = original_extension.version + original_auto_upgrade = original_extension.auto_upgrade_minor_version if self.APPLY_CRDS_HOOK_ENABLED_KEY in configuration_settings: logger.debug("'%s' is set to '%s' in --configuration-settings, not overriding it.", self.APPLY_CRDS_HOOK_ENABLED_KEY, configuration_settings[self.APPLY_CRDS_HOOK_ENABLED_KEY]) + elif original_auto_upgrade and not auto_upgrade_minor_version: + logger.debug("Auto-upgrade is disabled and version is pinned to %s. Setting '%s' to false.", + version, self.APPLY_CRDS_HOOK_ENABLED_KEY) + configuration_settings[self.APPLY_CRDS_HOOK_ENABLED_KEY] = 'false' elif original_version and version and version < original_version: logger.debug("Downgrade detected from %s to %s. Setting %s to false.", original_version, version, self.APPLY_CRDS_HOOK_ENABLED_KEY) configuration_settings[self.APPLY_CRDS_HOOK_ENABLED_KEY] = 'false' + elif original_version and version and version == original_version: + logger.debug("Version unchanged at %s. Setting %s to false.", + version, self.APPLY_CRDS_HOOK_ENABLED_KEY) + configuration_settings[self.APPLY_CRDS_HOOK_ENABLED_KEY] = 'false' else: # If we are not downgrading, enable the apply-CRDs hook explicitly. # This is because the value may have been set to false during a previous downgrade. From a993316d7b988fd35271a380daac7d6bf0180195 Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Tue, 29 Nov 2022 14:15:46 +0530 Subject: [PATCH 2/3] re-trigger pipeline Signed-off-by: Shubham Sharma From d417d938cb39c3f319261cf7d2437556ec7089db Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Wed, 30 Nov 2022 11:17:09 +0530 Subject: [PATCH 3/3] re-trigger pipeline Signed-off-by: Shubham Sharma