func MatchNodeSelectorTerms(
	nodeSelectorTerms []v1.NodeSelectorTerm,
	nodeLabels labels.Set,
	nodeFields fields.Set,
) bool {
	for _, req := range nodeSelectorTerms {
		// nil or empty term selects no objects
		if len(req.MatchExpressions) == 0 && len(req.MatchFields) == 0 {
			continue
		}

		if len(req.MatchExpressions) != 0 {
			labelSelector, err := NodeSelectorRequirementsAsSelector(req.MatchExpressions)
			if err != nil || !labelSelector.Matches(nodeLabels) {
				continue
			}
		}

		if len(req.MatchFields) != 0 {
			fieldSelector, err := NodeSelectorRequirementsAsFieldSelector(req.MatchFields)
			if err != nil || !fieldSelector.Matches(nodeFields) {
				continue
			}
		}

		return true
	}

	return false
}
// MatchNodeSelectorTerms checks whether the node labels and fields match node selector terms in ORed;
// nil or empty term matches no objects.
MatchNodeSelectorTerms checks whether the node labels and fields match node selector terms in ORed;
nil or empty term matches no objects.
// MatchNodeSelectorTerms checks whether the node labels and fields match node selector terms in ORed ; // nil or empty term matches no objects .
func MatchNodeSelectorTerms(
	nodeSelectorTerms []v1.NodeSelectorTerm,
	nodeLabels labels.Set,
	nodeFields fields.Set,
) bool {
	for _, req := range nodeSelectorTerms {
		if len(req.MatchExpressions) == 0 && len(req.MatchFields) == 0 {
			continue
		}
		if len(req.MatchExpressions) != 0 {
			labelSelector, err := NodeSelectorRequirementsAsSelector(req.MatchExpressions)
			if err != nil || !labelSelector.Matches(nodeLabels) {
				continue
			}
		}
		if len(req.MatchFields) != 0 {
			fieldSelector, err := NodeSelectorRequirementsAsFieldSelector(req.MatchFields)
			if err != nil || !fieldSelector.Matches(nodeFields) {
				continue
			}
		}
		return true
	}
	return false
}
func MatchNodeSelectorTerms ( nodeSelectorTerms [ ] v1 . NodeSelectorTerm , nodeLabels labels . Set , nodeFields fields . Set , ) bool { for _ , req := range nodeSelectorTerms { if len ( req . MatchExpressions ) == 0 && len ( req . MatchFields ) == 0 { continue } if len ( req . MatchExpressions ) != 0 { labelSelector , err := NodeSelectorRequirementsAsSelector ( req . MatchExpressions ) if err != nil || ! labelSelector . Matches ( nodeLabels ) { continue } } if len ( req . MatchFields ) != 0 { fieldSelector , err := NodeSelectorRequirementsAsFieldSelector ( req . MatchFields ) if err != nil || ! fieldSelector . Matches ( nodeFields ) { continue } } return true } return false }
MatchNodeSelectorTerms checks whether the node labels and fields match node selector terms in ORed;
nil or empty term matches no objects.
MatchNodeSelectorTerms checks whether the node labels and fields match node selector terms in ORed ; nil or empty term matches no objects .
// nil or empty term selects no objects