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

fail fast on buildScalers when not able to resolve a secret #2394

Merged
merged 4 commits into from
Jan 21, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
14 changes: 10 additions & 4 deletions pkg/scaling/scale_handler.go
Original file line number Diff line number Diff line change
@@ -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,
@@ -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)
@@ -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{
@@ -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) {