api: an Application watch resumed from a WorkloadMonitor version can skip HelmRelease changes of other applications

Offen
#5,324 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
go, kubernetes
Bereich
api, backend

Rechercherichtung

Start with REST.Watch in pkg/registry/apps/application/rest.go, where the HelmRelease and WorkloadMonitor watches are merged and the client's resourceVersion is replayed and filtered. Read how the merged stream orders events and how the HelmRelease watch is reopened on resume. Done means a reconnect after a WorkloadMonitor event cannot skip a HelmRelease change, which needs a design decision between ordering across streams and opening the backing watches from the client's resourceVersion.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

triage/needs-triage

Where

pkg/registry/apps/application/rest.go, REST.Watch.

Problem

An Application watch merges two backing watches: HelmReleases and WorkloadMonitors. Events from the two streams reach the client in whatever order they arrive, and a WorkloadMonitor-triggered event carries a resourceVersion at least as new as the monitor's. A client-go reflector records the resourceVersion of every event it receives as its resume point, whatever object the event is for, and passes it back when it reconnects.

The backing HelmRelease watch is opened without the client's resourceVersion, and resume is emulated by replaying every release as ADDED and skipping those whose resourceVersion is not above the client's.

Sequence:

  1. Application A's HelmRelease is written at revision 100; the event has not been delivered on the HelmRelease stream yet.
  2. Application B's WorkloadMonitor is written at revision 101, and its event is delivered first.
  3. The client records 101 and the connection drops.
  4. On reconnect the replay of A at 100 is skipped as already seen, and the client keeps A's previous spec until A changes again or the client relists.

Impact

Rare: it needs a disconnect inside the window between the two deliveries. When it happens, the stale object stays in the client's cache with no error.

Possible directions

  • Deliver events in revision order across both streams, holding a monitor event until the HelmRelease stream has progressed past its revision (for example via a progress bookmark from the backing watch).
  • Open the backing watches from the client's resourceVersion instead of replaying and filtering, so the server, not the merge, decides what the client has seen. This alone does not fix the ordering across the two streams.
Vorherrschende Sprache
Go
Sterne
2.2k
Forks
209
Ø Merge
4 T. 14 Std.
Gemergte PRs (30 T.)
140

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus cozystack/cozystack

Alle Issues in cozystack/cozystack

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.