Skip to content

Commit

Permalink
Merge pull request #1495 from zimnx/mz/placement-in-cleanup-job-1.11
Browse files Browse the repository at this point in the history
[v1.11] Set ScyllaCluster placement requirements on cleanup Jobs
  • Loading branch information
scylla-operator-bot[bot] authored Oct 19, 2023
2 parents 458f9bb + 4fe4e28 commit daa64e7
Show file tree
Hide file tree
Showing 2 changed files with 389 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/controller/scyllacluster/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,17 @@ func MakeJobs(sc *scyllav1.ScyllaCluster, services map[string]*corev1.Service, i
naming.CleanupJobTokenRingHashAnnotation: currentTokenRingHash,
}

var tolerations []corev1.Toleration
var affinity *corev1.Affinity
if rack.Placement != nil {
tolerations = rack.Placement.Tolerations
affinity = &corev1.Affinity{
NodeAffinity: rack.Placement.NodeAffinity,
PodAffinity: rack.Placement.PodAffinity,
PodAntiAffinity: rack.Placement.PodAntiAffinity,
}
}

jobs = append(jobs, &batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Name: naming.CleanupJobForService(svc.Name),
Expand All @@ -1070,6 +1081,8 @@ func MakeJobs(sc *scyllav1.ScyllaCluster, services map[string]*corev1.Service, i
Annotations: annotations,
},
Spec: corev1.PodSpec{
Tolerations: tolerations,
Affinity: affinity,
RestartPolicy: corev1.RestartPolicyOnFailure,
Containers: []corev1.Container{
{
Expand Down
Loading

0 comments on commit daa64e7

Please sign in to comment.