-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[cluster-autoscaler] Allow “custom” DaemonSet pods #2483
[cluster-autoscaler] Allow “custom” DaemonSet pods #2483
Conversation
Welcome @clamoriniere! |
fa536d4
to
7233004
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.
Sorry for delay in review. This looks great.
It is super nice to see added testing coverage and code cleanup going together with adding features.
I have very few minor comments.
continue | ||
} | ||
|
||
if pod_util.IsMirrorPod(pod) || pod_util.IsDaemonSetPod(pod) || pod_util.IsStaticPod(pod) { |
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.
IIUC the mirror pod is manifestation of static pod registered in API server. Static pod is observed only by kubelet so we should not get a static pod ever here. Right?
https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/
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.
absolutely
cluster-autoscaler/utils/pod/pod.go
Outdated
return true | ||
} | ||
|
||
if pod.Annotations == nil { |
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.
I think you do not need this. Looking up in "nil" map should work fine.
podsToRemoveList, err := drain.GetPodsForDeletionOnNodeDrain( | ||
allPods, | ||
[]*policyv1.PodDisruptionBudget{}, // PDBs are irrelevant when considering new node. | ||
true, // Force all removals. |
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.
It seems we can drop the deleteAll
parameter from GetPodsForDeletionOnNodeDrain
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.
right, it is always used with false
7233004
to
55d8f42
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.
* Create `utils/pod` package: pod kind detection functions. * Update DaemonSet Pod detection logic: introduce the annotation `cluster-autoscaler.kubernetes.io/daemonset-pod` to declare a Pod as a DaemonSet Pod. * Update `simulator` package to use the new `utils/pod` package function. * Cleanup `getRequiredPodsForNode()` function. Signed-off-by: cedric lamoriniere <[email protected]>
55d8f42
to
f0fbf7a
Compare
@losipiuk Thanks for the fast review. Commits are now squashed. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: losipiuk The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes: #2453
utils/pod
package: pod kind detection functions.cluster-autoscaler.kubernetes.io/daemonset-pod
to declare a Pod as aDaemonSet Pod.
simulator
package to use the newutils/pod
package functions.getRequiredPodsForNode()
function.Signed-off-by: cedric lamoriniere [email protected]