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

Refactoring Scheduler for Pluggable Backends #212

Merged
merged 13 commits into from
May 15, 2021

Conversation

Mierdin
Copy link
Member

@Mierdin Mierdin commented Apr 12, 2021

The existing Antidote API is fairly abstract - primitives like lessons, collections, livelessons, livesessions, etc. were conceived intentionally to obscure underlying infrastructure details, so that lesson authors didn't have to care about those things.

However, within the Antidote scheduler, translation of those abstract primitives to the backend infrastructure was done fairly statically; since Kubernetes was the only backend implementation that was planned, these primitives always translated to some kind of Kubernetes API call. So, while the lesson author never had to know anything about Kubernetes, everything still had to run on top of Kubernetes in order to function.

This PR begins the effort changing this requirement by formalizing the boundary between the core scheduler, and the backend implementations, and ensuring that all backend-specific details are well-contained within these implementations. This PR does not include an alternative backend implementation, such as for OpenStack, vSphere, or a cloud provider, but rather refactors the existing scheduler to make this possible. It also converts the existing Kubernetes implementation into this new modular architecture. Future efforts could implement alternative backends by following the example and documentation created here.

Summary of Changes

  • Refactors scheduler so the backend is pluggable. This involved formalizing backend functionality using an AntidoteBackend interface, but also documenting plenty of other conventions - see included scheduler/backends/README.md for more details.
  • Added a field to livelesson state to track last active time, and refactored garbage collection to use this instead of labels on infrastructure. Removed "BOOP" functionality, as this is no longer needed as a result.
  • The antidote-core configuration now includes a section for backend-specific configuration options

Mierdin added 3 commits April 12, 2021 15:59
Signed-off-by: Matt Oswalt <matt@oswalt.dev>
…es at least

Signed-off-by: Matt Oswalt <matt@oswalt.dev>
Signed-off-by: Matt Oswalt <matt@oswalt.dev>
@Mierdin Mierdin changed the title VERY WIP - beginning refactor of scheduler for pluggability Refactoring Scheduler for Pluggable Backends May 7, 2021
Mierdin added 5 commits May 7, 2021 17:33
…t scheduler

Signed-off-by: Matt Oswalt <matt@oswalt.dev>
Signed-off-by: Matt Oswalt <matt@oswalt.dev>
Signed-off-by: Matt Oswalt <matt@oswalt.dev>
Signed-off-by: Matt Oswalt <matt@oswalt.dev>
@codecov
Copy link

codecov bot commented May 12, 2021

Codecov Report

Merging #212 (87f1dc7) into master (f03049e) will increase coverage by 0.53%.
The diff coverage is 19.80%.

❗ Current head 87f1dc7 differs from pull request most recent head d13e8b5. Consider uploading reports for the commit d13e8b5 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #212      +/-   ##
==========================================
+ Coverage   28.00%   28.54%   +0.53%     
==========================================
  Files          24       24              
  Lines        2246     2032     -214     
==========================================
- Hits          629      580      -49     
+ Misses       1553     1402     -151     
+ Partials       64       50      -14     
Impacted Files Coverage Δ
api/exp/livelessons.go 0.00% <0.00%> (ø)
db/db.go 0.00% <ø> (ø)
scheduler/backends/kubernetes/ingresses.go 0.00% <0.00%> (ø)
scheduler/backends/kubernetes/namespaces.go 0.00% <0.00%> (ø)
scheduler/backends/kubernetes/services.go 0.00% <0.00%> (ø)
services/utils.go 0.00% <0.00%> (ø)
scheduler/backends/kubernetes/kubernetes.go 16.34% <16.34%> (ø)
scheduler/backends/kubernetes/jobs.go 24.09% <25.00%> (ø)
db/driver_inmem.go 62.06% <42.85%> (-2.06%) ⬇️
scheduler/backends/kubernetes/pods.go 46.55% <46.66%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f03049e...d13e8b5. Read the comment docs.

Mierdin added 2 commits May 12, 2021 14:50
Signed-off-by: Matt Oswalt <matt@oswalt.dev>
Signed-off-by: Matt Oswalt <matt@oswalt.dev>
@Mierdin Mierdin force-pushed the issue-211/pluggable-backend branch from e9daa68 to 533dc6b Compare May 12, 2021 19:13
Mierdin added 2 commits May 12, 2021 15:52
Signed-off-by: Matt Oswalt <matt@oswalt.dev>
Signed-off-by: Matt Oswalt <matt@oswalt.dev>
@Mierdin Mierdin marked this pull request as ready for review May 12, 2021 21:38
…the API

Signed-off-by: Matt Oswalt <matt@oswalt.dev>
@Mierdin Mierdin force-pushed the issue-211/pluggable-backend branch from ff44e76 to d13e8b5 Compare May 15, 2021 02:52
@Mierdin Mierdin merged commit ad4b25a into master May 15, 2021
@Mierdin Mierdin deleted the issue-211/pluggable-backend branch May 15, 2021 02:57
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant