-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature/add-quota #644
base: main
Are you sure you want to change the base?
feature/add-quota #644
Conversation
WalkthroughThe pull request updates the tenant application by modifying version numbers and introducing a new resource management parameter. The version is bumped from Changes
Sequence Diagram(s)sequenceDiagram
participant U as User/Operator
participant H as Helm Renderer
participant K as Kubernetes API Server
U->>H: Provide tenant configuration with new `resourceQuotas` parameter
H->>H: Process Chart (version update) and values (including `resourceQuotas`)
H->>K: Generate and deploy ResourceQuota (if `resourceQuotas` defined)
K-->>H: Acknowledge applied quota configuration
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
5c631da
to
ce9e04c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
packages/apps/tenant/values.schema.json (1)
35-39
: Add validation for resource quotas structure.The schema for
resources
should include validation for the expected structure of resource quotas (limits and requests for CPU and memory) as shown in the example in values.yaml."resources": { "type": "object", "description": "Tenant quotas", - "default": {} + "default": {}, + "properties": { + "limits": { + "type": "object", + "properties": { + "cpu": { "type": "string", "pattern": "^[0-9]+m?$" }, + "memory": { "type": "string", "pattern": "^[0-9]+(Mi|Gi)$" } + } + }, + "requests": { + "type": "object", + "properties": { + "cpu": { "type": "string", "pattern": "^[0-9]+m?$" }, + "memory": { "type": "string", "pattern": "^[0-9]+(Mi|Gi)$" } + } + } + } }packages/apps/tenant/README.md (1)
61-61
: Add usage examples for tenant quotas.Consider adding examples of how to configure resource quotas, similar to the example structure provided in values.yaml. This will help users understand how to properly configure tenant quotas.
packages/apps/tenant/values.yaml (1)
17-23
: Add unit explanations in the example.The example is helpful but could be improved by adding comments explaining the units used for CPU and memory values.
# resources: # limits: -# cpu: 4000m -# memory: 4Gi +# cpu: 4000m # 4 CPU cores (1000m = 1 core) +# memory: 4Gi # 4 Gibibytes # requests: -# cpu: 100m -# memory: 512Mi +# cpu: 100m # 0.1 CPU cores +# memory: 512Mi # 512 Mebibytespackages/apps/tenant/templates/quota.yaml (2)
1-1
: Helm Template Directive and YAML Linting NoteThe opening line uses a Helm template conditional (
{{- if .Values.resources }}
) which is correct for conditional resource rendering. Note that YAML lint tools may flag this as a syntax error due to the templating syntax. Ensure your linter is configured (or suppressed) for Helm templates to avoid false positives.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 1-1: syntax error: expected the node content, but found '-'
(syntax)
8-12
: Conditional Rendering for Resource RequestsThe
spec.hard
block includes a conditional that renders therequests.cpu
andrequests.memory
fields only when both are provided. This prevents partially defined resource requests. Confirm that this behavior meets your requirements—if you wish to allow a partial definition, you'll need to adjust the conditional.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/apps/tenant/Chart.yaml
(1 hunks)packages/apps/tenant/README.md
(1 hunks)packages/apps/tenant/templates/quota.yaml
(1 hunks)packages/apps/tenant/values.schema.json
(1 hunks)packages/apps/tenant/values.yaml
(1 hunks)packages/apps/versions_map
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/apps/tenant/Chart.yaml
🧰 Additional context used
🪛 YAMLlint (1.35.1)
packages/apps/tenant/templates/quota.yaml
[error] 1-1: syntax error: expected the node content, but found '-'
(syntax)
🔇 Additional comments (4)
packages/apps/versions_map (1)
106-107
: LGTM!The version mapping changes are consistent with the feature addition and follow the established pattern in the file.
packages/apps/tenant/templates/quota.yaml (3)
2-7
: ResourceQuota Object Metadata SetupThe API version, kind, and metadata (including using the Helm helper to set the namespace) are defined correctly. The resource name “tenant-quota” is clear and consistent.
13-16
: Conditional Rendering for Resource LimitsSimilarly, the limits for CPU and memory are rendered only if both
.Values.resources.limits.cpu
and.Values.resources.limits.memory
are defined. This avoids configuration with incomplete resource limits. The logic is sound, assuming that both fields are required together.
17-18
: Proper Closure of the Helm ConditionalThe closing
{{- end }}
correctly terminates the conditional block initiated in line 1, ensuring that the ResourceQuota definition is included only when the.Values.resources
is provided.
packages/apps/tenant/Chart.yaml
Outdated
version: 1.7.0 | ||
version: 1.7.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please bump feature version, not patch version
ce9e04c
to
2e1a8a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/apps/tenant/README.md (1)
53-61
: Correct the possessive pronoun in the description.In the table row for the
host
parameter, consider replacing “it's” with “its” for proper grammar (i.e. “for its parent tenant host”).🧰 Tools
🪛 LanguageTool
[uncategorized] ~55-~55: Did you mean “its” (the possessive pronoun)?
Context: ...sing the tenant name as a subdomain for it's parent tenant host). |""
| | `etc...(ITS_PREMIUM)
packages/apps/tenant/templates/quota.yaml (1)
1-28
: Review Helm templating and YAML indentation.This new Helm template for generating a Kubernetes ResourceQuota looks structurally sound. Please note that the static analysis warnings regarding indentation (e.g. expected 2 but found 4 on lines 11–12) appear to be false positives due to Helm’s templating syntax. If these warnings become disruptive in your CI pipeline, consider adding YAML linting exclusions for Helm templates.
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 1-1: syntax error: expected the node content, but found '-'
(syntax)
[warning] 11-11: wrong indentation: expected 2 but found 4
(indentation)
[warning] 12-12: wrong indentation: expected 2 but found 4
(indentation)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/apps/tenant/Chart.yaml
(1 hunks)packages/apps/tenant/README.md
(1 hunks)packages/apps/tenant/templates/quota.yaml
(1 hunks)packages/apps/tenant/values.schema.json
(1 hunks)packages/apps/tenant/values.yaml
(1 hunks)packages/apps/versions_map
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- packages/apps/tenant/Chart.yaml
- packages/apps/tenant/values.schema.json
- packages/apps/tenant/values.yaml
- packages/apps/versions_map
🧰 Additional context used
🪛 LanguageTool
packages/apps/tenant/README.md
[uncategorized] ~55-~55: Did you mean “its” (the possessive pronoun)?
Context: ...sing the tenant name as a subdomain for it's parent tenant host). | ""
| | `etc...
(ITS_PREMIUM)
🪛 YAMLlint (1.35.1)
packages/apps/tenant/templates/quota.yaml
[error] 1-1: syntax error: expected the node content, but found '-'
(syntax)
[warning] 11-11: wrong indentation: expected 2 but found 4
(indentation)
[warning] 12-12: wrong indentation: expected 2 but found 4
(indentation)
Summary by CodeRabbit
resourceQuotas
parameter in tenant configuration.