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 check for taints to determine if pod can run #29793
Conversation
2e3cae0
to
6caee3c
Compare
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.
LGTM!
6caee3c
to
1ecc906
Compare
1ecc906
to
f28e4e2
Compare
if taint.Key != nodeRoleControlPlane && taint.Key != nodeRoleETCD && | ||
taint.Key != nodeRoleControlPlaneHyphen && taint.Key != nodeRoleMaster { | ||
continue | ||
} |
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.
nit: feel like this is confusing conditional. You could do notWorker := a || b || c
then if notWorker && taint == NoSchedule; return true
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.
@cbron Did something equivalent but without the inverted logic. Also, I try to avoid return the true case inside of conditionals as it's more idiomatic per: https://dave.cheney.net/2020/02/23/the-zen-of-go, but I think this reads fine now.
f28e4e2
to
f0c84c2
Compare
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.
looks great
Version2 of: #29759
Problem
Even when some nodes are labelled as control plane, they still have the ability to run pods
Solution
Check for taints to determine if pods can be executed on that node and count it towards worker stats if it can
Issue
#29139