kubeslice / kubeslice/worker-operator
Bug: `controllers/slice/reconciler.go` imports stdlib `log` package alongside structured logger
- Dominant language
- Go
- Stars
- 62
- Forks
- 33
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 3
Description
### 📜 Description
`controllers/slice/reconciler.go` imports both `"log"` (stdlib) and the project's structured `logr`/zap logger. The `log.Fatalf` call in `SetupWithManager` (line 408) bypasses the structured logger, writes to stderr in a different format, and calls `os.Exit(1)` without the manager having a chance to run shutdown hooks. Every other reconciler in the project uses `ctrl.Log` or `logger.FromContext(ctx)` for fatal-level setup errors.
### 👟 Reproduction steps
1. Read `controllers/slice/reconciler.go`, line 408: `log.Fatalf("Error creating label requirement: %v", err)`
2. Compare with the pattern in `controllers/slicegateway/reconciler.go` — it returns an error from `SetupWithManager` instead of calling `log.Fatal`.
### 👍 Expected behavior
`SetupWithManager` should return the error to the caller (`main.go`), which already handles it with `os.Exit(1)` and the structured logger.
### 👎 Actual Behavior
A label selector construction error in `SetupWithManager` panics with an unstructured message and bypasses the normal manager shutdown path. The `"log"` import is also inconsistent with every other file in the codebase.
### 🐚 Relevant log output
```shell
```
### Version
_No response_
### 🖥️ What operating system are you seeing the problem on?
_No response_
### ✅ Proposed Solution
Replace `log.Fatalf(...)` with `return fmt.Errorf("error creating label requirement: %w", err)` and remove the stdlib `"log"` import.
### 👀 Have you spent some time to check if this issue has been raised before?
- [x] I checked and didn't find any similar issue
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.