feat(cache): add an optional ttl to the filesystem kubeconfig cache - #297
Open
ZeikoFr wants to merge 1 commit into
Open
feat(cache): add an optional ttl to the filesystem kubeconfig cache#297ZeikoFr wants to merge 1 commit into
ZeikoFr wants to merge 1 commit into
Conversation
The filesystem cache served a cached kubeconfig until "kswitch clean" removed it. Kubeconfigs of the cloud providers embed credentials that expire, so a long lived cache eventually hands out a kubeconfig that no longer authenticates and the user has to work out that the cache is at fault. The new optional ttl refetches a cached kubeconfig from the store once the cached file is older than the given duration. Leaving ttl unset keeps the previous behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ZeikoFr
force-pushed
the
feat/filesystem-cache-ttl
branch
from
August 30, 2026 13:25
45d9243 to
ba51e3d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Independent of #295 and #296, can be merged in any order.
The filesystem cache serves a cached kubeconfig until
kswitch cleanremoves it.Kubeconfigs from the cloud providers embed credentials that expire, so a
long-lived cache eventually hands out a kubeconfig that no longer authenticates,
and the failure gives no hint that the cache is at fault.
Once the cached file is older than
ttl, the kubeconfig is fetched from thestore again. Leaving
ttlunset keeps the current behaviour exactly.Verification
gofmt,go build,go vet,golangci-lint run(0 issues) andgo test -race -count=1 ./...are clean. Tests cover both the expiry and theunset-ttl path.
🤖 Generated with Claude Code