diff --git a/internal/annotations.go b/internal/annotations.go index d843246..05a334b 100644 --- a/internal/annotations.go +++ b/internal/annotations.go @@ -19,8 +19,9 @@ import ( ) const ( - AnnotationPrefix = "k8s.score.dev/" - WorkloadKindAnnotation = AnnotationPrefix + "kind" + AnnotationPrefix = "k8s.score.dev/" + WorkloadKindAnnotation = AnnotationPrefix + "kind" + WorkloadServiceNameAnnotation = AnnotationPrefix + "service-name" ) func ListAnnotations(metadata map[string]interface{}) []string { diff --git a/internal/convert/workloads.go b/internal/convert/workloads.go index dd27921..59abe22 100644 --- a/internal/convert/workloads.go +++ b/internal/convert/workloads.go @@ -280,7 +280,10 @@ func ConvertWorkload(state *project.State, workloadName string) ([]machineryMeta } func WorkloadServiceName(workloadName string) string { - return fmt.Sprintf("%s", workloadName) + if d, ok := internal.FindAnnotation(spec.Metadata, internal.WorkloadServiceNameAnnotation); ok { + return d + } + return workloadName } func buildProbe(input scoretypes.HttpProbe) coreV1.ProbeHandler {