Registrationclient defined in the Akri's discovery gRPC proto file. These DHs run as their own Pods and are expected to register with the Agent, which hosts the
Registrationservice defined in the gRPC interface.
/var/lib/akri/agent-registration.sock. The directory can be changed when installing Akri by setting
agent.host.discoveryHandlers. For example, to request that the Agent's
Registrationservice live at
agent.host.discoveryHandlers=~/akri/socketswhen installing Akri. The Agent hosts the
Registrationservice defined in Akri's discovery interface on this socket.
RegisterDiscoveryHandlerRequest. While Discovery Handlers must register with the Agent's
Registrationservice over UDS, a
DiscoveryHandlerservice can run over UDS or an IP based endpoint. However, the current convention is to use UDS for both registration and discovery.
discoveryDetails. Akri's Configuration CRD takes in
DiscoveryHandlerInfo, which is defined structurally in Rust as follows:
discovery_detailsstring. The Agent passes this string to Discovery Handlers as part of a
DiscoverRequest. A Discovery Handler must then parse this string -- Akri's built in Discovery Handlers store an expected structure in it as serialized YAML -- to determine what to discover, filter out of discovery, and so on.
RegisterDiscoveryHandlerRequest.namethe Discovery Handler uses when registering with the Agent. Once you know what will be passed to your Discovery Handler, its time to implement the discovery functionality.
Devicetype, as shown in a subset of the discovery proto file below. A Discovery Handler sets a unique
idfor the device, device connection information that needs to be set as environment variables in Pods that request the device in
properties, and any mounts or devices that should be available to requesting Pods.
discovercreates a streamed connection with the Agent, where the Agent gets the receiving end of the channel and the Discovery Handler sends device updates via the sending end of the channel. If the Agent drops its end, the Discovery Handler should stop discovery and attempt to re-register with the Agent. The Agent may drop its end due to an error or a deleted Configuration.
akri-discovery-handlerproject, navigate to
main.rs. It contains all the logic to register our
DiscoveryHandlerwith the Akri Agent. We only need to specify the
DiscoveryHandlername and whether the devices discovered by our
DiscoveryHandlercan be shared. This is the name the Discovery Handler uses when registering with the Agent. It is later specified in a Configuration to tell the Agent which Discovery Handler to use. For example, in Akri's udev Discovery Handler,
nameis set to
falseas all devices are locally attached to nodes. The Discovery Handler name also resolves to the name of the socket the template serves the Discovery Handler on.
DiscoveryHandlerImplStruct has been created (in
discovery_handler.rs) that minimally implements the
DiscoveryHandlerservice. Fill in the
discoverfunction, which returns the list of discovered
custom.discovery.enabled=true. Specify the container for that DaemonSet as the Discovery Handler that you built above by setting
custom.discovery.image.repository=$TAGS. To automatically deploy a custom Configuration, set
custom.configuration.enabled=true. Customize the Configuration's
discovery_detailsstring to contain any filtering information:
custom.configuration.discoveryHandlerName) and a name for the Discovery Handler and Configuration (
custom.configuration.name). All these settings come together as the following Akri installation command:
brokerProperties. They will be set as environment variables in Pods that request the Instance's/device's resource.
brokerProperties) were set as environment variables.
/akri/docs/<name>-configuration.mdon how to create a Configuration that uses your Discovery Handler.