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

e2e: check all nodes have NRT object #1164

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions test/e2e/serial/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"os"
"strings"

v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
kubeletconfigv1beta1 "k8s.io/kubelet/config/v1beta1"

Expand Down Expand Up @@ -163,6 +164,10 @@ func CheckNodesTopology(ctx context.Context) error {
return fmt.Errorf("Following nodes have incoherent info in KubeletConfig/NRT data:\n%#v\n", errText)
}

if err := checkNRTsArePresentForAllNodes(ctx); err != nil {
return fmt.Errorf("an NRT object must be associated with each node: %v", err)
}

singleNUMANodeNRTs := e2enrt.FilterByTopologyManagerPolicy(nrtList.Items, intnrt.SingleNUMANode)
if len(singleNUMANodeNRTs) < minNumberOfNodesWithSameTopology {
return fmt.Errorf("Not enough nodes with %q topology (found:%d). Need at least %d", intnrt.SingleNUMANode, len(singleNUMANodeNRTs), minNumberOfNodesWithSameTopology)
Expand All @@ -178,3 +183,20 @@ func errorMapToString(errs map[string]error) string {
}
return sb.String()
}

func checkNRTsArePresentForAllNodes(ctx context.Context) error {
nodeList := v1.NodeList{}
if err := e2eclient.Client.List(ctx, &nodeList); err != nil {
return err
}
nrtList := nrtv1alpha2.NodeResourceTopologyList{}
if err := e2eclient.Client.List(ctx, &nrtList); err != nil {
return err
}
for _, node := range nodeList.Items {
if _, err := e2enrt.FindFromList(nrtList.Items, node.Name); err != nil {
return err
}
}
return nil
}
Loading