Spike on how CF-deployment (latest) to work with Eirini
Test and investigate the best way for CAPI to inteface with Eirini and to Diego in the long run.
Output from the story is a design on what would needed to be done in Capi (PR) and what needs to be done Eirini to work
Goal: Change CC to interface with Eirini instead of Diego (configurable)
Options we looked at:
- Point CC to Eirini implementing the BBS API
- Protobuf is being used to serialize models
- Would be a drop-in replacement without any CC code changes
- URL is already exposed via config
- Replace CC code with our version wherever CC talks to Diego today
- Staging an app is implemented as Diego task
- The convergence loop in CC tells Diego to stop or start apps.
AppStartjust writes the desired state into CCDBProcessesSyncandTasksSyncinstantiated fromVCAP::CloudController::Jobs::Diego::Synctake care of convergence- For tasks, the cancel request is sent from the
TasksSyncand missing tasks are handled there, too - There seems no way to update a running task, therefore we found no
DesireTaskHandler - Again,
CloudController::DependencyLocator.instance.bbs_task_clientis used inTaskDeletein order to get the singleton instance of the BBS client. All task actions likeTaskCreateetc. are similar, as well as the app (LRP) actions. DependencyLocatoris the place to make theBbsClientwrappers configurable. We can check config and supply anOpiClientinstead, there.- There is also a
DesireAppHandlerwhich used in the convergence loop. Since it uses the clients anyway, there is no need to change it.
- Replace
Diego::Clientwith our e.g.OPI::ClientDiego::Clientalready has a pretty domain-specific APIProcessesSyncandTasksSyncuse theDiego::Clientalready, so this could be an even simpler drop-inDiego::Clientis not used directly, but wrapped byVCAP::CloudController::Diego::BbsAppsClientandVCAP::CloudController::Diego::BbsTaskClient. There is alsoBbsStagerClientwhich is similar.
Preferred way: #3 as it seems to have the smallest set of changes and there really is no benefit of #1.
Stories
Just task execution in k8s
-
In
DependencyLocator#bbs_task_client, return a new OpiClient that just implementsdesire_task(task_guid: task_guid, task_definition: task_definition, domain: cancel_task(guid) task_by_guid(guid) tasks(domain: TASKS_DOMAIN) upsert_domain(domain: TASKS_DOMAIN, ttl: TASKS_DOMAIN_TTL) -
In Eirini, implement an HTTP endpoint that takes JSON (?) and implements the aforementioned API calls
AC: Task execution happens in k8s, while staging and LRPs still run in Diego
Staging also happens in k8s
- In
DependencyLocator#bbs_stager_client, return the newOpiClient
AC: Staging happens in k8s, while LRPs still run in Diego
LRPs in k8s
- In
DependencyLocator#bbs_apps_client, return the new (enhanced) OpiClient - Implement the remaining methods of the
OpiClient - In Eirini, implement the HTTP endpoints for the additional API calls
AC: Staging, tasks and apps (LRP) happen in k8s
Consequences / Open Questions
- Since CC already translates app starts into staging + desireLRP, our st8ger might not be needed anymore. Is this true, and is this something we want?
- Since the convergence loop stays in CC, the
sinkwould go away from Eirini as well - What is
upsert_domainbeing used for? - Is
pingrequired?