glooshot
glooshot copied to clipboard
remove routing rules that became stale while glooshot was not watching
reproduction steps:
- start glooshot
- create an experiment
- wait for glooshot to produce routing rules from this experiment
- stop glooshot
- delete the experiment
- restart glooshot
- Expect Behavior glooshot to see that there are no experiments, and thereafter update the routing rules
- Actual Behavior glooshot does not remove the stale routing rules until the experiment emitter is triggered with the creation of a new experiment
potential fix:
- call sync by hand when getting a new Syncer:
func NewSyncer(ctx context.Context, expClient v1.ExperimentClient, rrClient sgv1.RoutingRuleClient, meshClient sgv1.MeshClient, opts options.Opts) (*glooshotSyncer, error) {
syncer := &glooshotSyncer{
expClient: expClient,
rrClient: rrClient,
rrReconciler: sgv1.NewRoutingRuleReconciler(rrClient),
meshClient: meshClient,
opts: opts,
}
// must run sync on initialization in order to remove any stale resources
// get a new context to ensure the root context is not cancelled, timeout is arbitrary
initCtx, _ := context.WithTimeout(ctx, 10*time.Second)
return syncer, syncer.Sync(initCtx, &v1.ApiSnapshot{})
}
- issues with this approach: must not pass an empty snapshot if there are existing resources
better fix
- update solokit such that the emitters take an "emit on initialization" boolean in their constructor that tells it whether or not it should force-emit on startup
@ilackarms mentioned that Gloo has a way of dealing with this for UDS