teseraio / ensemble

Modular Kubernetes operator to manage the lifecycle of databases
https://ensembleoss.io
Mozilla Public License 2.0
42 stars 1 forks source link

Use Evaluations to trigger Resource jobs and introduce the Reconcile interface #42

Closed ferranbt closed 3 years ago

ferranbt commented 3 years ago

Spec changes for Cluster and Resources are stored by clusterID in the state. The Operator picks a new spec to process sequentially by clusterID. If the spec is a Resource, a resource reconcile function is applied and the task is finished. If the spec is a Cluster, an Evaluation is triggered which starts the cluster reconcile functions. Then, multiple evaluations (i.e. node created, node running...) might happen until the cluster task is done.

It is strange to handle two reconcile functions in different ways, one with Evaluations and the other without. Besides, it makes it harder to introduce other primitives like Events. This issues proposes using Evaluations to handle Resource reconciles as well. Lets introduce a new interface:

type Reconcile interface {
   Process(eval *proto.Evaluation)
}

There will be two implementations, one for the Cluster and the other one for the Resource spec. It will also streamline the implementation of #40

This change requires: