code: func ValidateNodeSelectorRequirement(rq api.NodeSelectorRequirement, fldPath *field.Path) field.ErrorList {
  	allErrs := field.ErrorList{}
  	switch rq.Operator {
  	case api.NodeSelectorOpIn, api.NodeSelectorOpNotIn:
  		if len(rq.Values) == 0 {
  			allErrs = append(allErrs, field.Required(fldPath.Child("values"), "must be specified when `operator` is 'In' or 'NotIn'"))
  		}
  	case api.NodeSelectorOpExists, api.NodeSelectorOpDoesNotExist:
  		if len(rq.Values) > 0 {
  			allErrs = append(allErrs, field.Forbidden(fldPath.Child("values"), "may not be specified when `operator` is 'Exists' or 'DoesNotExist'"))
  		}
  
  	case api.NodeSelectorOpGt, api.NodeSelectorOpLt:
  		if len(rq.Values) != 1 {
  			allErrs = append(allErrs, field.Required(fldPath.Child("values"), "must be specified single value when `operator` is 'Lt' or 'Gt'"))
  		}
  	default:
  		allErrs = append(allErrs, field.Invalid(fldPath.Child("operator"), rq.Operator, "not a valid selector operator"))
  	}
  	allErrs = append(allErrs, ValidateLabelName(rq.Key, fldPath.Child("key"))...)
  	return allErrs
  }
docs: // ValidateNodeSelectorRequirement tests that the specified NodeSelectorRequirement fields has valid data