Use library chart with k8s managed app - #1026
Conversation
|
Warning Rate limit exceededAndrei Kvapil (@kvaps) has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 19 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughA new file referencing the shared Changes
Sequence Diagram(s)sequenceDiagram
participant HelmChart
participant cozy-lib
participant KubernetesTemplate
HelmChart->>KubernetesTemplate: Render cluster.yaml
KubernetesTemplate->>cozy-lib: Call resources.sanitize for resource blocks
KubernetesTemplate->>cozy-lib: Call resources.preset for presets
cozy-lib-->>KubernetesTemplate: Return processed resource YAML
KubernetesTemplate-->>HelmChart: Output rendered template
Possibly related PRs
Suggested reviewers
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.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/apps/kubernetes/charts/cozy-lib(1 hunks)packages/apps/kubernetes/templates/cluster.yaml(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Build
🔇 Additional comments (3)
packages/apps/kubernetes/templates/cluster.yaml (3)
130-133: Consistent resource templating for controllerManager
The controllerManager block has been updated in line with the API server, leveragingcozy-libfunctions. This looks correct and maintains consistency across control plane components.
136-139: Scheduler resource handling alignment
Scheduler resources now use the samesanitize/presetfunctions, ensuring uniform rendering of scheduling component specs. Implementation matches the pattern above.
149-152: Konnectivity server resource update
The konnectivity server resources are now sanitized and preset viacozy-lib. This completes the standardization for all control plane add-ons.
| @@ -0,0 +1 @@ | |||
| ../../../library/cozy-lib/ No newline at end of file | |||
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Approve: Local symlink for the cozy-lib Helm library is correctly added
The relative symlink in the charts directory correctly points to the shared cozy-lib library chart.
Run the following script to validate the symlink target and ensure Chart.yaml exists in the library chart:
🏁 Script executed:
#!/bin/bash
set -e
# Verify symlink path
target=$(readlink packages/apps/kubernetes/charts/cozy-lib)
echo "Symlink points to: $target"
# Confirm Chart.yaml in the target library chart
if [ ! -f "$target/Chart.yaml" ]; then
echo "Error: Chart.yaml not found in library at $target"
exit 1
fi
echo "Chart.yaml found; symlink is valid."Length of output: 409
🏁 Script executed:
#!/usr/bin/env bash
set -e
echo "Listing all Chart.yaml files in the repo:"
find . -type f -name Chart.yaml
echo
echo "Looking specifically for Chart.yaml under any cozy-lib directory:"
find . -type f -path '*/cozy-lib/Chart.yaml' || echo "No cozy-lib Chart.yaml found"Length of output: 7199
Approve: cozy-lib symlink is correctly pointing to packages/library/cozy-lib – update verification script
The symlink at packages/apps/kubernetes/charts/cozy-lib resolves to ../../../library/cozy-lib, and there is indeed a Chart.yaml at packages/library/cozy-lib/Chart.yaml. The failure in the previous script was due to testing the relative path from the repo root rather than from the chart directory.
• Corrected validation (run from repo root):
#!/usr/bin/env bash
set -e
# Change into the charts directory so relative symlink resolution works
cd packages/apps/kubernetes/charts
# Ensure cozy-lib is a symlink
if [ ! -L cozy-lib ]; then
echo "Error: cozy-lib is not a symlink"
exit 1
fi
# Verify Chart.yaml exists through the link
if [ ! -f cozy-lib/Chart.yaml ]; then
echo "Error: Chart.yaml not found in linked cozy-lib"
exit 1
fi
echo "✅ Symlink and Chart.yaml are valid."🤖 Prompt for AI Agents
In packages/apps/kubernetes/charts/cozy-lib at line 1, the symlink validation
script should be updated to change the working directory to
packages/apps/kubernetes/charts before checking the symlink and Chart.yaml file.
Modify the script to first cd into the charts directory, then verify that
cozy-lib is a symlink and that cozy-lib/Chart.yaml exists relative to that
directory to ensure correct relative path resolution.
| resources: {{- include "cozy-lib.resources.sanitize" (list .Values.controlPlane.apiServer.resources $) | nindent 6 }} | ||
| {{- else if ne .Values.controlPlane.apiServer.resourcesPreset "none" }} | ||
| resources: {{- include "resources.preset" (dict "type" .Values.controlPlane.apiServer.resourcesPreset "Release" .Release) | nindent 6 }} | ||
| resources: {{- include "cozy-lib.resources.preset" (list .Values.controlPlane.apiServer.resourcesPreset $) | nindent 6 }} | ||
| {{- end }} |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Resource rendering migration
The switch to cozy-lib.resources.sanitize and cozy-lib.resources.preset standardizes YAML output for the API server. Please confirm that cozy-lib is declared as a chart dependency (so these partials resolve at render time) and that the function signatures match the passed arguments (.Values.controlPlane.apiServer.resources or .resourcesPreset with the context $).
Run this script to verify the dependency in your Chart.yaml:
🏁 Script executed:
#!/bin/bash
# Verify cozy-lib chart is listed under dependencies
rg -n "cozy-lib" packages/apps/kubernetes/Chart.yamlLength of output: 52
🏁 Script executed:
#!/bin/bash
# Locate Chart file under packages/apps/kubernetes
echo "Chart file(s) found:"
find packages/apps/kubernetes -maxdepth 2 -type f \( -iname 'Chart.yaml' -o -iname 'Chart.yml' \)
# Show the dependencies section in Chart.yaml (if present)
echo -e "\nDependencies section from Chart.yaml:"
rg -n "dependencies:" -A10 packages/apps/kubernetes/Chart.yaml || echo "→ No dependencies section found in Chart.yaml"
# Search specifically for cozy-lib in Chart.yaml
echo -e "\nSearching for 'cozy-lib' in Chart.yaml:"
rg -n "cozy-lib" packages/apps/kubernetes/Chart.yaml || echo "→ 'cozy-lib' not declared as a dependency"Length of output: 692
Add cozy-lib as a chart dependency
Verification shows that packages/apps/kubernetes/Chart.yaml has no dependencies: section and does not list cozy-lib. Without this, the calls to cozy-lib.resources.sanitize and cozy-lib.resources.preset will fail at render time.
• File needing update:
- packages/apps/kubernetes/Chart.yaml
• Required change:
- Add a
dependencies:block includingcozy-lib, for example:dependencies: - name: cozy-lib version: <chart-version> repository: <chart-repo-url>
- Run
helm dependency update packages/apps/kubernetesto install the new dependency. - Confirm that the partials’ function signatures still accept
(list .Values.controlPlane.apiServer.resources $)and(list .Values.controlPlane.apiServer.resourcesPreset $)without errors.
🤖 Prompt for AI Agents
In packages/apps/kubernetes/Chart.yaml around lines 124 to 127, the cozy-lib
chart is not declared as a dependency, causing the calls to
cozy-lib.resources.sanitize and cozy-lib.resources.preset to fail at render
time. Fix this by adding a dependencies section in
packages/apps/kubernetes/Chart.yaml that includes cozy-lib with its name,
version, and repository URL. After updating the Chart.yaml, run helm dependency
update packages/apps/kubernetes to install the dependency. Finally, verify that
the function signatures for the partials still accept the passed arguments
without errors.
Andrei Kvapil (kvaps)
left a comment
There was a problem hiding this comment.
Shouldn't we also update openapi schema and values for the helm chart?
|
I mean do we really want to let users specify both requests and limits? |
f536016 to
d3266a8
Compare
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
d3266a8 to
8663dc9
Compare
Summary by CodeRabbit