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 PR comments #8

Merged
merged 13 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fail fast on buildScalers when not able to resolve a secret (kedaco…
…re#2394)

Co-authored-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es>
Signed-off-by: Xiayang Wu <xwu@rippling.com>
  • Loading branch information
fivesheep and JorTurFer authored Jan 21, 2022
commit e44a31e2527e4016cd0441bf5ad274bc9e279c57
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
- **Kafka Scaler:** concurrently query brokers for consumer and producer offsets ([#2405](https://github.com/kedacore/keda/pull/2405))
- **External Scaler:** fix wrong calculation of retry backoff duration ([#2416](https://github.com/kedacore/keda/pull/2416))
- **Kafka Scaler:** allow flag `topic` to be optional, where lag of all topics within the consumer group will be used for scaling ([#2409](https://github.com/kedacore/keda/pull/2409))
- **General:** fail fast on `buildScalers` when not able to resolve a secret that a deployment is relying on ([#2394](https://github.com/kedacore/keda/pull/2394))
- **CPU Scaler:** Adding e2e test for the cpu scaler ([#2441](https://github.com/kedacore/keda/pull/2441))

### Breaking Changes
Expand Down
14 changes: 10 additions & 4 deletions pkg/scaling/scale_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ func (h *scaleHandler) GetScalersCache(ctx context.Context, scalableObject inter
return nil, err
}

scalers := h.buildScalers(ctx, withTriggers, podTemplateSpec, containerName)
scalers, err := h.buildScalers(ctx, withTriggers, podTemplateSpec, containerName)
if err != nil {
return nil, err
}

h.scalerCaches[key] = &cache.ScalersCache{
Generation: withTriggers.Generation,
Expand Down Expand Up @@ -273,7 +276,7 @@ func (h *scaleHandler) checkScalers(ctx context.Context, scalableObject interfac
}

// buildScalers returns list of Scalers for the specified triggers
func (h *scaleHandler) buildScalers(ctx context.Context, withTriggers *kedav1alpha1.WithTriggers, podTemplateSpec *corev1.PodTemplateSpec, containerName string) []cache.ScalerBuilder {
func (h *scaleHandler) buildScalers(ctx context.Context, withTriggers *kedav1alpha1.WithTriggers, podTemplateSpec *corev1.PodTemplateSpec, containerName string) ([]cache.ScalerBuilder, error) {
logger := h.logger.WithValues("type", withTriggers.Kind, "namespace", withTriggers.Namespace, "name", withTriggers.Name)
var err error
resolvedEnv := make(map[string]string)
Expand Down Expand Up @@ -313,7 +316,10 @@ func (h *scaleHandler) buildScalers(ctx context.Context, withTriggers *kedav1alp
if scaler != nil {
scaler.Close(ctx)
}
continue
for _, builder := range result {
builder.Scaler.Close(ctx)
}
return nil, err
}

result = append(result, cache.ScalerBuilder{
Expand All @@ -322,7 +328,7 @@ func (h *scaleHandler) buildScalers(ctx context.Context, withTriggers *kedav1alp
})
}

return result
return result, nil
}

func buildScaler(ctx context.Context, client client.Client, triggerType string, config *scalers.ScalerConfig) (scalers.Scaler, error) {
Expand Down