Skip to content

serviceaccount: read local Secrets from the lister only - #4542

Merged
kcp-ci-bot merged 1 commit into
kcp-dev:mainfrom
mjudeikis-bot:serviceaccount-secret-lister-only
Nov 3, 2026
Merged

kcp-ci-bot merged 1 commit into
kcp-dev:mainfrom
mjudeikis-bot:serviceaccount-secret-lister-only

Conversation

@mjudeikis-bot

Copy link
Copy Markdown

Summary

Restores the local Secret getter in pkg/server/serviceaccount/cache.go to a plain lister read (secretsLister.Secrets(namespace).Get(name)). The live GET fallback added in #4528 on every lister miss is removed, so a missing Secret (e.g. a stale or bogus token reference) no longer costs a request to the shard per call.

Note on the issue's premise: shardlookup.Lookup.Get (pkg/shardlookup/lookup.go) sends local keys only to the local func and non-local keys only to the TTL-cached fetch func; fetch is not a fallback for local misses. After this change a local Secret absent from the informer returns NotFound. The Secret informer is filtered to type=kubernetes.io/service-account-token, and this getter is only used to resolve token Secrets, so that is the expected result. The one remaining edge is a token Secret created moments before the informer observes it, which fails until the informer catches up.

Requested in #4540 (comment)

What Type of PR Is This?

/kind cleanup

Related Issue(s)

Fixes #4540

Release Notes

NONE

Tested: go build ./pkg/server/..., go vet ./pkg/server/serviceaccount/. golangci-lint is not available in my environment. No unit test added: the package has no existing tests and the getter needs cluster-aware informers to construct.

The local lookup no longer falls back to a live GET on a lister miss, so a
missing Secret does not turn into a request to the shard on every call.

Signed-off-by: mjudeikis-bot <263128906+mjudeikis-bot@users.noreply.github.com>
@kcp-ci-bot kcp-ci-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Nov 3, 2026
@kcp-ci-bot kcp-ci-bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 3, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

Hi @mjudeikis-bot. Thanks for your PR.

I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ntnn ntnn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm
/approve
/ok-to-test

@kcp-ci-bot kcp-ci-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm Indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 3, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 3416a6d8bb162dec9531f87980df2b3cddc47e1c

@kcp-ci-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ntnn

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 3, 2026
@kcp-ci-bot
kcp-ci-bot merged commit bf1452c into kcp-dev:main Nov 3, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove live-client fallback from local Secret lookup in serviceaccount cache

3 participants