Skip to content

Update crd according to changes of structs - #9

Merged
valeryia-hurynovich merged 1 commit into
masterfrom
update-crd
Mar 31, 2026
Merged

valeryia-hurynovich merged 1 commit into
masterfrom
update-crd

Conversation

@valeryia-hurynovich

@valeryia-hurynovich valeryia-hurynovich commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Refactor
    • Cloud profile garbage-collection settings moved from per-machine-image to a single top-level cloud profile section; configuration now includes enabled and maxAge fields.
  • Documentation
    • Clarified label-selector wording (“requirements are ANDed”) and added validation to ensure maxAge durations are non-negative and properly formatted.

@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@valeryia-hurynovich has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 24 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7f11ae71-b235-4933-8191-852b45756f38

📥 Commits

Reviewing files that changed from the base of the PR and between 83d8651 and 769106f.

📒 Files selected for processing (1)
  • crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml
📝 Walkthrough

Walkthrough

Moved garbage collection configuration for ManagedCloudProfile from each spec.cloudProfile.machineImageUpdates[] item to a single top-level spec.cloudProfile.garbageCollection and added a non-negative duration validation for maxAge; also fixed wording in seedSelector descriptions.

Changes

Cohort / File(s) Summary
CRD Schema
crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml
Removed garbageCollection from spec.cloudProfile.machineImageUpdates[]; added spec.cloudProfile.garbageCollection with enabled: boolean and maxAge: string plus x-kubernetes-validations enforcing duration(self) >= duration('0s'). Fixed wording in spec.seedSelector descriptions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • fwiesel
  • Nuckal777
  • defo89

Poem

🐇 I hopped through YAML, neat and spry,
Tweaked where old GC used to lie,
Moved the rules up, set ages right,
Now schemas sleep through cloudless night. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: updating a CRD schema to reflect structural changes, including garbageCollection field reorganization and typo fixes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-crd

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between d52869c and ee505d1.

📒 Files selected for processing (1)
  • crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml

Comment on lines +519 to +534
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

Comment thread crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml (1)

523-525: ⚠️ Potential issue | 🟡 Minor

Update enabled description 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

📥 Commits

Reviewing files that changed from the base of the PR and between ee505d1 and 83d8651.

📒 Files selected for processing (1)
  • crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml

Comment thread crd/cloudprofilesync.cobaltcore.dev_managedcloudprofiles.yaml Outdated
@valeryia-hurynovich
valeryia-hurynovich merged commit bb26ee8 into master Mar 31, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants