Read-your-writes consistency is not applied to unstructured objects written with Update or Patch
Los mantenedores suelen responder en 1 día
@7616e5a9c573ffb221843a498885ab0f ya está trabajando en esto.
Desde el 27/11/2026.
- #3703 de @7616e5a9c573ffb221843a498885ab0f — abierto
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- go
- Área
- backend-api-design
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Go
- Estrellas
- 3k
- Forks
- 1.3k
- Merge medio
- 1 d 7 h
- PR fusionados (30 d)
- 48
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de kubernetes-sigs/controller-runtime
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
kubernetes-sigs/controller-runtime#3704 ·
Los mantenedores suelen responder en 1 día
-
lifecycle/rotten
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
kubernetes-sigs/controller-runtime#3537 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Client and DynamicRESTMapper keep a kind's old scope after its CRD is recreated with a different `scope`Posiblemente ocupada @AdamMagued la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
kubernetes-sigs/controller-runtime#3671 ·
Los mantenedores suelen responder en 1 día
-
ReadYourWrite doesn't correctly deal with mutating requests removing the last finalizerPosiblemente ocupada @AdamMagued la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 28/100
kubernetes-sigs/controller-runtime#3670 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
With UsePriorityQueue=false, a stopped controller starts queued reconciles after cancellationPosiblemente ocupada @hcrosse la tomó hace 14 días. Abiertokind/bug
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
kubernetes-sigs/controller-runtime#3664 ·
Los mantenedores suelen responder en 1 día
Todos los issues de kubernetes-sigs/controller-runtime
Issues similares
-
Task retarget keeps the old host in task scope and adds the new host in a form that matches nothingPosiblemente ocupada @chaitanya0305 la tomó hoy. Abiertobug P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
BaaRai/ARTEX#652 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
compiler-explorer/compiler-explorer#9710 ·
Los mantenedores suelen responder en 1 día
-
Add govulncheck workflowAbiertoenhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
losisin/helm-values-schema-json#437 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 2 días