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

[noderesourcetopology] update NRT when attributes change #631

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ffromani
Copy link
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

One of the key assumptions we took when designing the NodeResourceTopology (NRT) plugin is that the kubelet config of the worker node changes VERY rarely, if at all, during the cluster lifetime. As rule of thumb, it was expected to change with a frequency of like once every quarter (3 months) or so, and likely less often. So the event of changing during a scheduling cycle was deemed extremely low.

However, we fail to notice kubelet configuration changes (the bits we care reported by NRT data) and we update them incidentally when resyncing the cache.
These updates are expected to be rare, but still failing to noticing them is a different issue because it can lead to unnecessarily bad scheduling decision.

Simply put, failing to noticing these updates is a gap, which we address with this PR

Which issue(s) this PR fixes:

Fixes #621

Special notes for your reviewer:

still WIP, more test ongoing and upcoming

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. labels Aug 31, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ffromani

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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 31, 2023
@netlify
Copy link

netlify bot commented Aug 31, 2023

Deploy Preview for kubernetes-sigs-scheduler-plugins canceled.

Name Link
🔨 Latest commit 78e8c3e
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-scheduler-plugins/deploys/6661a823e103bc0008758707

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 31, 2023
@ffromani ffromani force-pushed the handle-attribute-updates branch 2 times, most recently from 020fa0f to 30dd0d7 Compare September 5, 2023 10:45
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 5, 2023
@ffromani ffromani force-pushed the handle-attribute-updates branch 2 times, most recently from bb78532 to 8320fa2 Compare September 6, 2023 08:50
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 15, 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 Nov 30, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 20, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 22, 2024
@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, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 4, 2024
@ffromani ffromani force-pushed the handle-attribute-updates branch 2 times, most recently from b764751 to 46fd5c8 Compare June 4, 2024 15:00
A upcoming change in the overreserve cache wants to
consume nodeconfig utilities, so in order to enable both
packages to consume this code, we move it in its own
package. Trivial code movement and only necessary interface
changes (renames/public <-> private symbols).

Signed-off-by: Francesco Romani <fromani@redhat.com>
create and require watchable client. The watchable client
is fully supported by the controller-runtime client and
it's a superset of the regular client, so this change
is fully backward compatible.

Signed-off-by: Francesco Romani <fromani@redhat.com>
In the NodeResourceTopologyMatch plugin we only need
to consume resources, never to change them.
So let's use a Reader instead of a full client.

Signed-off-by: Francesco Romani <fromani@redhat.com>
@ffromani ffromani force-pushed the handle-attribute-updates branch 2 times, most recently from 84394a7 to 0d31c28 Compare June 5, 2024 17:39
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 5, 2024
@ffromani ffromani force-pushed the handle-attribute-updates branch 2 times, most recently from 76531af to 910b12b Compare June 6, 2024 08:02
@ffromani
Copy link
Contributor Author

ffromani commented Jun 6, 2024

the integration test is pretty much done but thare are known issues I'm investigating.

@ffromani ffromani force-pushed the handle-attribute-updates branch 2 times, most recently from f16f925 to 8072fc4 Compare June 6, 2024 10:43
@ffromani ffromani changed the title WIP: update NRT when attributes change update NRT when attributes change Jun 6, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 6, 2024
@ffromani
Copy link
Contributor Author

ffromani commented Jun 6, 2024

/cc @Tal-or

@k8s-ci-robot k8s-ci-robot requested a review from Tal-or June 6, 2024 10:44
@ffromani ffromani changed the title update NRT when attributes change [noderesourcetopology] update NRT when attributes change Jun 6, 2024
One of the key assumptions we took when designing the
NodeResourceTopology (NRT) plugin is that the kubelet
configuration of the worker node changes *very* rarely,
if at all, during the cluster lifetime.
As rule of thumb, it was expected to change with a
frequency of like once every quarter (3 months) or so,
and likely less often. So the event of changing during
a scheduling cycle was deemed extremely low.

However, we fail to notice kubelet configuration changes
(the bits we care reported by NRT data) and we update
them incidentally when resyncing the cache.

These updates are expected to be rare, but still failing
to noticing them is a  much worse issue: with out of
date configuration information, the scheduler plugin
will take wrong decisions until restarted.

Up until now, the mitigation was to restart the scheduler
once kubelet config changes; this works, but it is
unpractical and requires more orchestration.

We add the option to resync the NRT data if the attribute
change (and nothing else did) to overcome this limitation.
In the current framework, because of how controller-runtime/client
works, this will require a new connection to the apiserver to
watch the changes and react to them, adding the node
to the set of the one being resynced in the next resync iteration.

Even considering HA scheduler scenarios, this will cause
a very limited amount of new connections, and should not
cause any scalability concern. Nevertheless, we make
the feature opt-in.

Signed-off-by: Francesco Romani <fromani@redhat.com>
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kubelet configuration change without immediate cache updates
2 participants