Skip to content

Commit

Permalink
Apply default topology spread constraints (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
thegridman authored Dec 4, 2024
1 parent 772ff9c commit c537043
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/v1/coherenceresourcespec_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ func (in *CoherenceResourceSpec) CreatePodTemplateSpec(deployment CoherenceResou
ServiceAccountName: in.GetServiceAccountName(),
ShareProcessNamespace: in.ShareProcessNamespace,
Tolerations: in.Tolerations,
TopologySpreadConstraints: in.TopologySpreadConstraints,
TopologySpreadConstraints: in.EnsureTopologySpreadConstraints(deployment),
InitContainers: []corev1.Container{
in.CreateOperatorInitContainer(deployment),
},
Expand Down
5 changes: 3 additions & 2 deletions api/v1/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func createMinimalExpectedPodSpec(deployment coh.CoherenceResource) corev1.PodTe
})
}

lp, _ := deployment.GetSpec().Coherence.GetLocalPorts()
lp, _ := spec.Coherence.GetLocalPorts()

// The Coherence Container
cohContainer := corev1.Container{
Expand Down Expand Up @@ -467,7 +467,8 @@ func createMinimalExpectedPodSpec(deployment coh.CoherenceResource) corev1.PodTe
VolumeSource: emptyVolume,
},
},
Affinity: spec.CreateDefaultPodAffinity(deployment),
TopologySpreadConstraints: spec.EnsureTopologySpreadConstraints(deployment),
Affinity: spec.CreateDefaultPodAffinity(deployment),
},
}

Expand Down
1 change: 0 additions & 1 deletion api/v1/create_statefulset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,6 @@ func TestCreateStatefulSetWithTopologySpreadConstraintsEmpty(t *testing.T) {
deployment := createTestDeployment(spec)
// Create expected StatefulSet
stsExpected := createMinimalExpectedStatefulSet(deployment)
stsExpected.Spec.Template.Spec.TopologySpreadConstraints = []corev1.TopologySpreadConstraint{}

// assert that the StatefulSet is as expected
assertStatefulSetCreation(t, deployment, stsExpected)
Expand Down

0 comments on commit c537043

Please sign in to comment.