Skip to content

Commit

Permalink
Setting Shoot seedSelector.matchLabels field to the value seed.garden…
Browse files Browse the repository at this point in the history
…er.cloud/region : <Shoot region>
  • Loading branch information
koala7659 committed Nov 18, 2024
1 parent 70f4db6 commit 7b53f05
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/gardener/shoot/extender/seed_in_shoot_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7b53f05

Please sign in to comment.