Skip to content

docs: clarify revisionHistoryLimit applies to Knative mode - #183

Open
nelonmelons wants to merge 1 commit into
restatedev:mainfrom
nelonmelons:docs/revision-history-limit-knative
Open

docs: clarify revisionHistoryLimit applies to Knative mode#183
nelonmelons wants to merge 1 commit into
restatedev:mainfrom
nelonmelons:docs/revision-history-limit-knative

Conversation

@nelonmelons

Copy link
Copy Markdown

What

Corrects the spec.revisionHistoryLimit documentation, which still says "Only used in ReplicaSet mode" even though the Knative reconciler now honours it.

Why

While chasing idle pods from accumulated Knative revisions I filed #182, believing there was no operator-side retention for Knative Configurations. Reading main more carefully, that turned out to be wrong: cleanup_old_configurations already bounds retained Configurations with spec.revision_history_limit (added recently in 0459f15, "Cleanup: fix deletion hang"):

// src/controllers/restatedeployment/reconcilers/knative.rs
if retain_for_rollback(mode, historic_count, rsd.spec.revision_history_limit) {
    historic_count += 1;
    // ... keep within limit
}
// else: deregister from Restate + delete the Configuration

The field doc, however, still reads "The number of old ReplicaSets to retain to allow rollback. Only used in ReplicaSet mode." That description is what led me (and I suspect others) to believe the limit does nothing in Knative mode, so old drained Configurations look unbounded.

Change

Documentation only. Rewords the field on the struct and mirrors it into the generated crd/restatedeployments.yaml and crd/RestateDeployment.pkl to say it applies to both modes, and adds the Knative-specific caveat: a retained Configuration keeps running its minScale pods (Knative cannot rescale an existing Revision), so services with a high minScale should lower this to avoid idle pods held only for rollback.

Note on generated files

I don't have cargo / pkl available in my environment, so crd/restatedeployments.yaml and crd/RestateDeployment.pkl were updated by hand to match the struct doc comment. Please run just generate / just generate-pkl to confirm the exact formatting matches. No Rust logic changed, so cargo clippy / cargo test are unaffected.

Possible follow-up (not in this PR)

The default of 10 is cheap for ReplicaSets (scaled to zero) but expensive in Knative, where each retained Configuration holds minScale pods. A lower Knative default, or scaling non-latest retained Configurations down, might be worth considering. Happy to follow up if that's of interest.

Refs #182.

The Knative reconciler already bounds retained Configurations with
spec.revisionHistoryLimit (cleanup_old_configurations, added in 0459f15), but
the CRD field doc still said "Only used in ReplicaSet mode". That wrongly
implies there is no operator-side retention for Knative when the field already
governs both modes.

Correct the description on the struct and the generated CRD + pkl, and note the
Knative-specific cost: a retained Configuration keeps its minScale pods because
Knative cannot rescale an existing Revision, so high-minScale services should
lower this.

Refs restatedev#182
@github-actions

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant