Skip to content

Commit

Permalink
Only override pod affinity
Browse files Browse the repository at this point in the history
  • Loading branch information
bkneis authored and pascalbreuninger committed Sep 10, 2024
1 parent 65eca07 commit f65d783
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/kubernetes/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,11 @@ func (k *KubernetesDriver) runContainer(

// ensure we have a pod affinity, and in that case we have, just add ours
if pod.Spec.Affinity == nil || pod.Spec.Affinity.PodAffinity == nil {
pod.Spec.Affinity = &corev1.Affinity{
PodAffinity: &corev1.PodAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{},
},
if pod.Spec.Affinity == nil {
pod.Spec.Affinity = &corev1.Affinity{}
}
pod.Spec.Affinity.PodAffinity = &corev1.PodAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{},
}
}

Expand Down

0 comments on commit f65d783

Please sign in to comment.