Skip to content

Commit

Permalink
Create a new WorkloadServiceNameAnnotation to allow the override of t…
Browse files Browse the repository at this point in the history
…he Service name
  • Loading branch information
mathieu-benoit committed Sep 6, 2024
1 parent fbf4e80 commit ce7e8d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions internal/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion internal/convert/workloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Check failure on line 283 in internal/convert/workloads.go

View workflow job for this annotation

GitHub Actions / test

undefined: spec
return d
}
return workloadName
}

func buildProbe(input scoretypes.HttpProbe) coreV1.ProbeHandler {
Expand Down

0 comments on commit ce7e8d5

Please sign in to comment.