Skip to content

Commit 9df0399

Browse files
committed
OTA-1418: Decribe informer->usc communication
Going from USC-scrapes-all-insights periodically to unidirectional message passing makes insight lifecycle a bit harder (if an informer is not saying anyting about an insight Status API knows about, is it just unchanged, or did the informer lose track of it?). List of known insight UIDs is lightweight-enough payload to be included in every message sent to USC and the USC can (eventually) drop the insights that the informer stops reporting as known, and can drop the insights the informer requests to be dropped. Unsure whether this mechanism survives until the final version but it is reasonably robust for the current state.
1 parent cfd8f88 commit 9df0399

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

pkg/updatestatus/updatestatuscontroller.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,53 @@ const (
3131
unknownInsightGracePeriod = 60 * time.Second
3232
)
3333

34+
// High-level description of the informers -> USC communication protocol:
35+
// ----------------------------------------------------------------------
36+
// Informers send insights to the USC via messages. Communication is performed via a channel (but that is just the
37+
// current implementation detail) and the data sent by informers is encapsulated in the informerMsg structure. The
38+
// communication is unidirectional, from informers to the USC. The USC does not send any messages back to the informers.
39+
//
40+
// The informers send individual insights they want to propagate to the Status API, insights are identified by a UID.
41+
// Insights with the same UID are considered the same insight in the context of the informer that sent it. The received
42+
// insights are stored in the Status API by the USC if they are new, and updated with the new data if they are already
43+
// present.
44+
//
45+
// Informers keep track of active insights, and include a list of all known insights (just the UIDs) in each message.
46+
// On each message, USC compares the insights by the informer it has in the Status API with the list of known insights
47+
// in the message, and when an insight is first not reported as known by the informer, it is marked for expiration. If
48+
// the informer reports the insight as known again before it expires, the expiration is cancelled. If the insight is not
49+
// reported as known again within a grace period, it is dropped from the Status API. This allows informers to restart
50+
// and "learn" about conditions in the cluster without dropping insights that it have not yet learned about while
51+
// still eventually dropping insights that are no longer detected.
52+
//
53+
// Informers can also report insights they want to explicitly drop. This works similarly to the expiration mechanism,
54+
// but there is no grace period.
55+
//
56+
// TL;DR:
57+
// --------
58+
// Whenever an informer has an insight to report, it sends a message containing:
59+
// - The informer's name
60+
// - The insight itself, identified by a UID
61+
// - The list of all insights it knows about (just the UIDs)
62+
// - The list of all insights it wants to explicitly drop (just the UIDs)
63+
//
64+
// For each message received, the USC:
65+
// - Updates the Status API with the insight
66+
// - Marks insights by the informer already in Status API for expiration if informer does not know them
67+
// - Drops insights marked for expiration it grace period is over and informer does not still know them
68+
// - Unmarks the expiration for each insight the informer knows
69+
// - Drops insights explicitly requested by the informer
70+
//
71+
// Implementation status:
72+
// ---------------------
73+
// - [x] USC-side known insight tracking
74+
// - [x] USC-side insight expiration
75+
// - [ ] Informer-side known insight tracking
76+
// - [ ] Informer-side populating known insights in messages
77+
// - [ ] USC-side insight explicit dropping
78+
// - [ ] Informer-side explicit insight drop tracking
79+
// - [ ] Informer-side populating explicit drop insights in messages
80+
3481
// informerMsg is the communication structure between informers and the update status controller. It contains the UID of
3582
// the insight and the insight itself, serialized as YAML. Passing serialized avoids shared data access problems. Until
3683
// we have the Status API we need to serialize ourselves anyway.

0 commit comments

Comments
 (0)