This PR refactors the admin service to support generic provisioners. This paves the way for not only provisioning managed runtimes, but also managed ClickHouse clusters and more.
Main changes:
Introduces a generic Provisioner interface in admin/provisioner/provisioner.go
The provisioner interface centers around creating/updating/checking/removing "resources":
Resources are managed per deployment
Resources have state which the provisioner can update
Resources are tracked in a new database table provisioner_resources
Refactors the validate_deployments and check_provisioner_capacity jobs to use health check functions on the provisioner interface
Potential future work:
We now create a deployment with status=pending before provisioning a runtime for it. We should move completion of the deployment to a retryable background job.
Support updating the slots assigned to an existing deployment when the provisioner allows it.
The provisioner interface's Provision and CheckResource functions are very similar, particularly because Provision is also used for updates. We should consider merging these three functions into one Reconcile function.
Support the provisioner changing its config after the initial provisioning (by having some kind of reconcile for instance config).
This PR refactors the admin service to support generic provisioners. This paves the way for not only provisioning managed runtimes, but also managed ClickHouse clusters and more.
Main changes:
Provisioner
interface inadmin/provisioner/provisioner.go
provisioner_resources
validate_deployments
andcheck_provisioner_capacity
jobs to use health check functions on the provisioner interfacePotential future work:
status=pending
before provisioning a runtime for it. We should move completion of the deployment to a retryable background job.Provision
andCheckResource
functions are very similar, particularly becauseProvision
is also used for updates. We should consider merging these three functions into oneReconcile
function.config
after the initial provisioning (by having some kind of reconcile for instance config).