func PartitionObjectTemplates()

in pkg/options/common.go [46:70]


func PartitionObjectTemplates(allObjects []*unstructured.Unstructured, templateKind string) ([]*unstructured.Unstructured, []*unstructured.Unstructured) {
	var match []*unstructured.Unstructured
	var notMatch []*unstructured.Unstructured
	for _, obj := range allObjects {
		if obj.GetKind() != "ObjectTemplate" {
			notMatch = append(notMatch, obj)
			continue
		}

		var templateType string
		objData := obj.Object["type"]
		templateType, isString := objData.(string)
		if !isString {
			notMatch = append(notMatch, obj)
			continue
		}

		if templateType == templateKind {
			match = append(match, obj)
		} else {
			notMatch = append(notMatch, obj)
		}
	}
	return match, notMatch
}