Skip to content

Commit

Permalink
feat: Attempt to place job pod on same node as database
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Oct 4, 2023
1 parent 5f8fbc2 commit 0f5a7d2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/util/cmd_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,21 @@ func createJob(cmd *cobra.Command, conf *config.Global, actionName string) error
Spec: corev1.PodSpec{
RestartPolicy: corev1.RestartPolicyOnFailure,
TerminationGracePeriodSeconds: ptr.To(int64(0)),
Affinity: &corev1.Affinity{
PodAffinity: &corev1.PodAffinity{
PreferredDuringSchedulingIgnoredDuringExecution: []corev1.WeightedPodAffinityTerm{
{
Weight: 100,
PodAffinityTerm: corev1.PodAffinityTerm{
TopologyKey: "kubernetes.io/hostname",
LabelSelector: &metav1.LabelSelector{
MatchLabels: conf.Pod.ObjectMeta.Labels,
},
},
},
},
},
},
Containers: []corev1.Container{
{
Name: "kubedb",
Expand Down

0 comments on commit 0f5a7d2

Please sign in to comment.