Skip to content

Commit

Permalink
HPA: label can have max 63 chars (#707)
Browse files Browse the repository at this point in the history
Signed-off-by: Zbynek Roubalik <[email protected]>
  • Loading branch information
zroubalik authored Mar 31, 2020
1 parent d32b668 commit 55a8373
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/controller/scaledobject/scaledobject_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,16 @@ func (r *ReconcileScaledObject) scaledObjectGenerationChanged(logger logr.Logger
func (r *ReconcileScaledObject) newHPAForScaledObject(logger logr.Logger, scaledObject *kedav1alpha1.ScaledObject) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) {
deploymentName := scaledObject.Spec.ScaleTargetRef.DeploymentName
scaledObjectMetricSpecs, err := r.getScaledObjectMetricSpecs(logger, scaledObject, deploymentName)

// label can have max 63 chars
labelName := ""
if len(getHpaName(deploymentName)) > 63 {
labelName = getHpaName(deploymentName)[:63]
} else {
labelName = getHpaName(deploymentName)
}
labels := map[string]string{
"app.kubernetes.io/name": getHpaName(deploymentName),
"app.kubernetes.io/name": labelName,
"app.kubernetes.io/version": version.Version,
"app.kubernetes.io/part-of": scaledObject.GetName(),
"app.kubernetes.io/managed-by": "keda-operator",
Expand Down

0 comments on commit 55a8373

Please sign in to comment.