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

Removed the need for deploymentName label #644

Merged
merged 1 commit into from
Mar 2, 2020
Merged
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
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