kubernetes-sigs / kubernetes-sigs/node-readiness-controller
[FEATURE] Allow disabling development mode for the logger
- Dominant language
- Go
- Stars
- 163
- Forks
- 74
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 9
Description
### Is your feature request related to a problem or existing issue? Please describe.
Our logging infrastructure is optimized for handling structured JSON log lines, where the entire line is a valid JSON object.
This project uses Zap for logging, which is intended to be used for structured logging. But `Development` mode is enabled, which moves the timestamp, log level, and message out of the JSON:
https://github.com/kubernetes-sigs/node-readiness-controller/blob/4185cf0747286839834b0a7228ceece7b91e69de/cmd/main.go#L114
For example, this is the current output I get:
```
2026-09-15T18:01:30-07:00 INFO Starting EventSource {"controller": "nodereadiness-controller", "controllerGroup": "readiness.node.x-k8s.io", "controllerKind": "NodeReadinessRule", "source": "kind source: *v1alpha1.NodeReadinessRule"}
```
If I flip that flag `Development` flag to `false`, then the entire line is valid JSON:
```
{"level":"info","ts":"2026-09-15T18:01:56-07:00","msg":"Starting EventSource","controller":"node","controllerGroup":"","controllerKind":"Node","source":"kind source: *v1.Node"}
```
### Describe the solution you'd like
We could follow the example of [etcd](https://etcd.io/docs/v3.7/op-guide/configuration/#logging) and add a `--log-format` CLI arg that could be either `json` or `console`, default it to `json`, and allow people to opt in to the development-friendly `console`.
### Describe alternatives you've considered
- We could just hard-code Development = false. I'm not sure how disruptive this would be to your local development though.
### AI Tools Usage
- [x] No AI tools were used
- [ ] AI tools were used (complete below)
### How They Were Used
_No response_
Contributor guide
Research direction
Start in cmd/main.go around the logger setup at line 114 and trace how command-line options are defined and passed into logging. Add a --log-format choice for json or console, keep json as the default, and verify that both formats produce the intended output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, observability
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100