Repository navigation
[Backport release-1.4] fix(platform): migrate ephemeralStorage to diskSize via pre-upgrade hook - #2712
Conversation
Add pre-upgrade migration 41 that walks all kuberneteses.apps.cozystack.io Application CRs and renames nodeGroups[*].ephemeralStorage to diskSize, preserving the user's value. Without this migration, clusters upgraded after PR #2454 either fail to reconcile (hard fail blocks all Flux operations) or silently lose the user's disk size setting (default 20Gi replaces whatever was configured). The migration is idempotent and best-effort: a failed patch is logged and leaves the version stamp at 41 for retry on next upgrade. Update the chart-side guard error message to direct operators to the migration job logs when the field appears post-upgrade (regression detector). Bump migrations.targetVersion 41 -> 42. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]> (cherry picked from commit ed1bb53)
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request implements a transparent migration path for users affected by the renaming of Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces platform migration 41 to automatically rename the ephemeralStorage field to diskSize in Kubernetes application resources, updating the documentation and error messages accordingly. Feedback focuses on improving the migration script's robustness by distinguishing between transient API errors and missing resources, correcting a misleading log message regarding the version stamp, and replacing a hardcoded namespace with the $NAMESPACE environment variable.
| obj=$(kubectl get "$kind" --namespace "$ns" "$name" --output json 2>/dev/null || true) | ||
| if [ -z "$obj" ]; then SKIPPED=$((SKIPPED + 1)); return 0; fi |
There was a problem hiding this comment.
If kubectl get fails due to a transient error (e.g., API server timeout or temporary network issue), the object is silently skipped and the migration is considered successful for this resource. This can lead to some resources missing the migration while the global version stamp is still advanced to 42, preventing retries on subsequent upgrades. Consider distinguishing between a 'Not Found' error (which is safe to skip) and other errors which should be treated as failures.
| fi | ||
|
|
||
| if [ "$FAILURES" -gt 0 ]; then | ||
| echo "WARN: $FAILURES patch(es) failed; leaving CURRENT_VERSION at 41 for retry on next upgrade." |
There was a problem hiding this comment.
The log message mentions leaving the version at 41, but if the migration started from version 40 and failed, it will actually remain at 40 because the ConfigMap update is skipped. This message is slightly misleading as it implies an advancement that didn't happen.
| echo "WARN: $FAILURES patch(es) failed; leaving CURRENT_VERSION at 41 for retry on next upgrade." | |
| echo "WARN: $FAILURES patch(es) failed; leaving version stamp unchanged for retry on next upgrade." |
| exit 0 | ||
| fi | ||
|
|
||
| kubectl create configmap --namespace cozy-system cozystack-version \ |
There was a problem hiding this comment.
The namespace cozy-system is hardcoded here. It is better to use the $NAMESPACE environment variable provided by the migration hook to ensure consistency if the platform is installed in a different namespace.
| kubectl create configmap --namespace cozy-system cozystack-version \ | |
| kubectl create configmap --namespace "$NAMESPACE" cozystack-version \ |
The minio client was downloaded without -L, so when dl.min.io served
a 302 redirect, curl wrote the HTML body ("<a href=...>Found</a>") to
/usr/local/bin/mc, chmod +x'd it, and shipped that as the binary. When
the bucket E2E test ran "mc alias set ...", the shell tried to interpret
the HTML as a script and errored with:
/usr/local/bin/mc: 1: cannot open a: No such file
(dash reading "<a" as an input redirect from a file named "a").
The image is rebuilt per CI run from cached layers; the broken mc layer
was cached and reused. Adding -fsSL fixes the download and the textual
change busts the cache so the next build pulls a real ELF binary.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
(cherry picked from commit 45937d6)
Signed-off-by: Myasnikov Daniil <[email protected]>
Add pre-upgrade migration 41 that walks all kuberneteses.apps.cozystack.io Application CRs and renames nodeGroups[*].ephemeralStorage to diskSize, preserving the user's value.
Without this migration, clusters upgraded after PR #2454 either fail to reconcile (hard fail blocks all Flux operations) or silently lose the user's disk size setting (default 20Gi replaces whatever was configured).
The migration is idempotent and best-effort: a failed patch is logged and leaves the version stamp at 41 for retry on next upgrade.
Update the chart-side guard error message to direct operators to the migration job logs when the field appears post-upgrade (regression detector). Bump migrations.targetVersion 41 -> 42.
Assisted-By: Claude [email protected]
(cherry picked from commit ed1bb53)
What this PR does
Screenshots
Release note