From 8f4a309277b11903bad05abab4725c888befd78f Mon Sep 17 00:00:00 2001 From: Michal Jura Date: Tue, 1 Oct 2024 10:41:41 +0200 Subject: [PATCH] Add validation for modifications to availability zones Updating Availability Zone is not allowed for Azure AKS. Issue: https://github.com/rancher/aks-operator/issues/669 (cherry picked from commit cb6780187745046ffe68850fb90a8ae468a23bb1) --- controller/aks-cluster-config-handler.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controller/aks-cluster-config-handler.go b/controller/aks-cluster-config-handler.go index 2b61e077..b9693b8a 100644 --- a/controller/aks-cluster-config-handler.go +++ b/controller/aks-cluster-config-handler.go @@ -944,6 +944,9 @@ func (h *Handler) updateUpstreamClusterState(ctx context.Context, config *aksv1. logrus.Debugf("config: %s; upstream: %s", np.Mode, upstreamNodePool.Mode) updateNodePool = true } + if np.AvailabilityZones != nil && !reflect.DeepEqual(np.AvailabilityZones, upstreamNodePool.AvailabilityZones) { + logrus.Errorf("Changing availability zones for node pool [%s] in cluster [%s (id: %s)] is not permitted", aks.String(np.Name), config.Spec.ClusterName, config.Name) + } } else { logrus.Infof("Adding node pool [%s] for cluster [%s (id: %s)]", aks.String(np.Name), config.Spec.ClusterName, config.Name) updateNodePool = true