Skip to content

docs: document ResourceQuota interaction for init container accounting. - #2535

Merged
hami-robot[bot] merged 2 commits into
Project-HAMi:masterfrom
maishivamhoo123:docs/init-container-resourcequota
Aug 11, 2026
Merged

docs: document ResourceQuota interaction for init container accounting.#2535
hami-robot[bot] merged 2 commits into
Project-HAMi:masterfrom
maishivamhoo123:docs/init-container-resourcequota

Conversation

@maishivamhoo123

@maishivamhoo123 maishivamhoo123 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Thia Pr will close the #2533
Added a section to docs/develop/initContainer-design.md explaining the
resource-calculation difference between quota-enabled and non-quota scenarios.
As suggested by @DSFans2014 and @archlitchi in #1773 Comment
HAMi shrinks usage after init containers complete, while the kube-apiserver's ResourceQuota plugin holds the effective request for the pod's entire lifetime.

Summary by CodeRabbit

  • Documentation
    • Clarified how Kubernetes ResourceQuota accounts for pod resources when init containers are present.
    • Documented that quota usage remains reserved until pod deletion, even after init containers complete.
    • Added an example explaining why Kubernetes may reject a pod before HAMi processing when quota usage is reserved.
    • Explained that init-container completion changes only HAMi accounting, not Kubernetes quota reservations.

Signed-off-by: maishivamhoo123 <maishivamhoo@gmail.com>
@hami-robot
hami-robot Bot requested review from FouoF and mesutoezdil August 10, 2026 09:33
@github-actions github-actions Bot added the kind/documentation Improvements or additions to documentation label Aug 10, 2026
@hami-robot hami-robot Bot added the size/S label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e07b5f12-f088-4d08-ad3d-b83cccbf4902

📥 Commits

Reviewing files that changed from the base of the PR and between 67fc3c2 and 0464704.

📒 Files selected for processing (1)
  • docs/develop/initContainer-design.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/develop/initContainer-design.md

📝 Walkthrough

Walkthrough

The design documents Kubernetes ResourceQuota behavior for init-container requests. It clarifies that HAMi’s post-init usage shrink affects only HAMi accounting.

Changes

ResourceQuota accounting documentation

Layer / File(s) Summary
Document ResourceQuota retention
docs/develop/initContainer-design.md
The design states that Kubernetes charges the effective init/app request at pod creation and retains the charge until terminal completion or deletion. It preserves the terminal-phase usage reset of 0 and notes that later pods may be rejected before HAMi processes them.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers: archlitchi

Poem

A rabbit checks the quota chart,
Init pods reserve their part.
HAMi shrinks its count when done,
Kubernetes keeps the original sum.
Clear docs guide each careful hop.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the documentation change about ResourceQuota interaction with init container accounting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested a review from archlitchi August 10, 2026 09:33

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
docs/develop/initContainer-design.md (2)

270-271: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Qualify enforcement by the ResourceQuota admission plugin.

A ResourceQuota object is enforced only when the API server enables the ResourceQuota admission plugin. Add this condition to avoid overstating behavior on clusters where the object exists but the plugin is disabled. (kubernetes.io)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/develop/initContainer-design.md` around lines 270 - 271, Update the
ResourceQuota enforcement description in the kube-apiserver flow to state that
the quota is checked before HAMi only when the ResourceQuota admission plugin is
enabled; retain the existing behavior description for enabled-plugin clusters.

Source: MCP tools


270-273: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Clarify that HAMi and Kubernetes can calculate different numeric values.

pkg/scheduler/webhook.go:145-192 applies HAMi-specific defaults, memory factors, and rounding before FitQuota. Kubernetes calculates quota from Pod resource requests. The max(sum(app), max(init)) rule is structurally shared, but the resulting values can differ. State this explicitly. (kubernetes.io)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/develop/initContainer-design.md` around lines 270 - 273, Update the
ResourceQuota explanation near the `max(sum(app), max(init))` formula to state
that HAMi and Kubernetes may produce different numeric values: HAMi applies its
defaults, memory factors, and rounding before `FitQuota`, while Kubernetes uses
the Pod’s resource requests. Preserve the distinction that both share the same
structural max rule.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/develop/initContainer-design.md`:
- Around line 273-280: Update the ResourceQuota explanation in the
init-container design text to state that usage is charged while the Pod is
non-terminal, not until deletion or for its whole lifetime. Preserve the example
and clarify that Succeeded and Failed Pods no longer count toward quota while
their objects remain.

---

Nitpick comments:
In `@docs/develop/initContainer-design.md`:
- Around line 270-271: Update the ResourceQuota enforcement description in the
kube-apiserver flow to state that the quota is checked before HAMi only when the
ResourceQuota admission plugin is enabled; retain the existing behavior
description for enabled-plugin clusters.
- Around line 270-273: Update the ResourceQuota explanation near the
`max(sum(app), max(init))` formula to state that HAMi and Kubernetes may produce
different numeric values: HAMi applies its defaults, memory factors, and
rounding before `FitQuota`, while Kubernetes uses the Pod’s resource requests.
Preserve the distinction that both share the same structural max rule.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b57acd6-a558-4cf5-b036-2b376cbe18e2

📥 Commits

Reviewing files that changed from the base of the PR and between 8812b79 and 67fc3c2.

📒 Files selected for processing (1)
  • docs/develop/initContainer-design.md

Comment thread docs/develop/initContainer-design.md Outdated
Signed-off-by: maishivamhoo123 <maishivamhoo@gmail.com>
@maishivamhoo123

Copy link
Copy Markdown
Member Author

@DSFans2014 and @archlitchi i updated the docs as discussed in the #1773 (comment) can you please review this.
Thank you!

@mesutoezdil

Copy link
Copy Markdown
Contributor

/lgtm

@FouoF

FouoF commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@hami-robot

hami-robot Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FouoF, maishivamhoo123

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

The pull request process is described 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

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants