Skip to content

fix: remove stdlib log import from slice reconciler SetupWithManager#481

Open
mdryaan wants to merge 1 commit into
kubeslice:masterfrom
mdryaan:fix/slice-reconciler-stdlog-import
Open

fix: remove stdlib log import from slice reconciler SetupWithManager#481
mdryaan wants to merge 1 commit into
kubeslice:masterfrom
mdryaan:fix/slice-reconciler-stdlog-import

Conversation

@mdryaan
Copy link
Copy Markdown

@mdryaan mdryaan commented May 14, 2026

Description

controllers/slice/reconciler.go was importing the stdlib "log" package for a single log.Fatalf call inside SetupWithManager. This bypasses the structured logger used everywhere else in the project, writes to stderr in a different format, and calls os.Exit(1) without giving the controller-runtime manager a chance to run shutdown hooks.

Every other reconciler in this codebase returns errors from SetupWithManagermain.goalready handles them with the structured logger and os.Exit(1). This just makes the slice reconciler consistent with that pattern.

Changed log.Fatalf("Error creating label requirement: %v", err) to return fmt.Errorf("error creating label requirement: %w", err) and removed the "log" import. fmt was already imported so no new dependency is added.

Fixes #480

How Has This Been Tested?

  • make fmt — no formatting changes
  • make vet — no issues
  • make build — builds cleanly

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have ran go fmt
  • I have updated the helm chart as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit test cases.
  • I have verified the E2E test cases with new code changes.
  • I have added all the required E2E test cases.

Does this PR introduce a breaking change?


…anager

Signed-off-by: mdryaan <alikhurshid842001@gmail.com>
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.

Bug: controllers/slice/reconciler.go imports stdlib log package alongside structured logger

1 participant