A template for accelerating creating a Discovery Handler for Akri in Rust.
A Discovery Handler is anything that implements Akri's the Discover service and Registration client defined in
Akri's discovery gRPC interface.
This can be done in any language using Akri's proto file. This template creates a DiscoveryHandler that implements the
Discover service and registers it with the Akri Agent.
This template is pulled via the cargo-generate developer tool.
- Install
cargo-generatecargo install cargo-generate - Pull down this template
cargo generate --git https://github.com/project-akri/akri-discovery-handler-template.git - In
main, specify the name of your Discovery Handler and whether or not the devices it discovers are shared. This name should matchcustom.configuration.discoveryHandlerNamewhen installing Akri, so the Agent correctly identifies the Discovery Handler. - Fill in the
discoverlogic of your Discovery Handler - Build the Discovery Handler and push it to your container registry (assumed GHCR below):
HOST="ghcr.io" USER=[[GITHUB-USER]] DH="discovery-handler" TAGS="v1" DH_IMAGE="${HOST}/${USER}/${DH}" DH_IMAGE_TAGGED="${DH_IMAGE}:${TAGS}" docker build \ --tag=${DH_IMAGE_TAGGED} \ --file=./Dockerfile.discovery-handler \ . && \ docker push ${DH_IMAGE_TAGGED}
- Deploy Akri with your custom Discovery Handler
helm repo add akri-helm-charts https://project-akri.github.io/akri/ helm install akri akri-helm-charts/akri-dev \ --set imagePullSecrets[0].name="crPullSecret" \ --set custom.discovery.enabled=true \ --set custom.discovery.image.repository=$DH_IMAGE \ --set custom.discovery.image.tag=$TAGS \ --set custom.discovery.name=akri-<name>-discovery \ --set custom.configuration.enabled=true \ --set custom.configuration.name=akri-<name> \ --set custom.configuration.discoveryHandlerName=<name> \ --set custom.configuration.discoveryDetails=<filtering info>