spicedb-operator
spicedb-operator copied to clipboard
Support JSON logging format in operator
Summary
- Add
--log-formatflag to support JSON logging output - Enable structured logging for better integration with log aggregation systems
Description
This PR adds support for JSON-formatted logs in the SpiceDB Operator, addressing issue #349. By default, the operator uses text-based logging, but operators can now use the --log-format=json flag to enable structured JSON logging.
Changes
- Added
--log-formatflag to theruncommand with validation - Integrated zap logger for JSON output when requested
- Updated controller to accept logger as a parameter instead of creating hardcoded instances
- Added comprehensive tests for the new functionality
- Added example deployment manifest showing JSON logging configuration
- Added documentation explaining the feature and integration with log aggregation systems
Testing
- Added unit tests for log format validation
- Added integration tests verifying JSON output format
- Updated existing controller tests to pass logger parameter
- All tests pass successfully
Backward Compatibility
- Default behavior unchanged (text format)
- No breaking changes to existing deployments
- Empty log format defaults to text
Fixes #349