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

For the getScaler method wished to pass the entire scaler object since some parameters are required for new scalers. Currently, only scaledObject name and namespace is passed. #811

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 4 additions & 4 deletions pkg/handler/scale_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (h *ScaleHandler) GetDeploymentScalers(scaledObject *kedav1alpha1.ScaledObj
authParams["awsRoleArn"] = deployment.Spec.Template.ObjectMeta.Annotations[kedav1alpha1.PodIdentityAnnotationKiam]
}

scaler, err := h.getScaler(scaledObject.Name, scaledObject.Namespace, trigger.Type, resolvedEnv, trigger.Metadata, authParams, podIdentity)
scaler, err := h.getScaler(scaledObject, trigger.Type, resolvedEnv, trigger.Metadata, authParams, podIdentity)
if err != nil {
closeScalers(scalersRes)
return []scalers.Scaler{}, nil, fmt.Errorf("error getting scaler for trigger #%d: %s", i, err)
Expand All @@ -250,7 +250,7 @@ func (h *ScaleHandler) getJobScalers(scaledObject *kedav1alpha1.ScaledObject) ([

for i, trigger := range scaledObject.Spec.Triggers {
authParams, podIdentity := h.parseJobAuthRef(trigger.AuthenticationRef, scaledObject)
scaler, err := h.getScaler(scaledObject.Name, scaledObject.Namespace, trigger.Type, resolvedEnv, trigger.Metadata, authParams, podIdentity)
scaler, err := h.getScaler(scaledObject, trigger.Type, resolvedEnv, trigger.Metadata, authParams, podIdentity)
if err != nil {
closeScalers(scalersRes)
return []scalers.Scaler{}, fmt.Errorf("error getting scaler for trigger #%d: %s", i, err)
Expand Down Expand Up @@ -310,7 +310,7 @@ func (h *ScaleHandler) parseAuthRef(triggerAuthRef *kedav1alpha1.ScaledObjectAut
return result, podIdentity
}

func (h *ScaleHandler) getScaler(name, namespace, triggerType string, resolvedEnv, triggerMetadata, authParams map[string]string, podIdentity string) (scalers.Scaler, error) {
func (h *ScaleHandler) getScaler(scaledObject *kedav1alpha1.ScaledObject, triggerType string, resolvedEnv, triggerMetadata, authParams map[string]string, podIdentity string) (scalers.Scaler, error) {
switch triggerType {
case "azure-queue":
return scalers.NewAzureQueueScaler(resolvedEnv, triggerMetadata, authParams, podIdentity)
Expand All @@ -335,7 +335,7 @@ func (h *ScaleHandler) getScaler(name, namespace, triggerType string, resolvedEn
case "gcp-pubsub":
return scalers.NewPubSubScaler(resolvedEnv, triggerMetadata)
case "external":
return scalers.NewExternalScaler(name, namespace, resolvedEnv, triggerMetadata)
return scalers.NewExternalScaler(scaledObject.Name, scaledObject.Namespace, resolvedEnv, triggerMetadata)
case "liiklus":
return scalers.NewLiiklusScaler(resolvedEnv, triggerMetadata)
case "stan":
Expand Down