Skip to content

Commit

Permalink
Removed the need for deploymentName label (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppatierno authored Mar 2, 2020
1 parent e684118 commit ae4c437
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions pkg/controller/scaledobject/scaledobject_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,26 +280,11 @@ func checkDeploymentTypeScaledObject(scaledObject *kedav1alpha1.ScaledObject) (s
var errMsg string

deploymentName := scaledObject.Spec.ScaleTargetRef.DeploymentName
labelDeploymentName := scaledObject.Labels["deploymentName"]

if deploymentName == "" {
errMsg = "ScaledObject.spec.scaleTargetRef.deploymentName is missing"
}
if labelDeploymentName == "" {
if errMsg != "" {
errMsg += ", "
}
errMsg += "ScaledObject.metadata.labels.deploymentName is missing"
}
if deploymentName != "" && labelDeploymentName != "" &&
labelDeploymentName != deploymentName {
errMsg = errMsg + "ScaledObject.spec.scaleTargetRef.deploymentName and ScaledObject.metadata.labels.deploymentName are not equal"
}

if errMsg != "" {
err = fmt.Errorf(errMsg)
}

return deploymentName, err
}

Expand Down Expand Up @@ -357,11 +342,11 @@ func (r *ReconcileScaledObject) newHPAForScaledObject(logger logr.Logger, scaled
deploymentName := scaledObject.Spec.ScaleTargetRef.DeploymentName
scaledObjectMetricSpecs, err := r.getScaledObjectMetricSpecs(logger, scaledObject, deploymentName)
labels := map[string]string{
"app.kubernetes.io/name": getHpaName(deploymentName),
"app.kubernetes.io/version": version.Version,
"app.kubernetes.io/part-of": scaledObject.GetName(),
"app.kubernetes.io/name": getHpaName(deploymentName),
"app.kubernetes.io/version": version.Version,
"app.kubernetes.io/part-of": scaledObject.GetName(),
"app.kubernetes.io/managed-by": "keda-operator",
}
}

if err != nil {
return nil, err
Expand Down

0 comments on commit ae4c437

Please sign in to comment.