-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add node affinity support #1166
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
Conversation
update to latest
|
Travis-CI failing with this: I ran locally and it works fine. And I don't see any local changes. |
|
Thanks @sagor999 for pushing this topic forward. I hope, I can find some time soon to do a review. |
|
Can you run |
|
@FxKu hm, I just did run that script, but it did not produce any commitable changes. Which is a bit odd. Do I need to do anything else? |
|
Hm, not the first time, I'm hearing this. Also doesn't work for one of the committers. Anyway, you can take it from here: https://gist.github.com/FxKu/2eaae658c2c2fd2e4d11ccdeb28cb07f I ran the codegen and it produced changes. Paste it under |
|
@FxKu CI is now passing. :) |
|
@sagor999 thanks for the PR and that it does include tests. For now I just want to comment on that in the future we should somehow start or engage a discussion early on on how the Postgres manifest should change. It is not my opinion that mapping through all these API objects is the right way to go. E.g we could have aligned on a field for node affinity that just takes labels, making the "manifest" slim and not overblown. The type of affinity could have been some default.
Or in your case simply: I want to hide some complexity of the K8s configuration from the user of our manifests. |
|
@Jan-M That would have been Which internally is mapped into nodeAffinity by kubernetes. So I think we can still support |
|
Interesting discussion, from your point are you really looking for the full complexity of node affinity? I think it is good that the operator creates "node affinity" question should just be what is define on the "user" side. Sometimes it can be helpful to limit the user to the useful options. If in the end we build "affinityComplexity" again we better just support it like you did. In the end the topic of moving from nodeSelector to nodeAffinity also highlights that this could have been hidden from the user, what was originally nodeSelector in the Postgres manifest could just be translated to affinity. |
|
Hi, Regarding the nodeSelector vs affinity, I was checking what others are doing: As production deployments scenarios become complex relatively quickly, and probably that's one of the reasons the affinity was introduced: more complex logical conditions: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity If I were to choose which would bring more production support, I would go with affinity. |
|
@sagor999 can to you rebase with the master to resolve the conflict. We did some changes in the e2e tests. |
3410849 to
ec2cdbe
Compare
|
@FxKu done. Do you have an idea as to when you will merge this PR? |
|
@FxKu updated e2e and removed hard coded sleep from it. |
4e9cbe0 to
3bfa3af
Compare
|
@FxKu I think I addressed all issues. Let me know if there is anything else. |
|
@FxKu this test has failed: |
pkg/cluster/k8sres_test.go
Outdated
| return nil | ||
| } | ||
|
|
||
| func testNodeAffinity(cluster *Cluster, podSpec *v1.PodTemplateSpec) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a unit test where this function is actually used? 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Facepalm. 🤣
Fixed.
btw, I found there are a bunch of functions like that in that file that are not used in actual tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Yes, we noticed that, too, unfortunately 😃
|
@sagor999 we found that your addition to unit tests is only a function. It's not called from test case (t *testing.T). |
|
@FxKu fix submitted. |
|
👍 |
|
Thank you @sagor999 for the quick responses to our not so quick responses. This allows us to put it into the 1.6 we try to sum up now. |
|
👍 |
Hi,
this pull request adds node affinity support.
Added documentation.
Added e2e test.
All tests complete successfully locally.
Please let me know if anything is missing, would like to get this to finish line, as I have seen numerous requests and PR that did not make it.
Just going to reference them here so that once this is accepted, they all can be closed:
#975
#689
#493
#420
#209