Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add topologySpreadConstraints configuration to pod spec. #2530

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

laiminhtrung1997
Copy link
Contributor

@laiminhtrung1997 laiminhtrung1997 commented Feb 4, 2024

Dear all,

I think we should configure topologySpreadConstraints to pod spec so these pods can spread zones for high availability.

Could someone review it, please? Thank you very much.

Best regards.

@monotek
Copy link

monotek commented May 16, 2024

We need that feature too.

@FxKu FxKu modified the milestones: 2.0, 1.13.0 May 24, 2024
@@ -465,6 +465,11 @@ func (c *Cluster) compareStatefulSetWith(statefulSet *appsv1.StatefulSet) *compa
needsRollUpdate = true
reasons = append(reasons, "new statefulset's pod affinity does not match the current one")
}
if !reflect.DeepEqual(c.Statefulset.Spec.Template.Spec.TopologySpreadConstraints, statefulSet.Spec.Template.Spec.TopologySpreadConstraints) {
needsReplace = true
needsRollUpdate = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this really need to trigger a rolling update of pods executed by operator? Will not K8s take care of it then once the statefulset is replaced?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm good point. Maybe we can leave as is for now. With rolling update we make sure pods immediately adhere the new constraints.

pkg/cluster/k8sres.go Outdated Show resolved Hide resolved
pkg/cluster/k8sres.go Outdated Show resolved Hide resolved
@FxKu
Copy link
Member

FxKu commented Jun 26, 2024

Can you also write an e2e test that tests that the constraints work as expected, please?

@FxKu FxKu modified the milestones: 1.13.0, 1.14.0 Jun 26, 2024
@laiminhtrung1997
Copy link
Contributor Author

Can you also write an e2e test that tests that the constraints work as expected, please?

Dear @FxKu
Thanks so much for your comments, I haven't written the UT or e2e test many, but I'll try my best. I'll mark it ready and let you know when I fixed the comments.
Best regards.

@laiminhtrung1997 laiminhtrung1997 force-pushed the add-topologySpreadConstraints branch 8 times, most recently from 530f847 to 18023cb Compare July 7, 2024 06:56
@laiminhtrung1997 laiminhtrung1997 force-pushed the add-topologySpreadConstraints branch 7 times, most recently from d52f435 to 909b45f Compare July 17, 2024 03:31
@laiminhtrung1997 laiminhtrung1997 force-pushed the add-topologySpreadConstraints branch 13 times, most recently from 434c6c5 to ee2b43d Compare July 18, 2024 14:53
@laiminhtrung1997
Copy link
Contributor Author

Dear @FxKu
I completed the UT and E2E tests and resolved your comment. Could you please review it again? Thanks.

@laiminhtrung1997
Copy link
Contributor Author

Dear @FxKu
Have you been able to take a look yet? I'm looking forward to hearing from you soon about this.

@FxKu FxKu added the minor label Aug 27, 2024
@FxKu
Copy link
Member

FxKu commented Aug 27, 2024

@laiminhtrung1997 thanks a lot for the update. I think, in this state you can be sure we will merge it for the next release. We have to focus on the new status feature first but I will get back to you in September.

@laiminhtrung1997 laiminhtrung1997 force-pushed the add-topologySpreadConstraints branch 2 times, most recently from c5c4713 to 256fd9f Compare October 20, 2024 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Waiting for review
Development

Successfully merging this pull request may close these issues.

3 participants