Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Start endpoint pods in the order provided in the lesson definition #198

Merged
merged 2 commits into from Jul 15, 2020

Conversation

Mierdin
Copy link
Member

@Mierdin Mierdin commented Jul 15, 2020

In #194 we added the ability for lesson authors to specify a subnet for each Connection object, which is passed to the IPAM CNI plugin, and all containers are automatically assigned addresses from that subnet in order of attachment. This isn't quite the same as just being able to pick which IP addresses get assigned to which endpoints, but my assumption was that because endpoints are provided as a YAML list, which is ordered, the endpoints would be spun up in a consistent order, and given the same addresses each time.

I thought I had tested this at the time to validate this assumption, but apparently I didn't, because I was wrong. Turns out that the livelesson API converts these endpoints to an unordered map to make it easier to look up endpoints by name, and this is pretty heavily embedded not only in the API (which impacts antidote-web) but also the internal data models. Since this is unordered by definition, this ensures that the attachment order, and in turn, any addressing assignments, are never consistent. This is obviously not what we want, as lesson guides and configurations will rely on this consistency.

As mentioned in a long comment, I believe this is the only place where endpoint order really matters, so rather than try to change the data type for this field, I added a little logic in this PR to iterate over the map in the original endpoint order from the lesson definition, which means endpoints will always be attached to these networks in a predictable order.

While this PR fixes this immediate issue, if I am proven wrong again, and we do end up requiring order preservation for other use cases, this workaround should be removed and we should just do the work of converting this field to a slice. This will require coordination between antidote-core and antidote-web.

Signed-off-by: Matt Oswalt <matt@oswalt.dev>
@Mierdin Mierdin added this to In progress in Antidote v0.7.0 via automation Jul 15, 2020
Signed-off-by: Matt Oswalt <matt@oswalt.dev>
@Mierdin Mierdin changed the title Start endpoint pods in the order provided in the lesson defintion Start endpoint pods in the order provided in the lesson definition Jul 15, 2020
@Mierdin Mierdin merged commit 10aeafe into master Jul 15, 2020
Antidote v0.7.0 automation moved this from In progress to Done Jul 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

1 participant