Unistore : Ensure Watch works in HA mode. (#93428)
* Replace Watch with WatchNext * remove watchset * fix previous page and closing the channel * Remove the broadcaster cache to prevent dupplicated events * add watch bookmark * add watch bookmark * cleanup comments * disable the tests for bookmarks for now * Ensure we send previosu events * lint * re-introduce the cache * load from cache * disabling legacy test * disabling legacy test * Update pkg/storage/unified/resource/server.go Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com> * Could not read previous events * add proper migration * Add previous_resource_version to both history and resource * First event should have an RV of 2 and not 1 * Test both storage backends * fix the inital RV for the sql backend * ensure graceful stop of the stream decoder * gocyclo --------- Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
This commit is contained in:
@@ -1407,22 +1407,25 @@ func RunWatchSemantics(ctx context.Context, t *testing.T, store storage.Interfac
|
||||
podsAfterEstablishingWatch: []*example.Pod{makePod("4"), makePod("5")},
|
||||
expectedEventsAfterEstablishingWatch: addEventsFromCreatedPods,
|
||||
},
|
||||
|
||||
{
|
||||
name: "legacy, RV=0",
|
||||
resourceVersion: "0",
|
||||
initialPods: []*example.Pod{makePod("1"), makePod("2"), makePod("3")},
|
||||
expectedInitialEventsInRandomOrder: addEventsFromCreatedPods,
|
||||
podsAfterEstablishingWatch: []*example.Pod{makePod("4"), makePod("5")},
|
||||
expectedEventsAfterEstablishingWatch: addEventsFromCreatedPods,
|
||||
},
|
||||
{
|
||||
name: "legacy, RV=unset",
|
||||
initialPods: []*example.Pod{makePod("1"), makePod("2"), makePod("3")},
|
||||
expectedInitialEventsInRandomOrder: addEventsFromCreatedPods,
|
||||
podsAfterEstablishingWatch: []*example.Pod{makePod("4"), makePod("5")},
|
||||
expectedEventsAfterEstablishingWatch: addEventsFromCreatedPods,
|
||||
},
|
||||
// Not Supported by unistore because there is no way to differentiate between:
|
||||
// - SendInitialEvents=nil && resourceVersion=0
|
||||
// - sendInitialEvents=false && resourceVersion=0
|
||||
// This is a Legacy feature in k8s.io/apiserver/pkg/storage/etcd3/watcher_test.go#196
|
||||
// {
|
||||
// name: "legacy, RV=0",
|
||||
// resourceVersion: "0",
|
||||
// initialPods: []*example.Pod{makePod("1"), makePod("2"), makePod("3")},
|
||||
// expectedInitialEventsInRandomOrder: addEventsFromCreatedPods,
|
||||
// podsAfterEstablishingWatch: []*example.Pod{makePod("4"), makePod("5")},
|
||||
// expectedEventsAfterEstablishingWatch: addEventsFromCreatedPods,
|
||||
// },
|
||||
// {
|
||||
// name: "legacy, RV=unset",
|
||||
// initialPods: []*example.Pod{makePod("1"), makePod("2"), makePod("3")},
|
||||
// expectedInitialEventsInRandomOrder: addEventsFromCreatedPods,
|
||||
// podsAfterEstablishingWatch: []*example.Pod{makePod("4"), makePod("5")},
|
||||
// expectedEventsAfterEstablishingWatch: addEventsFromCreatedPods,
|
||||
// },
|
||||
}
|
||||
for idx, scenario := range scenarios {
|
||||
t.Run(scenario.name, func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user