func labelsForCluster(
	cr *kdv1.KubeDirectorCluster,
) map[string]string {
	result := map[string]string{
		shared.ClusterLabel:    cr.Name,
		ClusterAppLabel:        cr.Spec.AppID,
		ClusterAppCatalogLabel: *(cr.Spec.AppCatalog),
	}
	return result
}
labelsForCluster generates a set of resource labels appropriate for any
component of this KDCluster.
package executor
import (
	"strings"
	kdv1 "github.com/bluek8s/kubedirector/pkg/apis/kubedirector/v1beta1"
	"github.com/bluek8s/kubedirector/pkg/catalog"
	"github.com/bluek8s/kubedirector/pkg/shared"
)
const nameLengthLimit = 46
func annotationsForCluster(
	cr *kdv1.KubeDirectorCluster,
) map[string]string {
	var result map[string]string
	appCR, err := catalog.GetApp(cr)
	if err == nil {
		result = map[string]string{
			ClusterAppAnnotation: appCR.Spec.Label.Name,
		}
	} else {
		result = map[string]string{}
	}
	return result
}
func annotationsForRole(
	cr *kdv1.KubeDirectorCluster,
	role *kdv1.Role,
) map[string]string {
	return annotationsForCluster(cr)
}
func annotationsForStatefulSet(
	cr *kdv1.KubeDirectorCluster,
	role *kdv1.Role,
) map[string]string {
	return annotationsForRole(cr, role)
}
func annotationsForPod(
	cr *kdv1.KubeDirectorCluster,
	role *kdv1.Role,
) map[string]string {
	result := annotationsForStatefulSet(cr, role)
	for name, value := range role.PodAnnotations {
		result[name] = value
	}
	for globalName, globalValue := range shared.GetPodAnnotations() {
		result[globalName] = globalValue
	}
	return result
}
func annotationsForService(
	cr *kdv1.KubeDirectorCluster,
	role *kdv1.Role,
) map[string]string {
	var result map[string]string
	if role == nil {
		result = annotationsForCluster(cr)
	} else {
		result = annotationsForRole(cr, role)
		for name, value := range role.ServiceAnnotations {
			result[name] = value
		}
		for globalName, globalValue := range shared.GetServiceAnnotations() {
			result[globalName] = globalValue
		}
	}
	return result
}