Update kubebuilder scaffold v4.13.1 -> v4.14.0#866
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
💤 Files with no reviewable changes (2)
✅ Files skipped from review due to trivial changes (9)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughUpgrade Kubebuilder scaffold to v4.14.0 and harmonize related tooling (golangci-lint, Go), adjust controller/webhook setup logs and ordering, change controller-manager container ports, remove SPDX header from generated deepcopy, extend REUSE metadata, and update test helpers and cert-manager version. ChangesKubebuilder Scaffold Upgrade with Tooling Harmonization
Sequence Diagram(s)sequenceDiagram
participant Main
participant EndpointReconciler
participant BMCSecretReconciler
participant ServerReconciler
participant ServerBootConfigurationReconciler
participant WebhookGate
Main->>EndpointReconciler: SetupWithManager() (log controller=endpoint)
Main->>BMCSecretReconciler: SetupWithManager() (log controller=bmcsecret)
Main->>ServerReconciler: SetupWithManager() (log controller=server)
Main->>ServerBootConfigurationReconciler: SetupWithManager() (log controller=serverbootconfiguration)
Main->>WebhookGate: if ENABLE_WEBHOOKS != "false" then per-webhook setup
WebhookGate->>WebhookGate: Setup webhook (on failure: log webhook=<lowercase> and exit)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
f3a865d to
0f52c54
Compare
0f52c54 to
5f654ba
Compare
5f654ba to
29adfb8
Compare
29adfb8 to
f39105c
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/webhook/v1alpha1/endpoint_webhook.go (1)
46-64: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winUpdate logging to use request context instead of package-scoped logger
The
ValidateCreateandValidateUpdatemethods receive actxparameter but log via a package-scoped logger. Per the coding guidelines for this file path, use context-derived logging to preserve request-scoped fields.♻️ Suggested change
func (v *EndpointCustomValidator) ValidateCreate(ctx context.Context, obj *metalv1alpha1.Endpoint) (admission.Warnings, error) { - endpointlog.Info("Validation for Endpoint upon creation", "name", obj.GetName()) + log := logf.FromContext(ctx).WithName("endpoint-resource") + log.Info("Validation for Endpoint upon creation", "name", obj.GetName()) allErrs := ValidateMACAddressCreate(ctx, v.Client, obj.Spec, field.NewPath("spec")) @@ func (v *EndpointCustomValidator) ValidateUpdate(ctx context.Context, oldObj, newObj *metalv1alpha1.Endpoint) (admission.Warnings, error) { - endpointlog.Info("Validation for Endpoint upon update", "name", newObj.GetName()) + log := logf.FromContext(ctx).WithName("endpoint-resource") + log.Info("Validation for Endpoint upon update", "name", newObj.GetName()) allErrs := ValidateMACAddressUpdate(ctx, v.Client, newObj, field.NewPath("spec"))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/webhook/v1alpha1/endpoint_webhook.go` around lines 46 - 64, The package-scoped logger (endpointlog) is being used in ValidateCreate and ValidateUpdate instead of a request-scoped logger from the context; change the logging calls in EndpointCustomValidator's ValidateCreate and ValidateUpdate to use log.FromContext(ctx).Info (importing sigs.k8s.io/controller-runtime/pkg/log if not already) so request-scoped fields in ctx are preserved when logging; update any Info calls that reference endpointlog to use the context-derived logger and keep message/key pairs the same.
🧹 Nitpick comments (1)
cmd/main.go (1)
631-678: ⚡ Quick winConsolidate webhook enable checks to avoid duplication
The repeated
os.Getenv("ENABLE_WEBHOOKS") != "false"guard is duplicated across each webhook registration block. Caching once and wrapping all setups in a single conditional keeps behavior identical and reduces drift risk.♻️ Suggested change
- // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { + enableWebhooks := os.Getenv("ENABLE_WEBHOOKS") != "false" + if enableWebhooks { if err := webhookv1alpha1.SetupEndpointWebhookWithManager(mgr); err != nil { setupLog.Error(err, "Failed to create webhook", "webhook", "endpoint") os.Exit(1) } - } - // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { if err := webhookv1alpha1.SetupBMCSecretWebhookWithManager(mgr); err != nil { setupLog.Error(err, "Failed to create webhook", "webhook", "bmcsecret") os.Exit(1) } - } - // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { if err := webhookv1alpha1.SetupServerWebhookWithManager(mgr); err != nil { setupLog.Error(err, "Failed to create webhook", "webhook", "server") os.Exit(1) } - } - // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { if err := webhookv1alpha1.SetupBIOSSettingsWebhookWithManager(mgr); err != nil { setupLog.Error(err, "Failed to create webhook", "webhook", "biossettings") os.Exit(1) } - } - // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { if err := webhookv1alpha1.SetupBIOSVersionWebhookWithManager(mgr); err != nil { setupLog.Error(err, "Failed to create webhook", "webhook", "biosversion") os.Exit(1) } - } - // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { if err := webhookv1alpha1.SetupBMCSettingsWebhookWithManager(mgr); err != nil { setupLog.Error(err, "Failed to create webhook", "webhook", "bmcsettings") os.Exit(1) } - } - // nolint:goconst - if os.Getenv("ENABLE_WEBHOOKS") != "false" { if err := webhookv1alpha1.SetupBMCVersionWebhookWithManager(mgr); err != nil { setupLog.Error(err, "Failed to create webhook", "webhook", "bmcversion") os.Exit(1) } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/main.go` around lines 631 - 678, Cache the ENABLE_WEBHOOKS env value once (e.g. enableWebhooks := os.Getenv("ENABLE_WEBHOOKS") != "false") and wrap all webhook setup calls in a single if enableWebhooks { ... } block to avoid repeating the guard; move the calls to webhookv1alpha1.SetupEndpointWebhookWithManager(mgr), SetupBMCSecretWebhookWithManager(mgr), SetupServerWebhookWithManager(mgr), SetupBIOSSettingsWebhookWithManager(mgr), SetupBIOSVersionWebhookWithManager(mgr), SetupBMCSettingsWebhookWithManager(mgr) and SetupBMCVersionWebhookWithManager(mgr) inside that block and retain the existing error handling using setupLog.Error(...) and os.Exit(1) for each setup call.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@api/v1alpha1/groupversion_info.go`:
- Line 4: Update the package comment in groupversion_info.go to use the
canonical API group/version name used by this package
(metal.ironcore.dev/v1alpha1) instead of the current text "metal v1alpha1";
locate the package comment at the top of the file associated with package
v1alpha1 and replace the description so it references
"metal.ironcore.dev/v1alpha1" (or "metal.ironcore.dev v1alpha1") to match the
registered group/version used by this package and its generated docs.
---
Outside diff comments:
In `@internal/webhook/v1alpha1/endpoint_webhook.go`:
- Around line 46-64: The package-scoped logger (endpointlog) is being used in
ValidateCreate and ValidateUpdate instead of a request-scoped logger from the
context; change the logging calls in EndpointCustomValidator's ValidateCreate
and ValidateUpdate to use log.FromContext(ctx).Info (importing
sigs.k8s.io/controller-runtime/pkg/log if not already) so request-scoped fields
in ctx are preserved when logging; update any Info calls that reference
endpointlog to use the context-derived logger and keep message/key pairs the
same.
---
Nitpick comments:
In `@cmd/main.go`:
- Around line 631-678: Cache the ENABLE_WEBHOOKS env value once (e.g.
enableWebhooks := os.Getenv("ENABLE_WEBHOOKS") != "false") and wrap all webhook
setup calls in a single if enableWebhooks { ... } block to avoid repeating the
guard; move the calls to webhookv1alpha1.SetupEndpointWebhookWithManager(mgr),
SetupBMCSecretWebhookWithManager(mgr), SetupServerWebhookWithManager(mgr),
SetupBIOSSettingsWebhookWithManager(mgr),
SetupBIOSVersionWebhookWithManager(mgr), SetupBMCSettingsWebhookWithManager(mgr)
and SetupBMCVersionWebhookWithManager(mgr) inside that block and retain the
existing error handling using setupLog.Error(...) and os.Exit(1) for each setup
call.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: da0460d1-d246-4c06-84b9-2a447740589d
📒 Files selected for processing (15)
.custom-gcl.yml.github/workflows/lint.ymlMakefilePROJECTREUSE.tomlapi/v1alpha1/groupversion_info.goapi/v1alpha1/zz_generated.deepcopy.gocmd/main.goconfig/manager/manager.yamldocs/api-reference/api.mdgo.modinternal/controller/bmcsettingsset_controller_test.gointernal/webhook/v1alpha1/endpoint_webhook.gotest/e2e/e2e_test.gotest/utils/utils.go
💤 Files with no reviewable changes (2)
- internal/controller/bmcsettingsset_controller_test.go
- api/v1alpha1/zz_generated.deepcopy.go
d685047 to
9c01ae7
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Signed-off-by: Andreas Fritzler <andreas.fritzler@sap.com>
9c01ae7 to
b2e0e9f
Compare
Signed-off-by: Andreas Fritzler <andreas.fritzler@sap.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: Nagadeesh Nagaraja <nagdeesh@gmail.com>
Proposed Changes
Update kubebuilder scaffold v4.13.1 -> v4.14.0.
Fixes #863
Summary by CodeRabbit
Chores
Configuration
Documentation
Tests