FAQ: document read-your-writes behavior in the stale cache entry

Aperta Adatta ai principianti
#3,704 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, kubernetes
Ambito
documentation

Direzione di ricerca

L'obiettivo è la voce « My cache might be stale if I read from a cache! » in FAQ.md. Leggi la documentazione su cache e client per client.New e cluster.Options.Client, e verifica Cluster.GetAPIReader(), client.Options.Cache.EnableReadYourWritesConsistency e l'opzione per richiesta DisableReadYourWritesConsistency rispetto a designs/read_your_own_write_client.md. Il lavoro è completato quando la voce include un breve esempio di scrittura seguita da lettura, un rimando a GetAPIReader() e una nota sulle opzioni di consistenza, dichiarando lo stato sperimentale.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The "My cache might be stale if I read from a cache!" entry in FAQ.md covers optimistic locking and deterministic names. It doesn't say anything about a write in one Reconcile triggering the next one before the cache has caught up.

I hit this in an operator on controller-runtime v0.19.0. A scale-down cooldown timestamp lives in status. The Reconcile wrote spec.replicas first, which enqueued another Reconcile right away; that one read status from the cache, still without LastScalingAt, and treated the cooldown as unset. Replicas went 3 -> 2 -> 1 inside one sampling window. Writing status before spec fixed it, because watch events arrive in resourceVersion order.

Raw samples are in data-run4-double-step-race.csv. The fix and the comment above it are in app_controller.go.

client.New and cluster.Options.Client document that the default client reads through the cache and writes directly to the API server. Cluster.GetAPIReader() gives you an uncached reader. There is also client.Options.Cache.EnableReadYourWritesConsistency (off by default, marked experimental, see designs/read_your_own_write_client.md) and the per-request DisableReadYourWritesConsistency option. The stale cache entry says information "will eventually be correct, but may be slightly out of date"; the testing entry says changes "may have some delay between write time and reconcile time". Neither mentions the ordering issue or any of those options.

I'd suggest extending the stale cache entry with a short example of writing in one Reconcile and reading in the next, a pointer to GetAPIReader(), and a mention of the consistency options. Happy to send a PR for FAQ.md if that sounds reasonable.

Related: #3320 is the feature issue. I'm only asking about documenting what's already released.

Observed on controller-runtime v0.19.0 (k8s.io v0.31.1). The consistency options landed in v0.25.

Lingua principale
Go
Stelle
3k
Fork
1.3k
Merge medio
1g 7h
PR unite (30g)
48

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di kubernetes-sigs/controller-runtime

Tutte le issue di kubernetes-sigs/controller-runtime

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.