Update crd according to changes of structs - #9
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 17 minutes and 24 seconds. ⌛ 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. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughMoved garbage collection configuration for ManagedCloudProfile from each Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml`:
- Around line 519-534: The new CRD moved garbageCollection from
MachineImageUpdate into ManagedCloudProfileSpec which leaves stored v1alpha1
objects with the old nested field unread by the updated controller; add a
migration/conversion path or backwards-compatible handling: implement a
conversion/migration that reads the legacy MachineImageUpdate.garbageCollection
and writes it into ManagedCloudProfileSpec.garbageCollection during upgrade (or
add code in the reconciliation path to detect the old nested field and map it to
the new ManagedCloudProfileSpec field), reference the types
ManagedCloudProfileSpec and MachineImageUpdate in your conversion logic, and
ensure this runs once during controller start or via a conversion webhook so
existing persisted v1alpha1 resources are migrated for one release.
- Around line 523-525: Update the Go doc comment that generates the CRD
description for the `enabled` field to reflect that garbage collection is
resource-level (not "for this image"); locate the comment above the `enabled`
field in api/v1alpha1/managedcloudprofile.go (around the `Enabled` field
definition at lines ~105-115) and change the sentence “Enabled toggles garbage
collection for this image.” to something like “Enabled toggles garbage
collection for this resource.” (or similar resource-scoped wording), then
regenerate the CRD so the updated description appears in
crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml.
🪄 Autofix (Beta)
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5d4df78d-3186-4577-80f9-5e188de5535d
📒 Files selected for processing (1)
crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml
| garbageCollection: | ||
| description: GarbageCollection contains configuration for automated | ||
| garbage collection | ||
| properties: | ||
| enabled: | ||
| description: Enabled toggles garbage collection for this image. | ||
| type: boolean | ||
| maxAge: | ||
| description: |- | ||
| MaxAge defines the maximum age for images to keep. Images older than | ||
| now - MaxAge are eligible for deletion. | ||
| type: string | ||
| x-kubernetes-validations: | ||
| - message: maxAge must not be negative | ||
| rule: duration(self) >= duration('0s') | ||
| type: object |
There was a problem hiding this comment.
Ship an upgrade path for the field move.
api/v1alpha1/managedcloudprofile.go:16-26 now exposes this config on ManagedCloudProfileSpec, while api/v1alpha1/managedcloudprofile.go:94-104 no longer keeps it on MachineImageUpdate. Updating the CRD alone will not rewrite stored v1alpha1 objects, so existing resources using the old nested field will be ignored by controllers built from the new type until they are migrated. Please add a migration/conversion path or keep backward-compatible handling for one release.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml` around lines
519 - 534, The new CRD moved garbageCollection from MachineImageUpdate into
ManagedCloudProfileSpec which leaves stored v1alpha1 objects with the old nested
field unread by the updated controller; add a migration/conversion path or
backwards-compatible handling: implement a conversion/migration that reads the
legacy MachineImageUpdate.garbageCollection and writes it into
ManagedCloudProfileSpec.garbageCollection during upgrade (or add code in the
reconciliation path to detect the old nested field and map it to the new
ManagedCloudProfileSpec field), reference the types ManagedCloudProfileSpec and
MachineImageUpdate in your conversion logic, and ensure this runs once during
controller start or via a conversion webhook so existing persisted v1alpha1
resources are migrated for one release.
ee505d1 to
83d8651
Compare
83d8651 to
769106f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml (1)
523-525:⚠️ Potential issue | 🟡 MinorUpdate
enableddescription to resource-level scope.Line 524 still says “for this image”, but this field is no longer image-item scoped.
✏️ Suggested text fix
- enabled: - description: Enabled toggles garbage collection for this image. + enabled: + description: Enabled toggles garbage collection for this resource. type: boolean🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml` around lines 523 - 525, The description for the 'enabled' boolean is still image-scoped ("for this image"); update the text to reflect resource-level scope by changing the 'enabled' field description to something like "Enabled toggles garbage collection for this resource" (or equivalent resource-level phrasing) so the CRD's 'enabled' property no longer implies image-item scope.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml`:
- Around line 433-434: Replace the nonstandard word "ANDed" in the description
strings for matchExpressions with a clearer phrase; find the description fields
that mention "matchExpressions" and change "ANDed" to something like "evaluated
using logical AND" or "combined using logical AND" so the YAML reads e.g.
"matchExpressions is a list of label selector requirements. The requirements are
evaluated using logical AND."; apply the same replacement to the other
occurrence in the second matchExpressions description.
---
Duplicate comments:
In `@crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml`:
- Around line 523-525: The description for the 'enabled' boolean is still
image-scoped ("for this image"); update the text to reflect resource-level scope
by changing the 'enabled' field description to something like "Enabled toggles
garbage collection for this resource" (or equivalent resource-level phrasing) so
the CRD's 'enabled' property no longer implies image-item scope.
🪄 Autofix (Beta)
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 416f9e4a-9177-439c-a088-64bf7c8b9f6c
📒 Files selected for processing (1)
crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml
Summary by CodeRabbit