-
Notifications
You must be signed in to change notification settings - Fork 95
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
feat(nodeResources): add GPU support #1708
Conversation
@@ -417,6 +417,10 @@ spec: | |||
type: string | |||
podCapacity: | |||
type: string | |||
resourceAllocatable: |
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.
resourceCapacity
is missing
pkg/analyze/node_resources.go
Outdated
@@ -382,6 +394,26 @@ func nodeMatchesFilters(node corev1.Node, filters *troubleshootv1beta2.NodeResou | |||
return true, nil | |||
} | |||
|
|||
if filters.ResourceName != "" { | |||
if filters.ResourceAllocatable != "" { |
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.
- nodeResources:
filters:
resourceName: gpu.intel.com/i915
Using the spec above, if a node without gpu.intel.com/i915
is present, this code will match it and count it in as a node with the intel GPU
We need to add a check here that checks if node.Status.Allocatable["gpu.intel.com/i915"]
or node.Status.Capacity["gpu.intel.com/i915"]
exist
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.
Please add a unit test for this use case
pkg/analyze/node_resources.go
Outdated
if filters != nil && filters.ResourceName != "" { | ||
resourceName = filters.ResourceName | ||
} |
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.
if filters != nil && filters.ResourceName != "" { | |
resourceName = filters.ResourceName | |
} | |
if filters != nil { | |
resourceName = filters.ResourceName | |
} |
pkg/analyze/node_resources_test.go
Outdated
totalNodeCount: len(nodeData), | ||
expected: true, | ||
isError: false, | ||
}, |
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: For completeness, I'd add a sum
unit test as well
Thank you @banjoh, those tests have been added and code changed. |
Signed-off-by: Evans Mungai <evans@replicated.com>
Description, Motivation and Context
resourceName
andresourceAllocatable
to filter gpuADR doc: https://docs.google.com/document/d/1LXuhzjzSsvuoOo4CnUXeq9SqfMYVPA0GpTNJj6PcX3g/edit?tab=t.0
sc-106618
Demo Yaml
Fixes: #1162
Checklist
Does this PR introduce a breaking change?