Skip to content

Conversation

BigDarkClown
Copy link
Contributor

@BigDarkClown BigDarkClown commented Apr 5, 2023

What type of PR is this?

/kind bug
/kind cleanup

What this PR does / why we need it:

NodeInfoProvider returns node infos representing each node group for scale-up. If there is at least one node in the node group, then it is used as a template. If there are none, the node info is based on the node group instance template.

In both these cases we want to pack the node infos with all the expected DaemonSet pods. That way CA won't perform a scale-up which leaves some DSs pending. All DS pods should be added to the node info if it is generated from instance template or if it is generated from existing node and the force-ds flag is enabled.

The issue is that the node sanitisation, which includes cleaning unwanted taints, is performed before the DS are added. That means that it is possible to not include all of the DS pods in the node info if for example:

  • There are no nodes in the node group, node group has ignore taint.
  • The node picked for representation is currently being scaled-down and has the deletion taint.

This change fixes it by performing additional sanitisation before trying to schedule DS pods. It also add additional unwantedTaints option, which enables defining taints which are removed from templates but not treated as ignore taints.

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Apr 5, 2023
@k8s-ci-robot
Copy link
Contributor

@BigDarkClown: The label(s) kind/fix cannot be applied, because the repository doesn't have them.

In response to this:

What type of PR is this?

/kind fix
/kind cleanup

What this PR does / why we need it:

NodeInfoProvider returns node infos representing each node group for scale-up. If there is at least one node in the node group, then it is used as a template. If there are none, the node info is based on the node group instance template.

In both these cases we want to pack the node infos with all the expected DaemonSet pods. That way CA won't perform a scale-up which leaves some DSs pending. All DS pods should be added to the node info if it is generated from instance template or if it is generated from existing node and the force-ds flag is enabled.

The issue is that the node sanitisation, which includes cleaning unwanted taints, is performed before the DS are added. That means that it is possible to not include all of the DS pods in the node info if for example:

  • There are no nodes in the node group, node group has ignore taint.
  • The node picked for representation is currently being scaled-down and has the deletion taint.

This change fixes it by performing additional sanitisation before trying to schedule DS pods. It also add additional unwantedTaints option, which enables defining taints which are removed from templates but not treated as ignore taints.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 5, 2023
@k8s-ci-robot k8s-ci-robot requested a review from feiskyer April 5, 2023 14:15
@k8s-ci-robot k8s-ci-robot requested a review from x13n April 5, 2023 14:15
if err != nil {
return false, "", err
}
sanitizedNodeInfo, err := utils.SanitizeNodeInfo(nodeInfo, id, ignoredTaints, unwantedTaints)
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't really a part of your changes, but with the extra SanitizeNode call it's just more visible - why is the above logic different from the GetNodeInfoFromTemplate()? Doesn't it do the exact same thing just with different nodeInfo as a source?

I understand this may not be in the scope of this PR, so feel free not to do it, but maybe it would be worth a small refactor to unify those codepaths?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a valid point, but this is not 100% true. We treat DS pods slightly differently depending on where we get template from. For existing nodes we take DS pods scheduled them and fill with missing DS pods if the option --force-ds is enabled. For instance template ones we always pack all the DS pods.

I think long term solution here is to set --force-ds to true always and unify both these logic pieces. But for now I'm not sure if it won't obfuscate the different underlying behaviour.

@BigDarkClown BigDarkClown force-pushed the fix-pls branch 3 times, most recently from 5bce9f2 to aac5184 Compare April 13, 2023 10:05
@x13n
Copy link
Member

x13n commented Apr 17, 2023

/assign

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 19, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 19, 2023
MaxPodEvictionTime time.Duration
// IgnoredTaints is a list of taints to ignore when considering a node template for scheduling.
IgnoredTaints []string
// StatusTaints is a list of taints to remove when creating a node template for scheduling.
Copy link
Member

Choose a reason for hiding this comment

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

WDYT about: StatusTaints is a list of taints CA considers to reflect transient node status that should be removed when creating a node template for scheduling. Both IgnoredTaints and StatusTaints are expected to be temporary, the only difference is that IgnoredTaints are expected to appear during node startup.?

I'd like the comment to better explain the "why" we have this, rather than the "how" it is going to be used.

@x13n
Copy link
Member

x13n commented Apr 19, 2023

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 19, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BigDarkClown, x13n

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 19, 2023
@k8s-ci-robot k8s-ci-robot merged commit 299c963 into kubernetes:master Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cluster-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants