acoustic-carpenter-78188
05/07/2026, 9:09 PMGet round-trips against kube-apiserver. Two issues with that change as merged:
1. Cache builds even when image pull secrets are disabled. The k8s client is only consumed inside findAndAddImagePullSecret / addImagePullSecretToPod (both in embedded_secret_manager.go), which run only when EmbeddedSecretManagerConfig.ImagePullSecrets.Enabled is true. When the flag is off the informer is dead weight — it still runs a cluster-wide list/watch on Secrets that nothing in the webhook ever reads.
2. Implicit informer scope. controller-runtime caches are _type-lazy_: no informer is started until something accesses a given GVK, and WaitForCacheSync only waits on currently-started informers. The previous patch added the cache to the Scheme via corev1.AddToScheme (which registers Pods, ConfigMaps, Nodes, ... on top of Secrets) and relied on the embedded secret manager being the only caller to keep the watched set restricted to Secrets. WaitForCacheSync returned immediately on an empty informer set, so the first admission paid the Secret informer's cold-start latency.
What changes were proposed in this pull request?
In `flyteplugins/go/tasks/pluginmachinery/secret/secrets_injector.go`:
• Build the informer cache + cache-backed client only when ImagePullSecrets.Enabled. When the feature is disabled, fall back to a bare direct client.New(...) — same behavior as before #7353.
• Inside the enabled branch, explicitly register the Secret informer via secretInformerCache.GetInformer(ctx, &corev1.Secret{}) before WaitForCacheSync. This makes the cache scope explicit (Secrets only, not "whatever someone happens to read first"), and ensures WaitForCacheSync blocks on the initial Secret list so the first admission isn't a guaranteed cache miss.
How was this patch tested?
• go build ./flyteplugins/go/tasks/pluginmachinery/secret/... ./executor/... — clean.
• go vet ./flyteplugins/go/tasks/pluginmachinery/secret/... ./executor/... — clean.
• go test ./flyteplugins/go/tasks/pluginmachinery/secret/... -count=1 — all pass.
Labels
• changed
Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
Related PRs
• Predecessor: #7353
• Companion (Union v1 fork): unionai/flyte#969
flyteorg/flyte