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

Sync RTE with NFD #32

Merged
merged 3 commits into from
Sep 15, 2021
Merged

Sync RTE with NFD #32

merged 3 commits into from
Sep 15, 2021

Conversation

Tal-or
Copy link
Contributor

@Tal-or Tal-or commented Sep 14, 2021

  • Sync podres package
  • Bump NRT API to latest:
  • Update vendor files
  • Fix code to match the new API
  • Populate Capacity, Available and Allocatable as NFD is doing

TODO (on separate PR) when openshift-kni/resource-topology-exporter#23 and jaypipes/ghw#268 get merged we should take care of memory capacity accounting as well

@Tal-or Tal-or changed the title WIP: Sync rte with nfd WIP: Sync RTE with NFD Sep 14, 2021
@swatisehgal
Copy link
Collaborator

swatisehgal commented Sep 14, 2021

The available accounting will be added on a separate commit

Just an FYI, the scheduler plugin uses available field to make its NUMA aware scheduling decision, so we need to make sure that available field is populated to make sure that it works with the latest version of the scheduler plugin.

@@ -691,23 +691,23 @@ func TestResourcesScan(t *testing.T) {
Resources: topologyv1alpha1.ResourceInfoList{
topologyv1alpha1.ResourceInfo{
Name: "cpu",
Allocatable: intstr.FromString("10"),
Capacity: intstr.FromString("12"),
Allocatable: resource.MustParse("10"),
Copy link
Collaborator

@swatisehgal swatisehgal Sep 14, 2021

Choose a reason for hiding this comment

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

Wanted to point out how I went ahead with this change in NFD, I assumed that capacity=allocatable (i.e. we don't account for kube-reserved and system reserved) and changed the values in the allocatable field to be captured in the available field some like I did here: kubernetes-sigs/node-feature-discovery@041aa80 and then later in a subsequent commit took the reserved resources into consideration: kubernetes-sigs/node-feature-discovery@043c7a8.

@Tal-or
Copy link
Contributor Author

Tal-or commented Sep 14, 2021

The available accounting will be added on a separate commit

Just an FYI, the scheduler plugin uses available field to make its NUMA aware scheduling decision, so we need to make sure that available field is populated to make sure that it works with the latest version of the scheduler plugin.

This is going to be part of this PR but in a separate commit for readability porpuses

@Tal-or
Copy link
Contributor Author

Tal-or commented Sep 14, 2021

@swatisehgal @fromanirh FYI the Allocatable field in RTE is behaving as the Available filed in NFD.
I just tested it on my setup, one you deploy/delete a guaranteed pod, the values under Allocatable are changing, while it shouldn't, becuase it should reflect the amount of capacity - reserved and it doesn't depend on the number of running pods in the cluster.
As you can see: https://github.com/k8stopologyawareschedwg/resource-topology-exporter/blob/master/pkg/resourcemonitor/resourcemonitor.go#L171
is this change in the behavior is intentional?

@@ -18,12 +18,12 @@ package resourcemonitor

import (
"encoding/json"
"k8s.io/apimachinery/pkg/api/resource"
Copy link
Contributor

Choose a reason for hiding this comment

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

please put the import in the group below alongside with the other k8s imports

@ffromani
Copy link
Contributor

ffromani commented Sep 14, 2021

@swatisehgal @fromanirh FYI the Allocatable field in RTE is behaving as the Available filed in NFD.
I just tested it on my setup, one you deploy/delete a guaranteed pod, the values under Allocatable are changing, while it shouldn't, becuase it should reflect the amount of capacity - reserved and it doesn't depend on the number of running pods in the cluster.
As you can see: https://github.com/k8stopologyawareschedwg/resource-topology-exporter/blob/master/pkg/resourcemonitor/resourcemonitor.go#L171
is this change in the behavior is intentional?

With nodresourcetopology API 0.0.8 "Allocatable" behaves like "Available" in API 0.0.10:

v0.0.8		v0.0.10
N/A		Capacity
Capacity	Allocatable
Allocatable	Available

@Tal-or
Copy link
Contributor Author

Tal-or commented Sep 14, 2021

With nodresourcetopology API 0.0.8 "Allocatable" behaves like "Available" in API 0.0.10:

v0.0.8           v0.0.10
N/A               Capacity
Capacity      Allocatable
Allocatable   Available

Oh I see. Sorry I wasn't aware of that, I misread what Swati mentioned above

},
topologyv1alpha1.ResourceInfo{
Name: "fake.io/net",
Allocatable: intstr.FromString("4"),
Capacity: intstr.FromString("4"),
Available: resource.MustParse("12"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like a mistake to me: available should be equal to 4 here as well. Also note that available will always be <= both allocatable and capacity.

Copy link
Contributor Author

@Tal-or Tal-or Sep 14, 2021

Choose a reason for hiding this comment

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

yes. copy paste mistake I just found out myself. Thanks!

@ffromani
Copy link
Contributor

the podres sync patch can be a separate PR which we can merge quickly.

Signed-off-by: Talor Itzhak <[email protected]>
- Update vendor files
- Fix code to match the new API

This patch is following the way of how the new API integration was done on NFD:
It assumes capacity is equal to allocatable and in a subsequent patch
we need to account for kube-reserved and system reserved to determine the
allocatable, as allocatable = capcity - kube-reserved/system-reserved

Signed-off-by: Talor Itzhak <[email protected]>
This patch updates the Capacity, Allocatable and Available accountig logic to be identical to what NFD has:
k8stopologyawareschedwg/node-feature-discovery@043c7a8

Signed-off-by: Talor Itzhak <[email protected]>
@Tal-or Tal-or changed the title WIP: Sync RTE with NFD Sync RTE with NFD Sep 14, 2021
@ffromani
Copy link
Contributor

good enough, we can improve in followup PRs.

@ffromani ffromani merged commit 02e7192 into master Sep 15, 2021
@ffromani ffromani deleted the sync_rte_with_nfd branch September 15, 2021 11:08
@ffromani ffromani mentioned this pull request Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants