From c08bb086ce00f4cb8dfb29dc2376c317d36cbcc8 Mon Sep 17 00:00:00 2001 From: Karol Szwaj Date: Thu, 12 Dec 2024 16:22:28 +0100 Subject: [PATCH] Add default subnet in custom vpc to the beginning of the list Signed-off-by: Karol Szwaj --- pkg/controller/namespace.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/controller/namespace.go b/pkg/controller/namespace.go index 1b3e9282019..e338845d6fd 100644 --- a/pkg/controller/namespace.go +++ b/pkg/controller/namespace.go @@ -151,7 +151,9 @@ func (c *Controller) handleAddNamespace(key string) error { return err } if s.Name == vpc.Spec.DefaultSubnet { - lss = []string{s.Name} + if slices.Contains(vpc.Spec.Namespaces, key) && key != metav1.NamespaceSystem { + lss = append([]string{s.Name}, lss...) + } } } }