Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#17165 from SimonRichardson/service-factory-wi…
…th-provider juju#17165 The following exposes the provider tracker to the service factory. The service factory now takes a IAAS and CAAS provider tracker. Initially it was hoped that you could use the generic provider tracker directly, but for controllers with both IAAS and CAAS mode types this isn't possible. We do need to expose both at the service factory level. The service that requires a provider can then create a local interface that implements some functionality of an environ. For instance the network domain service could expose that it would like a provider that supports networking: type Provider interface { environs.Networking } The service then takes a `providertracker.ProviderGetter[Provider]`, which will hand out providers. If the service requires to work on both IAAS and CAAS, then two provider getters will needed as dependencies. To provide the provider getter to the service, the service factory needs to supply the right provider. providertracker.ProviderRunner[networkservice.Provider](s.providerFactory, s.modelUUID.String()) Using a provider runner we can late bind the provider for the model UUID, so the error surfaces on use of the service method. This is akin to the DB pattern we currently have. This ProviderRunner replaces the SupportsNetworking and other environs casting functions. Ideally the casting functions in the environs package can be removed. The only concern with this change, is that the core/providertracker package is bringing in the environs package. It's clear that it _should_ live there, it just breaks one of the rules of the core package. <!-- Why this change is needed and what it does. --> ## Checklist - [x] Code style: imports ordered, good names, simple structure, etc - [x] Comments saying why design decisions were made - [x] Go unit tests, with comments saying what you're testing ## QA steps ```sh $ juju bootstrap lxd test $ juju add-model test $ juju deploy ubuntu ``` ## Links **Jira card:** JUJU-5644
- Loading branch information