From 7b53f051389e85471d8cbe4eef1b3d33fb1e6bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Golicz?= Date: Mon, 18 Nov 2024 09:29:32 +0100 Subject: [PATCH] Setting Shoot seedSelector.matchLabels field to the value seed.gardener.cloud/region : --- pkg/gardener/shoot/extender/seed_in_shoot_region.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/gardener/shoot/extender/seed_in_shoot_region.go b/pkg/gardener/shoot/extender/seed_in_shoot_region.go index b18f8de3..f7adb54c 100644 --- a/pkg/gardener/shoot/extender/seed_in_shoot_region.go +++ b/pkg/gardener/shoot/extender/seed_in_shoot_region.go @@ -3,12 +3,21 @@ package extender import ( gardener "github.com/gardener/gardener/pkg/apis/core/v1beta1" imv1 "github.com/kyma-project/infrastructure-manager/api/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) func ExtendWithSeedInSameRegion(runtime imv1.Runtime, shoot *gardener.Shoot) error { - if runtime.Spec.Shoot.EnforceSeedLocation != nil && *runtime.Spec.Shoot.EnforceSeedLocation { + if runtime.Spec.Shoot.EnforceSeedLocation != nil && *runtime.Spec.Shoot.EnforceSeedLocation && runtime.Spec.Shoot.Region != "" { //add required label to the shoot + + shoot.Spec.SeedSelector = &gardener.SeedSelector{ + LabelSelector: metav1.LabelSelector{ + MatchLabels: map[string]string{ + "seed.gardener.cloud/region": runtime.Spec.Shoot.Region, + }, + }, + } } return nil