Repository navigation
Add configurable revisionHistoryLimit to Druid node spec - #24
Closed
aruraghuwanshi wants to merge 4 commits into
Closed
aruraghuwanshi wants to merge 4 commits into
aruraghuwanshi wants to merge 4 commits into
Conversation
Expose an optional `revisionHistoryLimit` on the Druid node spec and wire it into both the generated Deployment and StatefulSet. When unset, the Kubernetes default of 10 is preserved, so the change is non-breaking. Bounding the retained history lets Kubernetes garbage-collect superseded ReplicaSets (Deployment node types) and ControllerRevisions (StatefulSet node types) that otherwise keep pod-template references to old container image tags. Those stale tags can linger in runtime/CSPM/3PP image inventories even though the workloads are scaled to zero and not running. Signed-off-by: Aru Raghuwanshi <aruraghuwanshi@gmail.com>
Cover the revisionHistoryLimit wiring in makeStatefulSet / makeDeployment: - set on a StatefulSet node spec -> generated StatefulSet carries the value - set on a Deployment node spec -> generated Deployment carries the value - unset -> nil, preserving the Kubernetes default Signed-off-by: Aru Raghuwanshi <aruraghuwanshi@gmail.com>
Author
|
nudge on the workflow-approval @AdheipSingh when you get a chance. Thank you! |
Make the new optional field discoverable to reviewers and users. Signed-off-by: Aru Raghuwanshi <aruraghuwanshi@gmail.com>
…s StatefulSet ReplicaSets apply to Deployment node types; StatefulSet node types retain ControllerRevisions instead. Reword the example comment to avoid conflating them. Signed-off-by: Aru Raghuwanshi <aruraghuwanshi@gmail.com>
aruraghuwanshi
added a commit
to aruraghuwanshi/druid-operator
that referenced
this pull request
Jun 11, 2026
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.
Expose an optional
revisionHistoryLimiton the Druid node spec and wire it into both the generated Deployment and StatefulSet. When unset, the Kubernetes default of 10 is preserved, so the change is non-breaking.Bounding the retained history lets Kubernetes garbage-collect superseded ReplicaSets (Deployment node types) and ControllerRevisions (StatefulSet node types) that otherwise keep pod-template references to old container image tags. For Deployment node types in particular, those superseded scaled-to-zero ReplicaSets are first-class workload objects, so the old tags they pin can show up in container image inventories and security scanners as "in use" even though nothing is running them.
Description
Problem. By default Kubernetes retains up to 10 superseded, scaled-to-zero ReplicaSets (Deployment node types) / ControllerRevisions (StatefulSet node types) per workload. Each one keeps a pod-template reference to an old container image tag, so those tags keep showing up in image inventories and scanners long after the workload has moved on and is no longer running — inflating "in-use image" counts with versions that aren't actually running anywhere.
Solution. Add an optional
revisionHistoryLimit(*int32) to the Druid node spec and pass it through to the generated workload'sspec.revisionHistoryLimit. Because it is a pointer withomitempty, leaving it unset yieldsnil, which preserves the Kubernetes default (10) — fully backward-compatible and opt-in per node type.Behavior.
nil→ Kubernetes default (10) → no change for existing clusters.revisionHistoryLimitis a freely-mutable field on both Deployments and StatefulSets and is not part of the pod template, so setting or changing it does not by itself trigger a pod rollout — Kubernetes just garbage-collects the excess history.Validation. Verified end-to-end on a local
kindcluster (Kubernetes v1.35) by building this change and exercising a router node configured as aDeployment:revisionHistoryLimit: 4on the node spec propagated to the generated Deployment (spec.revisionHistoryLimit: 4) within ~3s; the value is stored on the CR (not pruned by the CRD).10.This PR has:
Key changed/added files in this PR
apis/druid/v1alpha1/druid_types.go— add optionalRevisionHistoryLimit *int32to the node speccontrollers/druid/handler.go— pass the value through inmakeDeploymentSpecandmakeStatefulSetSpeccontrollers/druid/handler_test.go— unit tests (set on a Deployment/StatefulSet node → generated object carries the value; unset →nil)examples/tiny-cluster.yaml— example usage + comment clarifying ReplicaSets (Deployment) vs ControllerRevisions (StatefulSet)apis/druid/v1alpha1/zz_generated.deepcopy.go,config/crd/bases/druid.apache.org_druids.yaml,chart/crds/druid.apache.org_druids.yaml— generated (deepcopy + CRDs)