Meta Service as Service Registry
To build a multi-service framework, we first need a special service, that provides service registry offers. Using it, we must be able to discover:
- List of existing Regions
- List of existing Services
- List of existing Resources per Service
- List of existing regional Deployments per Service.
This is provided by the meta.goten.com
Service, in the Goten repository,
directory meta-service
. It follows the typical structure of any service,
but has no cmd
directory or fixtures, as Goten provides only basic parts.
The final implementation is in the edgelq repository, see directory meta
.
SPEKTRA Edge version of meta contains an old version of the service, v1alpha2,
which is obsolete and irrelevant to this document. For this purpose, ignore
v1alpha2 elements.
Still, the resource model for Meta service resides in the Goten repository, see normal protobuf files. For Goten, we made the following design decisions, this reflects fields we have in protobuf files (you can and should see).
- List of regions in meta service must show a list of all possible regions where services can be deployed, not necessarily where are deployed.
- Each Service must be fairly independent. It must be able to specify its global network endpoint where it is reachable. It must display a list of API versions it has. For each API version, it must tell which services it imports, and which versions of them. It must tell what services it would like to use as a client too (but not import).
- Every Deployment describes an instance of a service in a region. It must be able to specify its regional network endpoint and tell which service version it operates on (current maximum version). It is assumed it can support lower versions too. Deployments for a single service do not need to upgrade at once to the new version, but it’s recommended to not wait too long.
- Deployments can be added to a Service dynamically, meaning, service owners can expand by just adding new Deployment in Meta service.
- Each Service manages its multi-region setup. Meaning: Each Service decides which region is “primary” for them. Then list of Deployment resources describes what regions are available.
- Each region manages its network endpoints, but it is recommended to have the same domain for global and regional endpoints, and each regional endpoint has a region ID as part of a subdomain, before the main part.
- For Service A to import Service B, we require that Service B is available in all regions where Service A is deployed. This should be the only limitation Services must follow for multi-region setup.
All those design decisions are reflected in protobuf files, and server
implementation (custom middlewares), see in goten repository,
meta-service/server/v1/
custom middlewares, they are fairly simple.
For SPEKTRA Edge, design decisions are that:
- All core SPEKTRA Edge services (iam, meta adaptation, audit, monitoring, etc.) are always deployed to all regions and are deployed together.
- It means, that 3rd party services can always import any SPEKTRA Edge core service because it is guaranteed to be in all regions needed by 3rd party.
- All core SPEKTRA Edge services will point to the same primary region.
- All core SPEKTRA Edge services will have the same network domain: iam.apis.edgelq.com, monitoring.apis.edgelq.com, etc. If you replace the first word with another, it will be valid.
- If core SPEKTRA Edge services are upgraded in some regions, then they will be upgraded at once.
- All core SPEKTRA Edge services will be public: Anyone authenticated will be able to read its roles, permissions, and plans, or be able to import them.
- All 3rd party services will be assumed to be users of core SPEKTRA Edge services (no cost if no actual use).
- Service resources can be created by a ServiceAccount only. It is assumed that it will be managing this Service.
- Service will belong to a Project, where ServiceAccount who created it belongs.
Users may think of core edgelq services as a service bundle. Most of
these SPEKTRA Edge rules are declarations, but I believe deployment workflows
are enforcing this anyway. The decision, that all 3rd parties are
considered users of all core SPEKTRA Edge services, and that each Service must
belong to some project, is reflected in additional custom middleware we
have for meta service in the edgelq repository, see file
meta/server/v1/service/service_service.go
. In this extra middleware,
executed before custom middleware in the goten repository
(meta-service/server/v1/service/service_service.go
), we are
adding core SPEKTRA Edge to the used services array. We also assign
a project-owning Service. This is where the management of ServiceAccounts
is, or where usage metrics will go.
This concludes Meta service workings, where we can find information about services and relationships between them.