util: add ValidNode variant without sched check
this adds a variant of ValidNode that doesn't check for no-sched taint (e.g. kubectl cordon). Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
This commit is contained in:
1 parent
928c4a01da
commit
60cace8f7b
1 file changed
+13
-7
@@ -36,13 +36,9 @@ var validTopologyLabelKeys = []string{
|
||||
"failure-domain.kubernetes.io",
|
||||
}
|
||||
|
||||
// ValidNode returns true if the node (1) is schedulable, (2) meets Rook's placement terms, and
|
||||
// (3) is ready. False otherwise.
|
||||
func ValidNode(node v1.Node, placement rookalpha.Placement) (bool, error) {
|
||||
if !GetNodeSchedulable(node) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// ValidNodeNoSched returns true if the node (1) meets Rook's placement terms,
|
||||
// and (2) is ready. False otherwise.
|
||||
func ValidNodeNoSched(node v1.Node, placement rookalpha.Placement) (bool, error) {
|
||||
p, err := NodeMeetsPlacementTerms(node, placement, false)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to check if node meets Rook placement terms. %+v", err)
|
||||
@@ -58,6 +54,16 @@ func ValidNode(node v1.Node, placement rookalpha.Placement) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// ValidNode returns true if the node (1) is schedulable, (2) meets Rook's placement terms, and
|
||||
// (3) is ready. False otherwise.
|
||||
func ValidNode(node v1.Node, placement rookalpha.Placement) (bool, error) {
|
||||
if !GetNodeSchedulable(node) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return ValidNodeNoSched(node, placement)
|
||||
}
|
||||
|
||||
// GetValidNodes returns all nodes that (1) are not cordoned, (2) meet Rook's placement terms, and
|
||||
// (3) are ready.
|
||||
func GetValidNodes(rookStorage rookalpha.StorageScopeSpec, clientset kubernetes.Interface, placement rookalpha.Placement) []rookalpha.Node {
|
||||
|
||||
Reference in new issue
Block a user