Skip to content

feat: surface apiserver logs via KS_LOGGER_LEVEL=debug; document >=1.28 requirement#336

Merged
matthyx merged 1 commit into
mainfrom
feat/surface-apiserver-logs
Jun 12, 2026
Merged

feat: surface apiserver logs via KS_LOGGER_LEVEL=debug; document >=1.28 requirement#336
matthyx merged 1 commit into
mainfrom
feat/surface-apiserver-logs

Conversation

@matthyx

@matthyx matthyx commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Why

While debugging a customer's IPv6-only cluster (follow-up to #333), the storage pod was NotReady with MissingEndpoints and only 4 log lines — no clue why. Root cause turned out to be a Kubernetes 1.26 cluster (storage requires >= 1.28): the delegated-authentication informer never completes its cache sync against the older control plane, so /readyz is stuck at [-]informer-sync.

The reason it took so long to find: main.go unconditionally muted klog (the Kubernetes apiserver's own logger — serving, aggregation, informer-sync, post-start hooks) to Fatal, dropping the reflector error that would have named the cause immediately.

Changes

  • main.go — gate the klog level on KS_LOGGER_LEVEL. At debug, surface apiserver logs; otherwise keep the quiet Fatal default (no behavior change unless opted in). The chart already plumbs KS_LOGGER_LEVEL from logger.level.
  • README.md — document the >= 1.28 requirement (with the exact informer-sync / MissingEndpoints failure signature), the IPv6 serverBindAddress behavior, and the KS_LOGGER_LEVEL=debug knob.

Testing

  • go build ./... and go vet . pass.
  • Default behavior unchanged (klog stays Fatal); KS_LOGGER_LEVEL=debug now lets apiserver diagnostics through.

Related

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Added Requirements section specifying minimum Kubernetes version (1.28+)
    • Added configuration guidance for IPv6-only and dual-stack cluster setups
    • Documented informer cache sync behavior considerations for older Kubernetes versions
  • New Features

    • Added debug-level logging support via KS_LOGGER_LEVEL=debug environment variable for improved troubleshooting

…28 requirement

The apiserver's klog output (serving, aggregation, informer-sync, post-start
hooks) was unconditionally muted to Fatal, hiding the diagnostics needed to
debug startup/readyz failures. A real case: on a Kubernetes 1.26 cluster the
delegated-authentication informer never syncs, so /readyz reports
[-]informer-sync, the pod stays NotReady, and the APIService shows
MissingEndpoints -- with zero log output to explain why.

Gate the klog level on KS_LOGGER_LEVEL: at debug, surface apiserver logs;
otherwise keep the quiet Fatal default (no behavior change). Document the
>=1.28 minimum, IPv6 bind behavior, and the debug knob in the README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d99aa5f2-02e7-4a62-bc7e-3c67469dad9e

📥 Commits

Reviewing files that changed from the base of the PR and between 11472e5 and c79667f.

📒 Files selected for processing (2)
  • README.md
  • main.go

📝 Walkthrough

Walkthrough

This PR adds debug-level logging capability to the storage service and documents operational requirements. The main.go changes implement conditional logger configuration based on the KS_LOGGER_LEVEL environment variable, while README updates specify Kubernetes version requirements and provide setup guidance.

Changes

Debug Logging Feature

Layer / File(s) Summary
Logger level configuration
main.go
Adds strings import and replaces fixed log configuration with conditional logic: klog defaults to Fatal level but switches to Info when KS_LOGGER_LEVEL is set to "debug" (case-insensitive).
Requirements documentation
README.md
Documents minimum Kubernetes version (>= 1.28), informer cache sync behavior on older clusters, IPv6-only and dual-stack binding guidance, and instructions to enable debug logging via KS_LOGGER_LEVEL=debug.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Debug logs now dance at your command,
A simple toggle to understand,
With KS_LOGGER_LEVEL set to debug,
The informers whisper without a shrug,
Requirements clear for clusters new!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the two main changes: enabling debug logging via KS_LOGGER_LEVEL and documenting the Kubernetes 1.28+ requirement, matching the changeset exactly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/surface-apiserver-logs

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 and usage tips.

@matthyx matthyx merged commit 54669a0 into main Jun 12, 2026
7 checks passed
@matthyx matthyx deleted the feat/surface-apiserver-logs branch June 12, 2026 09:24
@github-actions

Copy link
Copy Markdown

Summary:

  • License scan: failure
  • Credentials scan: failure
  • Vulnerabilities scan: failure
  • Unit test: success
  • Go linting: failure

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.

1 participant