-
Notifications
You must be signed in to change notification settings - Fork 10
feat(t8s-cluster): make apiserver resources configurable #1485
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
feat(t8s-cluster): make apiserver resources configurable #1485
Conversation
WalkthroughResource configuration for the control plane components in the Helm chart was made configurable. Static memory requests and limits were replaced with values sourced from the chart's configuration. New YAML files were added for different resource profiles, and the values schema was updated to validate these settings. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant HelmChart
participant TemplateEngine
participant Kubernetes
User->>HelmChart: Provide values.yaml (with controlPlane.resources)
HelmChart->>TemplateEngine: Render templates with provided values
TemplateEngine->>Kubernetes: Generate manifests with controlPlane resource requests/limits
Kubernetes-->>User: Deploy control plane components with specified resources
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
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.
Pull Request Overview
This PR makes the apiserver resources configurable by allowing resource requests and limits to be defined from the values file and propagated through the templates.
- Introduces a new resources field in charts/t8s-cluster/values.yaml for controlPlane.
- Updates the JSON schema in values.schema.json to validate the resources field.
- Propagates configurable resource settings in both kubeadm and k0smotron control plane templates.
- Adds CI test values files to verify the new resource configurations.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
charts/t8s-cluster/values.yaml | Adds configurable resource requests and limits. |
charts/t8s-cluster/values.schema.json | Updates schema to validate the new resources field via reference. |
charts/t8s-cluster/templates/management-cluster/clusterClass/kubeadmControlPlaneTemplate/_helpers.tpl | Replaces hard-coded resource values with a dynamic inclusion. |
charts/t8s-cluster/templates/management-cluster/clusterClass/k0smotronControlPlaneTemplate/_k0smotronControlPlaneTemplateSpec.yaml | Adds resource configuration using dynamic inclusion. |
charts/t8s-cluster/ci/hcp-with-resources-values.yaml | Provides CI values with hosted controlPlane and resource configuration. |
charts/t8s-cluster/ci/cp-with-resources-values.yaml | Provides CI values with resource configuration for controlPlane. |
...s-cluster/templates/management-cluster/clusterClass/kubeadmControlPlaneTemplate/_helpers.tpl
Show resolved
Hide resolved
...t-cluster/clusterClass/k0smotronControlPlaneTemplate/_k0smotronControlPlaneTemplateSpec.yaml
Show resolved
Hide resolved
🤖 I have diffed this beep boop"/$namespace/$kind/$name.yaml" for normal resources
|
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 (3)
charts/t8s-cluster/values.yaml (1)
45-49
: Good addition of configurable control plane resources.The default memory resource values (2Gi request, 4Gi limit) are reasonable and provide a good baseline. The configuration is backward compatible and follows Helm best practices.
Consider adding CPU resource specifications for completeness:
resources: requests: memory: 2Gi + cpu: 500m limits: memory: 4Gi + cpu: 2000mcharts/t8s-cluster/values.schema.json (2)
177-180
: Define optionalresources
property oncontrolPlane
The newresources
property is correctly inserted undercontrolPlane.properties
and references#/$defs/resourceRequirements
, making it optional as intended. For better discoverability and documentation, consider adding a"description"
field to explain its purpose (e.g.,"Resource requests and limits for control plane components"
).
306-308
: Pin external$defs.resourceRequirements
reference to a stable release
The$ref
correctly points to the KubernetesResourceRequirements
definition, but relying on themaster
branch may introduce unexpected breaks if that repository updates. Consider referencing a specific tagged version or commit SHA in the URL to ensure schema stability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
charts/t8s-cluster/ci/cp-with-resources-values.yaml
(1 hunks)charts/t8s-cluster/ci/hcp-with-resources-values.yaml
(1 hunks)charts/t8s-cluster/templates/management-cluster/clusterClass/k0smotronControlPlaneTemplate/_k0smotronControlPlaneTemplateSpec.yaml
(1 hunks)charts/t8s-cluster/templates/management-cluster/clusterClass/kubeadmControlPlaneTemplate/_helpers.tpl
(1 hunks)charts/t8s-cluster/values.schema.json
(2 hunks)charts/t8s-cluster/values.yaml
(1 hunks)
🔇 Additional comments (4)
charts/t8s-cluster/ci/hcp-with-resources-values.yaml (1)
1-7
: LGTM! Well-structured CI configuration for hosted control plane testing.The resource configuration is appropriate for CI testing scenarios with higher memory requirements (4Gi request, 8Gi limit) compared to the defaults. The
hosted: true
flag correctly identifies this as a hosted control plane configuration.charts/t8s-cluster/ci/cp-with-resources-values.yaml (1)
1-6
: LGTM! Consistent CI configuration for control plane testing.The resource configuration matches the hosted control plane variant, providing consistent testing across different control plane types. The identical memory settings (4Gi request, 8Gi limit) ensure uniform test coverage.
charts/t8s-cluster/templates/management-cluster/clusterClass/k0smotronControlPlaneTemplate/_k0smotronControlPlaneTemplateSpec.yaml (1)
8-8
: Excellent implementation of configurable resources.The use of the
common.resources
template helper with.Values.controlPlane
as input provides clean, consistent resource injection. Thenindent 2
properly formats the YAML output and maintains template readability.charts/t8s-cluster/templates/management-cluster/clusterClass/kubeadmControlPlaneTemplate/_helpers.tpl (1)
33-33
:✅ Verification successful
Good implementation of dynamic resource configuration for kube-apiserver.
The change successfully replaces hardcoded resource values with configurable ones using the
common.resources
template helper. ThefromYaml
conversion properly parses the template output for use in the apiserver patch.Please verify that the
common.resources
template helper is properly defined and handles the.Values.controlPlane
input correctly:
🏁 Script executed:
#!/bin/bash # Description: Verify the common.resources template helper exists and understand its implementation # Expected: Find the template definition and confirm it handles resource configuration properly # Search for the common.resources template definition rg -A 10 -B 2 "define.*common\.resources" # Also check for any usage patterns to understand expected input/output rg -A 5 -B 2 "common\.resources"Length of output: 23345
common.resources helper verified and change approved
Verified that
common.resources
is defined incharts/common/templates/_resources.tpl
and correctly merges provided.resources
with any preset viamustMerge
andfromYaml
. The helper’s output aligns with the intended dynamic resource configuration.No further action required—approving these changes.
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: 1
♻️ Duplicate comments (1)
charts/t8s-cluster/templates/management-cluster/clusterClass/kubeadmControlPlaneTemplate/_helpers.tpl (1)
33-33
: Consider passing only the resources configuration to the template.The change successfully makes kube-apiserver resources configurable, which aligns well with the PR objectives. However, there's a previous review suggestion that's still relevant.
Consider passing only the resources sub-property (e.g.,
.Values.controlPlane.resources
) to the include function instead of the entire controlPlane block to ensure only relevant configuration is processed:-{{- $apiserverPatch := dict "spec" (dict "containers" (list (dict "name" "kube-apiserver" "resources" (include "common.resources" .Values.controlPlane | fromYaml)))) -}} +{{- $apiserverPatch := dict "spec" (dict "containers" (list (dict "name" "kube-apiserver" "resources" (include "common.resources" .Values.controlPlane.resources | fromYaml)))) -}}This approach follows the principle of least privilege by passing only the necessary configuration data to the template function.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
charts/t8s-cluster/ci/cp-with-resources-values.yaml
(1 hunks)charts/t8s-cluster/ci/hcp-with-resources-values.yaml
(1 hunks)charts/t8s-cluster/templates/management-cluster/clusterClass/k0smotronControlPlaneTemplate/_k0smotronControlPlaneTemplateSpec.yaml
(1 hunks)charts/t8s-cluster/templates/management-cluster/clusterClass/kubeadmControlPlaneTemplate/_helpers.tpl
(1 hunks)charts/t8s-cluster/values.schema.json
(2 hunks)charts/t8s-cluster/values.yaml
(1 hunks)
🔇 Additional comments (6)
charts/t8s-cluster/values.schema.json (1)
177-180
: Add optionalresources
property undercontrolPlane
.This introduces the new
resources
block in the schema, aligning with the values.yaml defaults and templating logic to allow specifying resource requests and limits for control plane components.charts/t8s-cluster/ci/cp-with-resources-values.yaml (1)
1-6
: Enable control plane memory resource override for non-hosted cluster.This values file correctly sets
controlPlane.resources.requests.memory
to 4Gi andlimits.memory
to 8Gi, overriding the defaults invalues.yaml
.charts/t8s-cluster/ci/hcp-with-resources-values.yaml (1)
1-7
: Enable control plane memory resource override for hosted cluster.This new CI values file properly sets
hosted: true
and configurescontrolPlane.resources
for memory requests and limits, matching the expected override pattern.charts/t8s-cluster/values.yaml (1)
45-49
: Add default control plane resource requirements.The defaults (2Gi request, 4Gi limit) are correctly placed under
controlPlane.resources
and will be schema-validated and applied by the templates.charts/t8s-cluster/templates/management-cluster/clusterClass/k0smotronControlPlaneTemplate/_k0smotronControlPlaneTemplateSpec.yaml (1)
8-8
: Inject dynamicresources
in k0smotron control plane spec.Including
common.resources
with.Values.controlPlane
correctly renders the configured resource requests/limits for the k0smotron control plane.charts/t8s-cluster/templates/management-cluster/clusterClass/kubeadmControlPlaneTemplate/_helpers.tpl (1)
33-33
: Good improvement for resource configurability.The change from hardcoded resource values to dynamic configuration via
.Values.controlPlane
is a positive improvement that makes the chart more flexible and configurable.
🤖 I have created a release *beep* *boop* --- ## [9.3.0](t8s-cluster-v9.2.1...t8s-cluster-v9.3.0) (2025-06-06) ### Features * **t8s-cluster:** add rbac for teuto staff ([#1498](#1498)) ([9e0a9e2](9e0a9e2)) * **t8s-cluster:** enable audit logging ([#1440](#1440)) ([dcb28ca](dcb28ca)) * **t8s-cluster:** make apiserver resources configurable ([#1485](#1485)) ([3126661](3126661)) * **t8s-cluster:** use new pullPolicy template ([#1383](#1383)) ([6b253bd](6b253bd)) ### Miscellaneous Chores * **t8s-cluster:** pin versions ([#1482](#1482)) ([372c92b](372c92b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added RBAC for Teuto staff. - Enabled audit logging. - Made apiserver resource configurations customizable. - Adopted a new pullPolicy template. - **Enhancements** - Updated OpenStack Cinder CSI plugin and related CSI component images to newer versions. - Improved documentation for control plane resource configuration and security group rule options. - **Chores** - Updated chart version to 9.3.0 and pinned image versions. - Switched CSI image references and license entries from k8s.gcr.io to registry.k8s.io. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Chris Werner Rau <[email protected]>
Summary by CodeRabbit
New Features
Documentation