Skip to content

update EtcdBackendQuota feature#2031

Open
atiratree wants to merge 1 commit into
openshift:masterfrom
atiratree:EtcdBackendQuota
Open

update EtcdBackendQuota feature#2031
atiratree wants to merge 1 commit into
openshift:masterfrom
atiratree:EtcdBackendQuota

Conversation

@atiratree

Copy link
Copy Markdown
Member

No description provided.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 3, 2026
@openshift-ci
openshift-ci Bot requested review from benluddy and jaypoulz June 3, 2026 13:25
@openshift-ci

openshift-ci Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign dustymabe for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@atiratree
atiratree force-pushed the EtcdBackendQuota branch 2 times, most recently from d5e7f93 to 7c17dce Compare June 3, 2026 14:22
Comment thread enhancements/etcd/etcd-size-tuning.md Outdated
Decreasing the quota has the following benefits:
- The DB size has a big impact on the memory usage. Decreasing the quota will limit the memory usage.
This can prevent further cluster performance degradation
- During a cluster revert to a former state (downgrade, backup/restore) it might be beneficial to keep the old value. This also affects alerts / expectations and other metrics.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downgrades should not be a factor as the CVO does not allow y-stream downgrades (since 4.14 or so); only z-stream from the one version previous to an upgrade.

Backup and restore should also not be a factor since restoring effectively moves the cluster back in time. Since this is a wholly destructive process, it does not matter what the current quota or current size is, they'll be reverted to the previous quota and all objects in etcd will be replaced with the previous state.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might also include partial backup/restore done by other tools. Nevertheless, I removed it as it is not the most important flow. I am only highlighting the memory impact now.

Comment thread enhancements/etcd/etcd-size-tuning.md Outdated
Comment thread enhancements/etcd/etcd-size-tuning.md Outdated
* Allow configuration of the backend limit via human readable units: 16GiB.
* Add an API to allow admins to change the value.
* The backend limit can only be increased and not decreased.
* The backend cannot be decreased below the current DB size.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the general context of allowing decreases. I'm wondering if that should be a separate, future enhancement, and that we should just focus on getting the GA of this feature as-is.

Like with the lower max limitation, it's allowable to relax constraints in z-streams which I would argue this would be.

I think, in general, the customers asking for this feature are doing so because they're running against the current quota and wish to increase it forever. Given the memory consumption implications of increasing the quota (and using the headroom gained by increasing the quota), ensuring the sizing of the nodes prior to increase is essential, and I think that many, if not all, customers will view this as a one-time option. Because of those implications and requirements, the node will be sized larger anyway, regardless of what the quota is. Meaning, if they provision nodes that can handle 16GiB size-on-disk (and set the quota to 16GiB), and they're only using 12GiB on-disk. They would then need to re-provision the node to be smaller: just changing the quota doesn't directly effect how much memory or storage etcd takes, it's just a limit.

That is all to say, I don't know if allowing decrease is a feature that will be used, and in my opinion, it would be better to wait for a customer to ask for it - so we know there's a usecase - before putting in the work to implement it for this release cycle.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think, downsizing your cluster in order to reduce cost is still relevant part of the story, but it can be done later. I agree that the feature can be pushed as is, to not postpone the graduation. I moved the Quota decrease story to the Alternatives.

Comment thread enhancements/etcd/etcd-size-tuning.md Outdated
@atiratree
atiratree force-pushed the EtcdBackendQuota branch 3 times, most recently from 3f5c998 to ba89826 Compare June 11, 2026 10:10
Comment thread enhancements/etcd/etcd-size-tuning.md Outdated

In general increasing the quota is done in response to increased demand on the cluster.
Decreasing or reverting the quota is unlikely to happen often, but it has the following benefit:
- The DB size has a big impact on the memory usage. Decreasing the quota will limit the memory usage.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decreasing the quota will limit the memory usage

That's slightly misleading. Decreasing the quota would allow a customer to downsize a node (to reduce cost) which I think we should highlight as the main motivation of this enhancement; just changing the quota only affects the etcd instances if they're above/at the quota: then they can't write, but if they're below the large quota, their memory usage is no different than if the quota was smaller.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, I updated this part. Changing the quota has to used correctly together with monitoring IMO, to get the main benefit. I am keeping this there, but the downsizing is also important. Please let me know if I should highlight it further.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your update is clearer!

@dusk125

dusk125 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

I think this is ready to move out of WIP

@atiratree
atiratree force-pushed the EtcdBackendQuota branch 2 times, most recently from f118fd3 to a7c4b54 Compare July 14, 2026 09:53
@atiratree atiratree changed the title WIP: update EtcdBackendQuota feature update EtcdBackendQuota feature Jul 14, 2026
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 14, 2026
@atiratree

Copy link
Copy Markdown
Member Author

Ack, removed the WIP and answered the open question about snapshot syncing/recovery.

@dusk125

dusk125 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 14, 2026
@atiratree

Copy link
Copy Markdown
Member Author

/hold
for some time to asses the results of the ongoing defrag work

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 16, 2026
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 23, 2026
@atiratree

Copy link
Copy Markdown
Member Author

/hold cancel
the graduation update should be ready

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 23, 2026
@dusk125

dusk125 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 23, 2026
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@atiratree: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@hasbro17 hasbro17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just a few nits and one question on the defrag timings.

// +kubebuilder:validation:Minimum=0
// +openshift:enable:FeatureGate=EtcdBackendQuota
// +optional
BackendSizeKiB *int64 `json:"backendSizeMiB"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, if you meant KiB here:

Suggested change
BackendSizeKiB *int64 `json:"backendSizeMiB"`
BackendSizeKiB *int64 `json:"backendSizeKiB"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be a resource.Quota instead so that it's a bit more human readable?


- If the user attempts to set the quota to an invalid value (not in the form of a resource quantity (e.g. 8GiB, etc)), the API will not accept the value and return an error.
- If the user attempts to set the quota to a lower value than the current (e.g. 21GiB -> 16GiB), the API will not accept the value and return an error.
- If the user attempts to set the quota to a lower value than the current DB size (e.g. 21GiB -> 16GiB), the API will not accept the value and return an error.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the validation today:

// +kubebuilder:validation:XValidation:rule="self>=oldSelf",message="etcd backendQuotaGiB may not be decreased"

We're not allowing any decrease period, not just lower than the current DB size right?
This wording makes it seem like we can decrease the quota, just not lower than the current DB size.

If I'm correct then perhaps something more clear like:

Suggested change
- If the user attempts to set the quota to a lower value than the current DB size (e.g. 21GiB -> 16GiB), the API will not accept the value and return an error.
- If the user attempts to decrease the quota (e.g. 16GiB -> 8GiB), the API will not accept the value and return an error — the backend quota cannot be lowered once set.


**Note:** *Section not required until targeted at a release.*

None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have it defined now

Suggested change
None


## Upgrade / Downgrade Strategy

N/A

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still says N/A. We should probably explain why before going GA.

Can we capture #2031 (comment) here.

Perhaps something like:

Suggested change
No special handling is required. The `backendQuotaGiB` field and its value are preserved across upgrades and z-stream rollbacks. Y-stream downgrades are not supported by the CVO. If a z-stream rollback occurs, the operator continues to respect the configured quota value.

Or anything else that I missed.

Comment on lines 207 to 208
* How long does it take to compact & defrag a database of a given size?
* Defragmentation will pause writes to etcd, reads from etcd will be unaffected.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker but for a GA feature where larger DBs will make defrag
take longer this seems like it would be useful to somewhat answer this.

Given that we previously held this to asses defrag timing impact (#2031 (comment)) did we ever capture that anywhere?
If so it might be good to list that out in the Risks section similar to the snapshot sync timings.

Or closing the question with a note if we've determined that this is workload dependent enough that the numbers aren't too meaningful.
And that the automated defrag in the etcd-operator makes it less of an admin facing concern.

- None
creation-date: 2024-01-24
last-updated: 2024-03-12
last-updated: 2026-06-11

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this should match your commit date I think.
2026-07-23 currently. Or whatever the next one is if you do update.

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

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants