Microservice Registry and Catalog Management
During the Quickstart and the Acme Smart Plant tutorial, we specified images to be used for each microservice, for each Edgelet node architecture.
That was nice and easy, but what if we need to deploy the same code on a lot of Edgelet nodes? We would need to specify the images for each Microservice. Wouldn't it be nice to have a way to specify the images to be used for each architecture once and then reuse this configuration? That's where the Controller Microservice catalog comes into play!
Each Controller ships with a built-in microservice catalog. List preconfigured images with potctl:
potctl get catalog
NAMESPACE
default
ID NAME DESCRIPTION REGISTRY AMD64 ARM64
2 RESTBlue REST API for Bluetooth Low Energy layer. remote ghcr.io/datasance/restblue:latest ghcr.io/datasance/restblue:latest
5 NATs NATs server microservice for Datasance PoT remote ghcr.io/datasance/nats:latest ghcr.io/datasance/nats:latest
4 Debug The built-in debugger for Datasance PoT. remote ghcr.io/datasance/node-debugger:latest ghcr.io/datasance/node-debugger:latest
1 Router The built-in router for Datasance PoT. remote ghcr.io/datasance/router:3.8.0 ghcr.io/datasance/router:3.8.0
3 HAL REST API for Hardware Abstraction layer. remote ghcr.io/datasance/hal:latest ghcr.io/datasance/hal:latest
Instead of specifying images per architecture in every Microservice, refer to a catalog ID. A catalog item can list amd64, arm64, riscv64, and arm (32-bit) images. To deploy a Microservice from the built-in debugger catalog entry:
---
apiVersion: datasance.com/v3
kind: Application
metadata:
name: debugger
spec: {}
---
apiVersion: datasance.com/v3
kind: Microservice
metadata:
name: debugger
spec:
agent:
name: my-agent-name
config: {}
images:
catalogId: 4
container:
env: []
ports: []
hostNetworkMode: true
isPrivileged: true
volumes: []
commands: []
config: {}
application: debugger
potctl deploy microservice -f debugger.yaml
Note that this YAML snippet assumes we have a running ECN in the current Namespace with an Edgelet node called my-agent-name.
We can check that the expected images have been used by describing our Microservice:
potctl describe microservice debugger/debugger
Create our own Catalog Items
We can also use potctl to create our own Catalog Items. The YAML spec reference can be found here.
---
apiVersion: datasance.com/v3
kind: CatalogItem
metadata:
name: my-multiplatform-microservice
spec:
description: Alpine Linux
amd64: amd64/alpine:latest
arm: arm32v6/alpine:latest
registry: remote
potctl deploy -f my-catalog-item.yaml
Verify the new catalog item:
potctl get catalog | grep my-multiplatform-microservice
17 my-multiplatform-microservice Alpine Linux remote amd64/alpine:latest arm32v6/alpine:latest
You can now set images.catalogId to 17 on a Microservice to deploy using those images.
Registries
During the Acme Smart Plant tutorial, we saw that the images are being pulled from a repository specified in the YAML. The two values we have used so far are remote (public docker hub) and local (image locally present on the Edgelet node). There is a third value available, which is a repository ID.
NB: remote and local are aliases for values 1 and 2, which are the repository seeded in your Controller database.
We can list our current registries using potctl get registries
ID URL USERNAME PRIVATE SECURE
1 registry.hub.docker.com false true
2 from_cache false true
We can add a new registry using the Registry deploy kind
---
apiVersion: datasance.com/v3
kind: Registry
spec:
url: registry.hub.docker.com
username: john
password: q1u45ic9kst563art
potctl deploy -f my-private-registry.yaml
After running this, you should now have 3 registries and you can use the ID in the microservice images registry field