Read-your-writes consistency is not applied to unstructured objects written with Update or Patch
I maintainer di solito rispondono entro 1 giorno
@7616e5a9c573ffb221843a498885ab0f ci sta già lavorando.
Dal 27/11/2026.
- #3703 di @7616e5a9c573ffb221843a498885ab0f — aperta
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- go
- Ambito
- backend-api-design
Direzione di ricerca
Read pkg/client/consistency.go, especially writeTargetFor and representationIDForObj, then inspect TestConsistentFakeClient for the proposed unstructured cases. The issue reports an open linked pull request (#3703), so the work is already under way; completion is demonstrated by those tests failing on the current behavior and passing with the fix.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
With Cache.Unstructured: true and EnableReadYourWritesConsistency: true, a Get or List of an *unstructured.Unstructured does not wait for an earlier Create, Update, Patch, Status().Update or Status().Patch of the same object made through the same client. The read returns whatever the cache has, so it can be older than the client's own write.
Cause
The consistent client keys its write barriers and consistency handlers by GVK plus representation (typed, unstructured, or PartialObjectMetadata).
Reads pick the representation from the object's Go type:
Writes go through writeTargetFor. Its case Object: branch, which handles everything that isn't an apply configuration or PartialObjectMetadata, always uses representationIDTyped:
So an unstructured Update records its resource version under the typed key, and the following unstructured Get looks under the unstructured key, finds no barrier and no minimum resource version, and returns straight away. Only writes made with client.ApplyConfigurationFromUnstructured are recorded as unstructured.
Why the tests don't catch it
The envtest suite has an "unstructured" context, but its client doesn't set Cache.Unstructured: true:
Unstructured reads therefore bypass the cache and hit the API server, so they pass either way. TestConsistentFakeClient only uses typed objects.
How we hit it
We enabled the option in Crossplane, which reads and writes composite resources as unstructured objects with Update and Patch, to stop a reconciler acting on a cached object that was missing its own previous status write. The stale reads kept happening. The controller_runtime_client_consistency_wait_duration_seconds histogram for get showed no waits in the 10ms to 100ms range at all.
With the change below the stale reads stopped.
Fix
case Object:
gvk, err := apiutil.GVKForObject(t, scheme)
if err != nil {
return gvkAndRepresentation{}, types.NamespacedName{}, nil, nil, fmt.Errorf("failed to get GVK for object %T: %w", obj, err)
}
- return gvkAndRepresentation{gvk: gvk, representation: representationIDTyped},
+ return gvkAndRepresentation{gvk: gvk, representation: representationIDForObj(t)},
I have this with unstructured cases added to TestConsistentFakeClient; they fail on main and pass with the change. I can open a PR.
Versions
Seen on v0.25.2. The code is the same in v0.25.3 and on main at 1e19b8e0.
- Lingua principale
- Go
- Stelle
- 3k
- Fork
- 1.3k
- Merge medio
- 1g 7h
- PR unite (30g)
- 48
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di kubernetes-sigs/controller-runtime
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kubernetes-sigs/controller-runtime#3704 ·
I maintainer di solito rispondono entro 1 giorno
-
lifecycle/rotten
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
kubernetes-sigs/controller-runtime#3537 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Client and DynamicRESTMapper keep a kind's old scope after its CRD is recreated with a different `scope`Forse già presa @AdamMagued l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
kubernetes-sigs/controller-runtime#3671 ·
I maintainer di solito rispondono entro 1 giorno
-
ReadYourWrite doesn't correctly deal with mutating requests removing the last finalizerForse già presa @AdamMagued l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 28/100
kubernetes-sigs/controller-runtime#3670 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
With UsePriorityQueue=false, a stopped controller starts queued reconciles after cancellationForse già presa @hcrosse l’ha presa 14 giorni fa. Apertakind/bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
kubernetes-sigs/controller-runtime#3664 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di kubernetes-sigs/controller-runtime
Issue simili
-
Task retarget keeps the old host in task scope and adds the new host in a form that matches nothingForse già presa @chaitanya0305 l’ha presa oggi. Apertabug P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
BaaRai/ARTEX#652 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
compiler-explorer/compiler-explorer#9710 ·
I maintainer di solito rispondono entro 1 giorno
-
Add govulncheck workflowApertaenhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
losisin/helm-values-schema-json#437 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 2 giorni