Skip to content

Conversation

@gdziwoki
Copy link

This pull request focuses on modernizing dependencies, improving error handling, and increasing robustness and clarity in event processing.
The primary changes include upgrading Go and related dependencies, simplifying configuration and sink handling, and making the event processing logic more defensive and informative.

Dependency and Build Modernization:

  • Upgraded the Go version from 1.23 to 1.25 in go.mod, Dockerfile, and GitHub Actions workflow, and updated all major dependencies (including Kubernetes, Prometheus, and Viper) to their latest versions, ensuring improved security, compatibility, and performance. [1] [2] [3]
  • Updated the Docker base image to use the latest distroless static image and newer Alpine version for builds.

Configuration and Sink Handling:

  • Simplified the default configuration in config.json to only use the stdout sink, removing unused or legacy sink options and reducing complexity.
  • Changed the default sink to stdout in the code and made config file loading more robust by logging warnings instead of panicking on missing or invalid configs.
  • Removed legacy and unused sink code (RFC5424, flattened JSON, and related dependencies) from sinks/eventdata.go, further streamlining the codebase. [1] [2]

Event Processing Robustness:

  • Refactored event handling functions (addEvent, updateEvent, deleteEvent) to include type checks, nil checks, and more descriptive logging, preventing panics and improving debuggability. [1] [2]
  • Added a helper function shouldProcessEvent to centralize logic for determining if an event should be processed based on resource version.
  • Improved Prometheus metric recording with safer label handling, better error messages, and additional debug logs.

Configuration and Resource Version Handling:

  • Refactored the main configuration loader to return errors instead of panicking, and improved handling of resource version bookmarks for more reliable restarts and state tracking. [1] [2]

Minor Improvements:

  • Removed unused imports and replaced deprecated ioutil functions with modern equivalents. [1] [2]

Most Important Changes

Dependency and Build Modernization

  • Upgraded Go version to 1.25 and updated all major dependencies (Kubernetes, Prometheus, Viper, etc.) to their latest releases in go.mod, Dockerfile, and CI workflow. [1] [2] [3]
  • Switched the Docker runtime image to the latest distroless static image and updated the build stage to Alpine 3.22.

Configuration and Sink Handling

  • Reduced config.json to a minimal default (stdout sink only), removing legacy/unused sink configs.
  • Changed the default sink to stdout and made config loading fault-tolerant, logging warnings instead of panicking.
  • Removed legacy sink code and dependencies from sinks/eventdata.go. [1] [2]

Event Processing Robustness

  • Refactored event handling to include type/nil checks and improved logging, preventing panics and making debugging easier. [1] [2]
  • Centralized event processing logic with a new shouldProcessEvent helper.
  • Enhanced Prometheus metric recording with safer label handling and better error/debug output.

Configuration and Resource Version Handling

  • Refactored configuration loader to return errors, not panics, and improved resource version bookmark handling for more reliable state tracking. [1] [2]

Minor Improvements

  • Removed unused imports and replaced deprecated ioutil usage with modern equivalents. [1] [2]

Signed-off-by: Grzegorz Dziwoki <grzegorz.dziwoki@jamf.com>
@pepov pepov requested review from OverOrion, csatib02 and pepov November 2, 2025 14:43
@csatib02 csatib02 merged commit e1f1c6e into kube-logging:master Nov 3, 2025
6 checks passed
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.

4 participants