Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix KEDA generated hpa label #1631

Merged
merged 2 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- Add container port for Prometheus on operator YAML ([#1562](https://github.com/kedacore/keda/pull/1562))
- Fix a memory leak in kafka client and close push scalers ([#1565](https://github.com/kedacore/keda/issues/1565))
- Add 'Metadata' header to AAD podIdentity request ([#1566](https://github.com/kedacore/keda/issues/1566))
- KEDA should make sure generate correct labels for HPA ([#1630](https://github.com/kedacore/keda/issues/1630))

### Breaking Changes

Expand Down
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