Skip to content

Commit c537043

Browse files
authored
Apply default topology spread constraints (#679)
1 parent 772ff9c commit c537043

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

api/v1/coherenceresourcespec_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ func (in *CoherenceResourceSpec) CreatePodTemplateSpec(deployment CoherenceResou
729729
ServiceAccountName: in.GetServiceAccountName(),
730730
ShareProcessNamespace: in.ShareProcessNamespace,
731731
Tolerations: in.Tolerations,
732-
TopologySpreadConstraints: in.TopologySpreadConstraints,
732+
TopologySpreadConstraints: in.EnsureTopologySpreadConstraints(deployment),
733733
InitContainers: []corev1.Container{
734734
in.CreateOperatorInitContainer(deployment),
735735
},

api/v1/common_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ func createMinimalExpectedPodSpec(deployment coh.CoherenceResource) corev1.PodTe
367367
})
368368
}
369369

370-
lp, _ := deployment.GetSpec().Coherence.GetLocalPorts()
370+
lp, _ := spec.Coherence.GetLocalPorts()
371371

372372
// The Coherence Container
373373
cohContainer := corev1.Container{
@@ -467,7 +467,8 @@ func createMinimalExpectedPodSpec(deployment coh.CoherenceResource) corev1.PodTe
467467
VolumeSource: emptyVolume,
468468
},
469469
},
470-
Affinity: spec.CreateDefaultPodAffinity(deployment),
470+
TopologySpreadConstraints: spec.EnsureTopologySpreadConstraints(deployment),
471+
Affinity: spec.CreateDefaultPodAffinity(deployment),
471472
},
472473
}
473474

api/v1/create_statefulset_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,6 @@ func TestCreateStatefulSetWithTopologySpreadConstraintsEmpty(t *testing.T) {
654654
deployment := createTestDeployment(spec)
655655
// Create expected StatefulSet
656656
stsExpected := createMinimalExpectedStatefulSet(deployment)
657-
stsExpected.Spec.Template.Spec.TopologySpreadConstraints = []corev1.TopologySpreadConstraint{}
658657

659658
// assert that the StatefulSet is as expected
660659
assertStatefulSetCreation(t, deployment, stsExpected)

0 commit comments

Comments
 (0)