Skip to content

Commit

Permalink
Fix KEDA generated hpa label
Browse files Browse the repository at this point in the history
  • Loading branch information
anggao committed Feb 22, 2021
1 parent a71a7a6 commit 836e154
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/hpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"fmt"
"sort"
"strings"
"unicode"

"github.com/go-logr/logr"
version "github.com/kedacore/keda/v2/version"
Expand Down Expand Up @@ -58,6 +60,9 @@ func (r *ScaledObjectReconciler) newHPAForScaledObject(logger logr.Logger, scale
labelName := getHPAName(scaledObject)
if len(labelName) > 63 {
labelName = labelName[:63]
labelName = strings.TrimRightFunc(labelName, func(r rune) bool {
return !unicode.IsLetter(r) && !unicode.IsNumber(r)
})
}
labels := map[string]string{
"app.kubernetes.io/name": labelName,
Expand Down

0 comments on commit 836e154

Please sign in to comment.