Skip to content

Comments

Kubebuilder update from v4.11.1 to v4.12.0#686

Merged
afritzler merged 6 commits intomainfrom
kubebuilder-update-from-v4.11.1-to-v4.12.0
Feb 17, 2026
Merged

Kubebuilder update from v4.11.1 to v4.12.0#686
afritzler merged 6 commits intomainfrom
kubebuilder-update-from-v4.11.1-to-v4.12.0

Conversation

@afritzler
Copy link
Member

@afritzler afritzler commented Feb 17, 2026

Summary by CodeRabbit

  • New Features

    • DevContainer for Kubebuilder development with Docker‑in‑Docker, tool installs, bash completions and post‑install setup.
    • Expanded developer guide covering project layout, scaffolding, controllers, logging conventions and deployment workflows.
    • Improved webhook initialization and clearer startup/health messages.
  • Chores

    • Bumped tool versions (kustomize, controller-tools, golangci-lint, kubebuilder CLI).
    • Added support for building a custom golangci-lint with plugins and enabled the logcheck linter.
  • Refactor

    • Standardized internal logging to derive logger from context across controllers.
  • Tests

    • Enhanced e2e readiness checks for validating webhook and added a curl‑metrics probe.

@afritzler afritzler requested a review from a team as a code owner February 17, 2026 09:52
@github-actions github-actions bot added size/XXL documentation Improvements or additions to documentation labels Feb 17, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

Kubebuilder/project tooling bumped to v4.12.0; DevContainer and post-install tooling added; golangci-lint configured to build a custom binary with a logcheck plugin; large refactor removing explicit logr.Logger parameters across many controllers in favor of ctrl.LoggerFrom(ctx); CRD controller-gen annotations and Makefile tool versions bumped; AGENTS.md replaced with a Kubebuilder developer guide.

Changes

Cohort / File(s) Summary
Project & dev environment
PROJECT, .devcontainer/devcontainer.json, .devcontainer/post-install.sh
Bump PROJECT.cliVersion to v4.12.0; add DevContainer config and post-install script that installs kind, kubebuilder, kubectl, docker, configures Docker-in-Docker and bash completions.
Linting & build
.custom-gcl.yml, .golangci.yml, Makefile
Add .custom-gcl.yml to build custom golangci-lint with sigs.k8s.io/logtools plugin; enable logcheck in .golangci.yml; update Makefile tool version vars and add conditional custom golangci-lint build when .custom-gcl.yml exists.
Documentation
AGENTS.md
Replace prior content with an extensive Kubebuilder-focused developer/operator guide (project layout, scaffolding, controller patterns, webhooks, logging, testing, deployment).
Main & webhooks
cmd/main.go
Change webhook import alias to webhookv1alpha1; split webhook setup into multiple gated Setup*WebhookWithManager calls behind ENABLE_WEBHOOKS; standardize startup/health log messages.
CRD metadata
config/crd/bases/...
Bump metadata.annotations.controller-gen.kubebuilder.io/version from v0.20.0v0.20.1 across CRD base YAMLs.
Controller logging refactor — BIOS & versions
internal/controller/bios*.go (biossettings_controller.go, biossettingsset_controller.go, biosversion_controller.go, biosversionset_controller.go)
Remove logr.Logger parameters from many reconciler/helper methods; derive logger via ctrl.LoggerFrom(ctx) inside functions; update call sites and logging invocations (widespread signature changes).
Controller logging refactor — BMC family
internal/controller/bmc*.go (bmc_controller.go, bmcsettings_controller.go, bmcsettingsset_controller.go, bmcuser_controller.go, bmcversion_controller.go, bmcversionset_controller.go)
Same refactor: drop explicit logger params, derive log from context, update call sites and some log levels/messages; numerous method signature changes.
Controller logging refactor — Server, Endpoint & helpers
internal/controller/server*.go, internal/controller/endpoint_controller.go, internal/controller/helper.go, internal/controller/serverbootconfiguration_controller.go, internal/controller/serverclaim_controller.go, internal/controller/servermaintenance_controller.go
Remove passed-in logr.Logger params; initialize log := ctrl.LoggerFrom(ctx) where needed; adjust many method signatures and internal calls to use context-derived logging.
BMC redfish cleanup
bmc/redfish.go
Remove a couple redundant error log statements in BIOS/BMC upgrade flows, consolidating error propagation without changing control flow.
Tests & test utils
test/e2e/e2e_test.go, test/utils/utils.go
Add validating webhook readiness check and stabilization wait; refactor curl-metrics pod command injection; bump cert-manager const to v1.19.3; improve an error message.
REUSE metadata
REUSE.toml
Add .devcontainer/** and .custom-gcl.yml to REUSE annotations.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related issues

Possibly related PRs

Suggested labels

enhancement, api-change, area/metal-automation

Suggested reviewers

  • xkonni
  • afritzler
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning No description was provided by the author. The template requires at least 'Proposed Changes' section with bullet points and optionally a 'Fixes' reference, but the PR is completely empty. Add a comprehensive description explaining the Kubebuilder update, including proposed changes (tool version bumps, logging refactors, webhook setup consolidation, dev environment additions), any fixes addressed, and testing performed.
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating Kubebuilder from v4.11.1 to v4.12.0, which is reflected in PROJECT file and throughout the codebase (tool versions, CRD annotations, controller-gen version updates).

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kubebuilder-update-from-v4.11.1-to-v4.12.0

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cmd/main.go (1)

575-597: ⚠️ Potential issue | 🟠 Major

ctrl.SetupSignalHandler() is called twice — use the existing context.

Line 575 creates ctx from ctrl.SetupSignalHandler(), then line 596 calls ctrl.SetupSignalHandler() again. While controller-runtime uses sync.Once internally (so it won't panic), this is confusing and redundant. Reuse ctx from line 575.

Proposed fix
 	setupLog.Info("Starting manager")
-	if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
+	if err := mgr.Start(ctx); err != nil {
 		setupLog.Error(err, "Failed to run manager")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/main.go` around lines 575 - 597, The code calls ctrl.SetupSignalHandler()
twice creating two contexts; reuse the earlier ctx instead of creating a new
one. Update the mgr.Start(...) call to pass the existing ctx variable (created
at the top) rather than calling ctrl.SetupSignalHandler() again so the manager
and the registry RunnableFunc use the same cancellation context (symbols: ctx,
mgr.Start, manager.RunnableFunc, registry.NewServer, registryServer.Start).
🧹 Nitpick comments (3)
cmd/main.go (1)

514-563: Consolidate repeated ENABLE_WEBHOOKS checks into a single block.

Seven identical if os.Getenv("ENABLE_WEBHOOKS") != "false" checks (each with // nolint:goconst) can be consolidated into one. This is likely scaffolded code, but since the project already customizes cmd/main.go, collapsing them would improve readability.

Proposed refactor
+	if os.Getenv("ENABLE_WEBHOOKS") != "false" { // nolint:goconst
+		if err := webhookv1alpha1.SetupEndpointWebhookWithManager(mgr); err != nil {
+			setupLog.Error(err, "Failed to create webhook", "webhook", "Endpoint")
+			os.Exit(1)
+		}
+		if err := webhookv1alpha1.SetupBMCSecretWebhookWithManager(mgr); err != nil {
+			setupLog.Error(err, "Failed to create webhook", "webhook", "BMCSecret")
+			os.Exit(1)
+		}
+		if err := webhookv1alpha1.SetupServerWebhookWithManager(mgr); err != nil {
+			setupLog.Error(err, "Failed to create webhook", "webhook", "Server")
+			os.Exit(1)
+		}
+		if err := webhookv1alpha1.SetupBIOSSettingsWebhookWithManager(mgr); err != nil {
+			setupLog.Error(err, "Failed to create webhook", "webhook", "BIOSSettings")
+			os.Exit(1)
+		}
+		if err := webhookv1alpha1.SetupBIOSVersionWebhookWithManager(mgr); err != nil {
+			setupLog.Error(err, "Failed to create webhook", "webhook", "BIOSVersion")
+			os.Exit(1)
+		}
+		if err := webhookv1alpha1.SetupBMCSettingsWebhookWithManager(mgr); err != nil {
+			setupLog.Error(err, "Failed to create webhook", "webhook", "BMCSettings")
+			os.Exit(1)
+		}
+		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 the current code and only fix it if needed.

In `@cmd/main.go` around lines 514 - 563, The repeated
os.Getenv("ENABLE_WEBHOOKS") != "false" checks should be collapsed into a single
check: read the env once (e.g., enableWebhooks := os.Getenv("ENABLE_WEBHOOKS")),
then if enableWebhooks != "false" call each webhook setup in sequence
(webhookv1alpha1.SetupEndpointWebhookWithManager,
SetupBMCSecretWebhookWithManager, SetupServerWebhookWithManager,
SetupBIOSSettingsWebhookWithManager, SetupBIOSVersionWebhookWithManager,
SetupBMCSettingsWebhookWithManager, SetupBMCVersionWebhookWithManager) using the
existing mgr and error handling (setupLog.Error(...) and os.Exit(1)) for each
call; remove the duplicated // nolint:goconst comments after consolidation and
keep the same contextual log keys ("webhook", "<Name>") for each error.
.devcontainer/post-install.sh (1)

50-73: Unpinned tool versions (latest) reduce build reproducibility.

Both kind and kubebuilder are installed from latest URLs. While acceptable for a dev container, this means builds may break silently when upstream releases introduce breaking changes. Consider pinning to specific versions (possibly derived from the Makefile or PROJECT file) for consistency with the rest of the toolchain.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.devcontainer/post-install.sh around lines 50 - 73, The script installs kind
and kubebuilder using unpinned "latest" URLs which hurts reproducibility; update
the post-install.sh logic to use explicit version variables (e.g., KIND_VERSION
and KUBEBUILDER_VERSION) instead of "latest" when building the download URLs for
curl, sourcing those values from the repo canonical source (Makefile, PROJECT,
or a new .versions file) and fall back to the existing ARCH variable if needed;
update the download lines that reference
"https://kind.sigs.k8s.io/dl/latest/kind-linux-${ARCH}" and
"https://go.kubebuilder.io/dl/latest/linux/${ARCH}" to use the version variables
(and update any echo messages to reflect the chosen version) so CI/devcontainers
use pinned tool versions consistent with the toolchain.
.custom-gcl.yml (1)

11-11: Consider pinning the logcheck plugin version instead of latest.

Using version: latest means the plugin version resolved during make lint can change without any change to this file, potentially causing non-reproducible lint results or unexpected breakage. Pinning to a specific release tag (e.g., v0.9.1) would improve reproducibility.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.custom-gcl.yml at line 11, The manifest uses an unstable selector "version:
latest" in .custom-gcl.yml which makes lint plugin resolution non-reproducible;
change that value to a specific released tag (for example replace version:
latest with version: v0.9.1 or the current tested release) so the logcheck
plugin version is pinned and future make lint runs are deterministic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.devcontainer/devcontainer.json:
- Around line 19-21: Replace the deprecated terminal.integrated.shell.linux
setting by adding a terminal.integrated.profiles.linux entry that defines a
profile (e.g., "bash") pointing to /bin/bash and then set
terminal.integrated.defaultProfile.linux to that profile name; update or remove
terminal.integrated.shell.linux and ensure the new profile key and
defaultProfile reference match the profile identifier used so VS Code uses
Terminal Profiles instead of the deprecated setting.

In @.devcontainer/post-install.sh:
- Around line 116-127: The Docker readiness loop currently only prints "WARNING:
Docker not ready after 30s" when the retry limit is reached, which can lead to
confusing failures later; update the for-loop block that checks docker info to
exit non-zero on failure by adding an explicit exit 1 immediately after the
warning so the script terminates cleanly instead of continuing to commands like
docker network create.

In `@AGENTS.md`:
- Line 234: The markdown line has missing spaces around the inline code token
`--force`; update the sentence so the inline code is surrounded by spaces like:
When `--force` is used — ensure the text around the inline code (`--force`)
includes a leading and trailing space so it renders correctly.
- Line 6: Add explicit language specifiers to the fenced code blocks in
AGENTS.md to satisfy MD040: replace plain triple-backtick blocks with
language-tagged ones (e.g., use ```text for directory/listing blocks and ```bash
or ```shell for command blocks). Update the specific code fences flagged
(including the block at the shown location and also those at the other flagged
occurrences) so each opening ``` has an appropriate language identifier to
ensure static analysis passes.
- Line 230: Update the external Kubernetes community links that reference the
branch name "master" by replacing them with permalink URLs that include a
concrete commit SHA (e.g., change
"https://github.com/kubernetes/community/blob/master/..." to
"https://github.com/kubernetes/community/blob/<commit-sha>/...") so CI
inclusive-language checks stop flagging them; alternatively, if you prefer not
to pin to a SHA, add an exception rule in the CI inclusive-language check for
external URLs or specifically allow these kubernetes/community links. Ensure you
update every occurrence mentioned (the URL in AGENTS.md and the other
occurrences referenced in the comment) so all CI warnings are silenced.

In `@cmd/main.go`:
- Around line 486-506: Duplicate registration of BIOSSettingsSetReconciler
causes startup failure; remove the repeated controller registration block so
BIOSSettingsSetReconciler is only registered once. Locate the two identical
SetupWithManager calls that construct
&controller.BIOSSettingsSetReconciler{Client: mgr.GetClient(), Scheme:
mgr.GetScheme()} and delete one of them (keep the BMCVersionSetReconciler
registration intact), ensuring only a single call to
BIOSSettingsSetReconciler.SetupWithManager(mgr) remains and related
setupLog.Error/os.Exit handling is preserved for the remaining block.

In `@Makefile`:
- Line 285: Update the KUBEBUILDER_VERSION variable to match the scaffolding
version used: change the KUBEBUILDER_VERSION value from v4.11.1 to v4.12.0 (the
Makefile variable KUBEBUILDER_VERSION should be set to v4.12.0 so `make
kubebuilder` installs the same Kubebuilder version used to regenerate the
project).

In `@test/e2e/e2e_test.go`:
- Around line 230-231: Replace the hard-coded time.Sleep(5 * time.Second) after
the "waiting additional time for webhook server to stabilize" step with a
deterministic polling/Eventually check: remove the sleep and instead use an
Eventually-based loop (or a small retry helper) that repeatedly calls the
webhook readiness/health endpoint or sends a probe request until it returns the
expected success response (HTTP 200 or specific JSON) within a reasonable
timeout and interval; update the test in test/e2e/e2e_test.go to call that probe
(or implement a helper like waitForWebhookReady) so the test no longer relies on
a fixed wait and becomes deterministic.

---

Outside diff comments:
In `@cmd/main.go`:
- Around line 575-597: The code calls ctrl.SetupSignalHandler() twice creating
two contexts; reuse the earlier ctx instead of creating a new one. Update the
mgr.Start(...) call to pass the existing ctx variable (created at the top)
rather than calling ctrl.SetupSignalHandler() again so the manager and the
registry RunnableFunc use the same cancellation context (symbols: ctx,
mgr.Start, manager.RunnableFunc, registry.NewServer, registryServer.Start).

---

Nitpick comments:
In @.custom-gcl.yml:
- Line 11: The manifest uses an unstable selector "version: latest" in
.custom-gcl.yml which makes lint plugin resolution non-reproducible; change that
value to a specific released tag (for example replace version: latest with
version: v0.9.1 or the current tested release) so the logcheck plugin version is
pinned and future make lint runs are deterministic.

In @.devcontainer/post-install.sh:
- Around line 50-73: The script installs kind and kubebuilder using unpinned
"latest" URLs which hurts reproducibility; update the post-install.sh logic to
use explicit version variables (e.g., KIND_VERSION and KUBEBUILDER_VERSION)
instead of "latest" when building the download URLs for curl, sourcing those
values from the repo canonical source (Makefile, PROJECT, or a new .versions
file) and fall back to the existing ARCH variable if needed; update the download
lines that reference "https://kind.sigs.k8s.io/dl/latest/kind-linux-${ARCH}" and
"https://go.kubebuilder.io/dl/latest/linux/${ARCH}" to use the version variables
(and update any echo messages to reflect the chosen version) so CI/devcontainers
use pinned tool versions consistent with the toolchain.

In `@cmd/main.go`:
- Around line 514-563: The repeated os.Getenv("ENABLE_WEBHOOKS") != "false"
checks should be collapsed into a single check: read the env once (e.g.,
enableWebhooks := os.Getenv("ENABLE_WEBHOOKS")), then if enableWebhooks !=
"false" call each webhook setup in sequence
(webhookv1alpha1.SetupEndpointWebhookWithManager,
SetupBMCSecretWebhookWithManager, SetupServerWebhookWithManager,
SetupBIOSSettingsWebhookWithManager, SetupBIOSVersionWebhookWithManager,
SetupBMCSettingsWebhookWithManager, SetupBMCVersionWebhookWithManager) using the
existing mgr and error handling (setupLog.Error(...) and os.Exit(1)) for each
call; remove the duplicated // nolint:goconst comments after consolidation and
keep the same contextual log keys ("webhook", "<Name>") for each error.

@github-actions github-actions bot added size/XL and removed size/XXL labels Feb 17, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
cmd/main.go (1)

522-571: Consider consolidating the repeated ENABLE_WEBHOOKS guard into a single block.

The same os.Getenv("ENABLE_WEBHOOKS") != "false" check is repeated 7 times, each suppressed with // nolint:goconst. This can be collapsed into one conditional containing all webhook registrations, which eliminates the need for the nolint directives entirely.

That said, I understand this may be the Kubebuilder scaffold pattern (each webhook gets its own guarded block for the // +kubebuilder:scaffold:builder marker). If you plan to keep accepting scaffold output, feel free to leave as-is.

♻️ Suggested consolidation
-	// nolint:goconst
-	if os.Getenv("ENABLE_WEBHOOKS") != "false" {
-		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)
-		}
-	}
+	if os.Getenv("ENABLE_WEBHOOKS") != "false" {
+		webhookSetups := []struct {
+			name string
+			fn   func(manager.Manager) error
+		}{
+			{"Endpoint", webhookv1alpha1.SetupEndpointWebhookWithManager},
+			{"BMCSecret", webhookv1alpha1.SetupBMCSecretWebhookWithManager},
+			{"Server", webhookv1alpha1.SetupServerWebhookWithManager},
+			{"BIOSSettings", webhookv1alpha1.SetupBIOSSettingsWebhookWithManager},
+			{"BIOSVersion", webhookv1alpha1.SetupBIOSVersionWebhookWithManager},
+			{"BMCSettings", webhookv1alpha1.SetupBMCSettingsWebhookWithManager},
+			{"BMCVersion", webhookv1alpha1.SetupBMCVersionWebhookWithManager},
+		}
+		for _, ws := range webhookSetups {
+			if err := ws.fn(mgr); err != nil {
+				setupLog.Error(err, "Failed to create webhook", "webhook", ws.name)
+				os.Exit(1)
+			}
+		}
+	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/main.go` around lines 522 - 571, The repeated
os.Getenv("ENABLE_WEBHOOKS") != "false" guard is duplicated around each webhook
registration; consolidate by evaluating ENABLE_WEBHOOKS once and, if true, call
webhookv1alpha1.SetupEndpointWebhookWithManager,
SetupBMCSecretWebhookWithManager, SetupServerWebhookWithManager,
SetupBIOSSettingsWebhookWithManager, SetupBIOSVersionWebhookWithManager,
SetupBMCSettingsWebhookWithManager and SetupBMCVersionWebhookWithManager inside
a single if block so you remove the repeated nolint:goconst comments and avoid
redundant checks; if Kubebuilder scaffold markers require separate blocks,
instead move a single boolean like enableWebhooks :=
os.Getenv("ENABLE_WEBHOOKS") != "false" above and use that variable in each
existing if to eliminate repeated environment lookups while preserving scaffold
placement.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@cmd/main.go`:
- Around line 522-571: The repeated os.Getenv("ENABLE_WEBHOOKS") != "false"
guard is duplicated around each webhook registration; consolidate by evaluating
ENABLE_WEBHOOKS once and, if true, call
webhookv1alpha1.SetupEndpointWebhookWithManager,
SetupBMCSecretWebhookWithManager, SetupServerWebhookWithManager,
SetupBIOSSettingsWebhookWithManager, SetupBIOSVersionWebhookWithManager,
SetupBMCSettingsWebhookWithManager and SetupBMCVersionWebhookWithManager inside
a single if block so you remove the repeated nolint:goconst comments and avoid
redundant checks; if Kubebuilder scaffold markers require separate blocks,
instead move a single boolean like enableWebhooks :=
os.Getenv("ENABLE_WEBHOOKS") != "false" above and use that variable in each
existing if to eliminate repeated environment lookups while preserving scaffold
placement.

@afritzler afritzler added the enhancement New feature or request label Feb 17, 2026
}

// nolint:goconst
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need all the os.Getenv("ENABLE_WEBHOOKS") != "false" blocks. We could have just one right?

Copy link
Member Author

Choose a reason for hiding this comment

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

If we drop that, we will run into merge conflicts in case we add new webhooks as this will violate the kubebuilder template.

@afritzler afritzler merged commit 8c69240 into main Feb 17, 2026
18 checks passed
@afritzler afritzler deleted the kubebuilder-update-from-v4.11.1-to-v4.12.0 branch February 17, 2026 13:12
@github-project-automation github-project-automation bot moved this to Done in Roadmap Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/metal-automation documentation Improvements or additions to documentation enhancement New feature or request size/XL

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants