From 3d5ef7acb117961b662585b3c1d94c3394d5399b Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Thu, 5 Oct 2023 00:28:40 -0500 Subject: [PATCH] feat: Add zone and region to preferred pod affinity --- internal/util/cmd_setup.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/internal/util/cmd_setup.go b/internal/util/cmd_setup.go index 9a4e60bc..72e13d57 100644 --- a/internal/util/cmd_setup.go +++ b/internal/util/cmd_setup.go @@ -223,6 +223,24 @@ func createJob(cmd *cobra.Command, conf *config.Global, actionName string) error }, }, }, + { + Weight: 90, + PodAffinityTerm: corev1.PodAffinityTerm{ + TopologyKey: "topology.kubernetes.io/zone", + LabelSelector: &metav1.LabelSelector{ + MatchLabels: conf.Pod.ObjectMeta.Labels, + }, + }, + }, + { + Weight: 80, + PodAffinityTerm: corev1.PodAffinityTerm{ + TopologyKey: "topology.kubernetes.io/region", + LabelSelector: &metav1.LabelSelector{ + MatchLabels: conf.Pod.ObjectMeta.Labels, + }, + }, + }, }, }, },