Skip to content

[APIP] update logging implementation to use logr and add slog handler#2786

Merged
DDH13 merged 3 commits into
wso2:mainfrom
DDH13:main
Jul 23, 2026
Merged

[APIP] update logging implementation to use logr and add slog handler#2786
DDH13 merged 3 commits into
wso2:mainfrom
DDH13:main

Conversation

@DDH13

@DDH13 DDH13 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Related to #2784

This pull request primarily updates the Helm chart version for the Gateway Operator and makes extensive updates to the go.work.sum file, adding or updating references to various Go module dependencies. These changes help keep dependencies current and improve compatibility and security.

The most important changes include:

Gateway Operator update:

  • Updated the installation command in gateway-operator.md to use Gateway Operator Helm chart version 0.10.0 and image tag 0.10.0, up from 0.8.0/0.8.1.

Go module dependency additions and updates:

  • Added or updated references for several dependencies in go.work.sum, including but not limited to:
    • github.com/prometheus/client_golang to v1.20.5 and github.com/prometheus/common to v0.62.0
    • github.com/onsi/ginkgo/v2 to v2.27.4 and github.com/onsi/gomega to v1.39.0
    • go.etcd.io/etcd and related modules to v3.6.8
    • github.com/google/pprof to v0.0.0-20250403155104-27863c87afa6
    • Added new or updated references for other modules such as github.com/spf13/cobra, github.com/grpc-ecosystem/go-grpc-middleware, github.com/tmc/grpc-websocket-proxy, and more. [1] [2] [3]

These updates ensure the project uses the latest compatible versions of its dependencies, which can provide bug fixes, security patches, and new features.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Gateway Operator logging backend changes from Zap to Go’s log/slog, with updated logger wiring, controller signatures, structured log calls, dependencies, tests, image defaults, Helm values, and installation documentation aligned to version 0.10.0.

Changes

Gateway Operator logging and release refresh

Layer / File(s) Summary
Slog logger factory and application wiring
kubernetes/gateway-operator/pkg/logger/logger.go, kubernetes/gateway-operator/cmd/main.go
Slog handlers replace Zap logger construction, controller-runtime receives a slog-backed logr adapter, and all reconciler registrations receive the shared application logger.
Gateway and deployment reconciler logging
kubernetes/gateway-operator/internal/controller/apigateway_controller.go, internal/controller/generic_reconciler.go, internal/controller/k8s_*controller.go, internal/controller/restapi_controller.go
Reconciler logger fields, constructors, helper parameters, and structured logging calls use *slog.Logger while reconciliation, deployment, retry, status, and deletion behavior remains unchanged.
HTTPRoute compilation and policy logging
kubernetes/gateway-operator/internal/controller/httproute_*.go
HTTPRoute compilation, reconciliation, enqueueing, policy loading, and value resolution use slog logger parameters and attributes.
Supporting controller constructor and watch updates
kubernetes/gateway-operator/internal/controller/{apikey,certificate,llmprovider,llmprovidertemplate,llmproxy,managedsecret,mcp,subscription,subscriptionplan}_controller.go, internal/controller/*enqueue.go, internal/controller/k8s_gatewayclass_controller_test.go
Additional controller constructors, watch helpers, and GatewayClass tests migrate from Zap logger dependencies to slog.
Module, image, and documentation version alignment
kubernetes/gateway-operator/go.mod, kubernetes/gateway-operator/Makefile, kubernetes/helm/operator-helm-chart/values-local.yaml, kubernetes/conformance/README.md, docs/gateway/kubernetes/gateway-operator.md
Module requirements and documented or default image/chart tags are updated for the 0.10.0 release.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: ashera96, pubudu538, renuka-fernando

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 64.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description is largely incomplete because it omits most required template sections, including Purpose, Goals, Approach, tests, security, and environment. Fill in the required template sections: Purpose, Goals, Approach, User stories, Documentation, Automation tests, Security checks, Samples, Related PRs, and Test environment.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title matches the main logging migration and slog handler addition, though "logr" is slightly imprecise.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

DDH13 added 3 commits July 22, 2026 15:57
… related components

- Updated K8sGatewayClassReconciler, LlmProviderReconciler, LlmProviderTemplateReconciler, LlmProxyReconciler, ManagedSecretReconciler, McpReconciler, RestApiReconciler, SubscriptionReconciler, and SubscriptionPlanReconciler to use slog.Logger instead of zap.Logger.
- Modified logger initialization methods to create slog.Logger instances.
- Adjusted logging calls to match the new slog API.
- Removed zap dependency and related logger configuration code from logger package.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
kubernetes/gateway-operator/pkg/logger/logger.go (1)

33-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding unit tests for the new level/format parsing.

parseSlogLevel and NewSlogHandler are small, pure, and easy to unit test (format branch, each level string, unknown-level fallback), but no test file was included for this new logic. Worth covering since this replaces the whole logging backend.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kubernetes/gateway-operator/pkg/logger/logger.go` around lines 33 - 60, Add
unit tests for parseSlogLevel covering debug, warn/warning, error, and
unknown-level fallback to info. Add NewSlogHandler tests covering both text and
JSON format branches, verifying the returned handler behavior or concrete
handler type without changing the implementation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@kubernetes/gateway-operator/pkg/logger/logger.go`:
- Around line 33-60: Add unit tests for parseSlogLevel covering debug,
warn/warning, error, and unknown-level fallback to info. Add NewSlogHandler
tests covering both text and JSON format branches, verifying the returned
handler behavior or concrete handler type without changing the implementation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3ed4c5bb-da31-45c6-a9c2-27b3e3cd5ca0

📥 Commits

Reviewing files that changed from the base of the PR and between ede388a and 57db7f0.

⛔ Files ignored due to path filters (2)
  • go.work.sum is excluded by !**/*.sum
  • kubernetes/gateway-operator/go.sum is excluded by !**/*.sum
📒 Files selected for processing (29)
  • docs/gateway/kubernetes/gateway-operator.md
  • kubernetes/conformance/README.md
  • kubernetes/gateway-operator/Makefile
  • kubernetes/gateway-operator/cmd/main.go
  • kubernetes/gateway-operator/go.mod
  • kubernetes/gateway-operator/internal/controller/apigateway_controller.go
  • kubernetes/gateway-operator/internal/controller/apikey_controller.go
  • kubernetes/gateway-operator/internal/controller/certificate_controller.go
  • kubernetes/gateway-operator/internal/controller/generic_reconciler.go
  • kubernetes/gateway-operator/internal/controller/httproute_compile.go
  • kubernetes/gateway-operator/internal/controller/httproute_controller.go
  • kubernetes/gateway-operator/internal/controller/httproute_enqueue.go
  • kubernetes/gateway-operator/internal/controller/httproute_policies.go
  • kubernetes/gateway-operator/internal/controller/httproute_policy_params_resolve.go
  • kubernetes/gateway-operator/internal/controller/k8s_gateway_controller.go
  • kubernetes/gateway-operator/internal/controller/k8s_gatewayclass_controller.go
  • kubernetes/gateway-operator/internal/controller/k8s_gatewayclass_controller_test.go
  • kubernetes/gateway-operator/internal/controller/llmprovider_controller.go
  • kubernetes/gateway-operator/internal/controller/llmprovidertemplate_controller.go
  • kubernetes/gateway-operator/internal/controller/llmproxy_controller.go
  • kubernetes/gateway-operator/internal/controller/managedsecret_controller.go
  • kubernetes/gateway-operator/internal/controller/mcp_controller.go
  • kubernetes/gateway-operator/internal/controller/restapi_controller.go
  • kubernetes/gateway-operator/internal/controller/restapi_enqueue.go
  • kubernetes/gateway-operator/internal/controller/subscription_controller.go
  • kubernetes/gateway-operator/internal/controller/subscriptionplan_controller.go
  • kubernetes/gateway-operator/internal/helmgateway/deploy.go
  • kubernetes/gateway-operator/pkg/logger/logger.go
  • kubernetes/helm/operator-helm-chart/values-local.yaml

@DDH13
DDH13 merged commit 4457fa0 into wso2:main Jul 23, 2026
17 of 19 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.

3 participants