Skip to content

Log MCPRegistry deprecation at most once - #6366

Open
asjdf wants to merge 1 commit into
stacklok:mainfrom
asjdf:fix/6346-mcpregistry-deprecation-warn-once
Open

Log MCPRegistry deprecation at most once#6366
asjdf wants to merge 1 commit into
stacklok:mainfrom
asjdf:fix/6346-mcpregistry-deprecation-warn-once

Conversation

@asjdf

@asjdf asjdf commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • The MCPRegistry CRD is marked +kubebuilder:deprecatedversion, so kube-apiserver sends a 299 Warning header on every LIST/WATCH. controller-runtime's cache logged that on every informer resync (~6 minutes) even when zero MCPRegistry CRs exist (bug(operator): MCPRegistry deprecation warning logs on a timer even when no MCPRegistry CRs exist #6346).
  • Install a client-go WarningHandler at operator startup that forwards the MCPRegistry deprecation header once (sync.Once) and leaves every other API warning unchanged.
  • Unit tests cover resync collapse, passthrough of unrelated warnings, concurrent first-LIST races, and the rest.Config install path.

Fixes #6346

Test plan

  • go test ./cmd/thv-operator/app/ ./cmd/thv-operator/controllers/
  • Official operator e2e from repo root (task operator-e2e-test after kind cluster + cloud-provider-kind):
    • multi-tenancy setup / test-scenarios / cleanup: all pass
    • single-tenancy setup / test-scenarios (11) / cleanup: all pass
  • With zero MCPRegistry CRs, operator logs the deprecation warning at most once (not on each cache resync)

kube-apiserver emits a 299 Warning header for the deprecated
MCPRegistry CRD on every cache LIST/WATCH, so controller-runtime
logged it on each informer resync even with zero CRs. Collapse
that header to a single log at first cache LIST.

Fixes stacklok#6346

Signed-off-by: 杨成锴 <homeboyc@foxmail.com>
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.

bug(operator): MCPRegistry deprecation warning logs on a timer even when no MCPRegistry CRs exist

1 participant