mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
Check taints as well for control-plane
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
parent
b1341c8795
commit
ee64b30d05
@ -107,25 +107,38 @@ func logOSImages(ctx context.Context, f *framework.Framework) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isControlPlaneNode(node v1.Node) bool {
|
||||||
|
_, isControlPlane := node.Labels["node-role.kubernetes.io/control-plane"]
|
||||||
|
if isControlPlane {
|
||||||
|
framework.Logf("Node: %q is a control-plane node (label)", node.Name)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, taint := range node.Spec.Taints {
|
||||||
|
if taint.Key == "node-role.kubernetes.io/control-plane" {
|
||||||
|
framework.Logf("Node: %q is a control-plane node (taint)", node.Name)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
framework.Logf("Node: %q is NOT a control-plane node", node.Name)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func areGPUsAvailableOnAllSchedulableNodes(ctx context.Context, f *framework.Framework) bool {
|
func areGPUsAvailableOnAllSchedulableNodes(ctx context.Context, f *framework.Framework) bool {
|
||||||
framework.Logf("Getting list of Nodes from API server")
|
framework.Logf("Getting list of Nodes from API server")
|
||||||
nodeList, err := f.ClientSet.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
|
nodeList, err := f.ClientSet.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
|
||||||
framework.ExpectNoError(err, "getting node list")
|
framework.ExpectNoError(err, "getting node list")
|
||||||
for _, node := range nodeList.Items {
|
for _, node := range nodeList.Items {
|
||||||
if node.Spec.Unschedulable {
|
if node.Spec.Unschedulable || isControlPlaneNode(node) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
_, isControlPlane := node.Labels["node-role.kubernetes.io/control-plane"]
|
|
||||||
if isControlPlane {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
framework.Logf("gpuResourceName %s", gpuResourceName)
|
|
||||||
if val, ok := node.Status.Capacity[gpuResourceName]; !ok || val.Value() == 0 {
|
if val, ok := node.Status.Capacity[gpuResourceName]; !ok || val.Value() == 0 {
|
||||||
framework.Logf("Nvidia GPUs not available on Node: %q", node.Name)
|
framework.Logf("Nvidia GPUs not available on Node: %q", node.Name)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
framework.Logf("Nvidia GPUs exist on all schedulable nodes")
|
framework.Logf("Nvidia GPUs exist on all schedulable worker nodes")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user