Skip to content

Conversation

@afritzler
Copy link
Member

@afritzler afritzler commented Dec 9, 2025

Proposed Changes

  • Harmonize reconciler logic and improve logging
  • Bump k8s.io envtest setup to 1.34

Summary by CodeRabbit

  • Chores

    • Updated golangci-lint to v2.6 for improved code quality checks.
    • Upgraded Kubernetes support from 1.31 to 1.34.
    • Updated API reference documentation links to reflect Kubernetes 1.34 compatibility.
  • Tests

    • Updated test infrastructure to use Kubernetes 1.34 binary assets.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added api-change documentation Improvements or additions to documentation enhancement New feature or request size/L labels Dec 9, 2025
Copy link
Member

@hardikdr hardikdr left a comment

Choose a reason for hiding this comment

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

Thanks for all the polishing @afritzler

if ignitionErr != nil {
patchError := r.patchStatus(ctx, HTTPBootConfig, state)
if patchError != nil {
return ctrl.Result{}, fmt.Errorf("failed to patch status %w %w", ignitionErr, patchError)
Copy link
Member

Choose a reason for hiding this comment

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

While we loose reporting the IgnitionErr when Patch fails, I do like simplistic error model here, thanks.

Copy link
Member

@hardikdr hardikdr left a comment

Choose a reason for hiding this comment

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

Could you please rebase and it's good to go in.

@hardikdr
Copy link
Member

hardikdr commented Jan 7, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

Walkthrough

This PR updates Kubernetes dependencies from v1.31 to v1.34, upgrades golangci-lint tooling from v2.1 to v2.6, and refactors boot configuration controller reconciliation logic with standardized parameter naming, context-based logging, and new SetupWithManager methods for resource integration.

Changes

Cohort / File(s) Summary
Tooling Updates
.github/workflows/lint.yml, Makefile
Bump golangci-lint-action and GOLANGCI_LINT_VERSION from v2.5/v2.1 to v2.6
Kubernetes Dependency Upgrades
cmdutils/suite_test.go, internal/controller/suite_test.go
Update BinaryAssetsDirectory version from 1.31.0 to 1.34.0 for test fixtures
API Documentation Updates
docs/api-reference/api.md, hack/api-reference/config.json
Update Kubernetes API reference links and URL templates from v1.31 to v1.34
HTTPBootConfig Controller Refactoring
internal/controller/httpbootconfig_controller.go
Standardize parameter naming (HTTPBootConfig → config), add SetupWithManager with Secret watches, introduce context-based logging, update method signatures and reconciliation flow
IPXEBootConfig Controller Refactoring
internal/controller/ipxebootconfig_controller.go
Replace log.Log with ctrl.LoggerFrom(ctx), add SetupWithManager, rename parameters to config, update secret enqueue logic and error handling across reconciliation paths
ServerBootConfiguration HTTP Controller Refactoring
internal/controller/serverbootconfiguration_http_controller.go
Remove log package dependency, replace with ctx-based logging, add SetupWithManager method, refactor enqueue logic with bootConfigList iteration
ServerBootConfiguration PXE Controller Refactoring
internal/controller/serverbootconfiguration_pxe_controller.go
Reintroduce ServerBootConfigurationPXEReconciler type, add SetupWithManager, rename enqueue function (enqueueServerBootConfigFromIgnitionSecret), refactor reconcile flow to operate on bootConfig with updated status patching and IPXE config handling

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description covers the main objectives (harmonize reconciler logic, improve logging, bump k8s.io to 1.34) but the template requires proposed changes with bullet points and issue fix reference—the description is incomplete against the template requirements. Expand the description to include detailed bullet points for each change and add 'Fixes #<issue_number>' if applicable. Follow the template structure more closely.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Harmonize reconciler logic and improve logging' is clearly related to the main changes, which involve substantial refactoring of multiple reconciler controllers (HTTPBootConfig, IPXEBootConfig, ServerBootConfiguration) with improved logging throughout.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

@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: 0

🧹 Nitpick comments (3)
internal/controller/ipxebootconfig_controller.go (1)

49-68: Inconsistent error handling compared to HTTPBootConfigReconciler.

This reconciler returns an error after ensureIgnition fails (line 58), while HTTPBootConfigReconciler logs and returns nil (httpbootconfig_controller.go:58-59). The approach here is preferable as it enables retries, but consider aligning behavior across controllers.

internal/controller/httpbootconfig_controller.go (1)

119-129: Inefficient cross-namespace listing.

Line 120 lists all HTTPBootConfig resources across all namespaces with client.InNamespace(""), then filters by namespace match on lines 127-129. The IPXEBootConfigReconciler (ipxebootconfig_controller.go:119) uses client.InNamespace(secretObj.Namespace) directly, which is more efficient.

Consider aligning with the IPXE controller approach:

♻️ Suggested fix
-	if err := r.List(ctx, configList, client.InNamespace("")); err != nil {
+	if err := r.List(ctx, configList, client.InNamespace(secretObj.Namespace)); err != nil {
		log.Error(err, "failed to list HTTPBootConfig for Secret", "Secret", client.ObjectKeyFromObject(secretObj))
		return nil
	}

	var requests []reconcile.Request
	for _, config := range configList.Items {
-		if config.Spec.IgnitionSecretRef != nil &&
-			config.Spec.IgnitionSecretRef.Name == secretObj.Name &&
-			config.Namespace == secretObj.Namespace {
+		if config.Spec.IgnitionSecretRef != nil &&
+			config.Spec.IgnitionSecretRef.Name == secretObj.Name {
internal/controller/serverbootconfiguration_pxe_controller.go (1)

196-208: Suboptimal slice capacity.

Line 202 pre-allocates capacity of 1, but servers typically have multiple network interfaces. The HTTP controller (serverbootconfiguration_http_controller.go:174) uses 2*len(server.Status.NetworkInterfaces).

♻️ Suggested fix
-	systemIPs := make([]string, 0, 1)
+	systemIPs := make([]string, 0, len(server.Status.NetworkInterfaces))
	for _, nic := range server.Status.NetworkInterfaces {
		systemIPs = append(systemIPs, nic.IP.String())
	}
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 77b672d and 3883e25.

📒 Files selected for processing (10)
  • .github/workflows/lint.yml
  • Makefile
  • cmdutils/suite_test.go
  • docs/api-reference/api.md
  • hack/api-reference/config.json
  • internal/controller/httpbootconfig_controller.go
  • internal/controller/ipxebootconfig_controller.go
  • internal/controller/serverbootconfiguration_http_controller.go
  • internal/controller/serverbootconfiguration_pxe_controller.go
  • internal/controller/suite_test.go
🧰 Additional context used
🧬 Code graph analysis (4)
internal/controller/serverbootconfiguration_http_controller.go (2)
cmd/bootctl/app/app.go (1)
  • Name (15-15)
api/v1alpha1/httpbootconfig_types.go (1)
  • HTTPBootConfig (54-60)
internal/controller/httpbootconfig_controller.go (2)
api/v1alpha1/httpbootconfig_types.go (4)
  • HTTPBootConfig (54-60)
  • HTTPBootConfigState (34-34)
  • HTTPBootConfigStateError (44-44)
  • HTTPBootConfigList (65-69)
api/v1alpha1/constants.go (1)
  • DefaultIgnitionKey (7-7)
internal/controller/serverbootconfiguration_pxe_controller.go (2)
api/v1alpha1/ipxebootconfig_types.go (3)
  • IPXEBootConfig (73-79)
  • IPXEBootConfigStateReady (48-48)
  • IPXEBootConfigStateError (54-54)
server/bootserver.go (1)
  • SetStatusCondition (446-474)
internal/controller/ipxebootconfig_controller.go (1)
api/v1alpha1/ipxebootconfig_types.go (3)
  • IPXEBootConfig (73-79)
  • IPXEBootConfigState (44-44)
  • IPXEBootConfigList (84-88)
🔇 Additional comments (16)
cmdutils/suite_test.go (1)

62-62: LGTM! Consistent Kubernetes test binary version upgrade.

The BinaryAssetsDirectory paths have been correctly updated from 1.31.0 to 1.34.0 for both source and target test environments, aligning with the PR objective to bump envtest to Kubernetes 1.34.

Also applies to: 92-92

hack/api-reference/config.json (1)

24-24: LGTM! API reference documentation URL aligned with Kubernetes 1.34.

The docsURLTemplate has been correctly updated to reference v1.34 Kubernetes API documentation, ensuring generated API docs link to the appropriate version.

internal/controller/suite_test.go (1)

78-78: LGTM! Kubernetes test binary version upgraded to 1.34.0.

The BinaryAssetsDirectory path correctly references the new Kubernetes 1.34.0 test binaries, consistent with other test files in this PR.

docs/api-reference/api.md (1)

51-51: LGTM! Kubernetes API reference links consistently updated to v1.34.

All Kubernetes API documentation hyperlinks (ObjectMeta, LocalObjectReference, Condition) have been correctly updated from v1.31 to v1.34, ensuring users reference the appropriate Kubernetes API version.

Also applies to: 89-89, 171-171, 275-275, 288-288, 345-345, 435-435, 543-543, 556-556, 625-625

.github/workflows/lint.yml (1)

20-20: LGTM! golangci-lint binary version updated.

The update from v2.5 to v2.6 is a straightforward tooling upgrade. The version field specifies the golangci-lint binary version, not the GitHub action version itself.

Likely an incorrect or invalid review comment.

internal/controller/serverbootconfiguration_http_controller.go (2)

254-280: LGTM on the refactored enqueue function.

The switch to ctrl.LoggerFrom(ctx) and standardized bootConfig/bootConfigList naming aligns well with the harmonization effort across controllers.


282-292: SetupWithManager implementation follows established patterns.

The wiring correctly manages ServerBootConfiguration, owns HTTPBootConfig, and watches Secrets for ignition secret changes.

internal/controller/ipxebootconfig_controller.go (2)

33-40: LGTM on the Reconcile method refactoring.

The switch to ctrl.LoggerFrom(ctx) and config variable naming is consistent with the harmonization effort.


137-147: SetupWithManager implementation is correct.

Properly registers the controller for IPXEBootConfig and watches Secrets for ignition changes.

internal/controller/httpbootconfig_controller.go (3)

33-40: LGTM on the Reconcile method refactoring.

Consistent use of ctrl.LoggerFrom(ctx) and config variable naming.


54-59: Error swallowing on ignition failure is intentional.

The reconciler logs the error and returns nil rather than propagating it. This prevents retries when ignition setup fails, which may be the desired behavior based on prior review discussions.


140-150: SetupWithManager implementation is correct.

Follows the established pattern and properly registers Secret watches.

internal/controller/serverbootconfiguration_pxe_controller.go (3)

57-62: LGTM on the reconciler struct declaration.

The struct fields are properly defined with consistent naming.


94-160: Reconcile logic is well-structured.

The distinction between bootConfig (ServerBootConfiguration) and config (IPXEBootConfig) clearly communicates the parent-child relationship. Controller reference setup and apply logic are correct.


373-384: SetupWithManager implementation is correct.

Properly manages ServerBootConfiguration, owns IPXEBootConfig, and watches Secrets for ignition changes. Consistent with the HTTP controller's setup pattern.

Makefile (1)

204-204: Version bump to v2.6 is valid.

golangci-lint v2.6.0 was released in October 2025 with patch releases available. The update aligns well with the CI workflow changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-change area/metal-automation documentation Improvements or additions to documentation enhancement New feature or request size/L

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants