package utils

import (
	"k8s.io/apimachinery/pkg/labels"
	"sigs.k8s.io/karpenter/pkg/cloudprovider"
)

// GetAllSingleValuedRequirementLabels returns a map of labels from the instance type's requirements
// that have single values (not sets or ranges)
func GetAllSingleValuedRequirementLabels(instanceType *cloudprovider.InstanceType) map[string]string {
	result := make(map[string]string)
	for _, req := range instanceType.Requirements {
		if len(req.Values) == 1 && req.Operator == labels.InOperator {
			result[req.Key] = req.Values[0]
		}
	}
	return result
}
