[CASCL-506] Allow minReplicas=0 on DatadogPodAutoscaler#3048
Open
avolant wants to merge 1 commit into
Open
Conversation
Relax the kubebuilder validation on DatadogPodAutoscalerConstraints.MinReplicas from Minimum=1 to Minimum=0 to admit scale-to-zero configurations. The horizontal controller already honors any non-nil MinReplicas value (default of 1 only applies when unset), so this is purely an admission relaxation. Scale-from-zero remains gated on the recommendation source being able to emit signals at 0 replicas (e.g. queue-based metrics); CPU-based recommendations are unusable at 0 pods. Regenerated CRDs (DatadogPodAutoscaler v1alpha1 + v1alpha2 and DatadogPodAutoscalerClusterProfile) via 'make manifests'. Refs: https://datadoghq.atlassian.net/browse/CASCL-506
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3048 +/- ##
=======================================
Coverage 42.36% 42.36%
=======================================
Files 337 337
Lines 28964 28964
=======================================
Hits 12272 12272
Misses 15887 15887
Partials 805 805
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Relaxes the kubebuilder validation on
DatadogPodAutoscalerConstraints.MinReplicasfromMinimum=1toMinimum=0, so aDatadogPodAutoscaler(andDatadogPodAutoscalerClusterProfile) withspec.constraints.minReplicas: 0is admitted by the API server. CRDs were regenerated viamake manifests.Motivation
Refs https://datadoghq.atlassian.net/browse/CASCL-506 (feature request: support horizontal scale from/to 0).
We hit this in dd-analytics while experimenting with DPA on Airflow Celery worker groups. Workers are queue-driven and idle between DAG runs, so scaling to 0 between bursts is a clear cost win. The CRD currently rejects this configuration outright:
```
DatadogPodAutoscaler.datadoghq.com "airflow-wg-adp-integrations" is invalid:
spec.constraints.minReplicas: Invalid value: 0:
spec.constraints.minReplicas in body should be greater than or equal to 1
```
This PR removes the admission-level block. It is intentionally a minimal change to unblock experimentation/design work on CASCL-506; it does not by itself make scale-from-0 work end-to-end -- see Additional Notes.
Additional Notes
pkg/clusteragent/autoscaling/workload/controller_horizontal.go) already honors any non-nilMinReplicas. The hardcodeddefaultMinReplicas = 1only applies when the field is unset, so this is purely an admission relaxation -- no controller code change is required.(running + queued) / replicasis undefined at 0 replicas. Queue-length-style external metrics work because the source is external to the workload.MinReplicasgodoc to call this out explicitly so users don't expect magic scale-up behavior just from settingminReplicas: 0.Minimum Agent Versions
No agent-side changes are required for this PR (controller already accepts the value). Mentioning for completeness:
Describe your test plan
Manual verification (suggested for reviewer): apply the regenerated CRD to a kind cluster, then `kubectl apply` a DPA with `spec.constraints.minReplicas: 0` and confirm admission succeeds; apply one with `-1` and confirm it is still rejected.
Checklist