Skip to content

Commit

Permalink
Update doc to take into account the new Configuration update behavior (
Browse files Browse the repository at this point in the history
…#115)

Update of Configuration result in a different behavior since the agent's
refactor in order to prevent deletion of existing Instances on
Configuration update.

Agent's now only looks for updates to the capacity and broker
properties.
All other modifications currently requires user to delete then re-apply
the Configuration.

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
  • Loading branch information
diconico07 authored Nov 8, 2024
1 parent a2a6710 commit 57318c8
Showing 1 changed file with 8 additions and 35 deletions.
43 changes: 8 additions & 35 deletions docs/user-guide/customizing-an-akri-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,23 @@ An already deployed Configuration can be modified in one of two ways:
1. Using the `helm upgrade` command
2. [Generating, modifying and applying a custom Configuration](customizing-an-akri-installation.md#generating-modifying-and-applying-a-configuration)

Note: Only the broker properties and capacity of an applied configuration should be modified, for any other modification, you need to delete and reapply the Configuration.

### Using `helm upgrade`

A Configuration can be modified by using the `helm upgrade` command. It upgrades an existing release according to the values provided, only updating what has changed. Simply modify your `helm install` command to reflect the new **desired state** of Akri and replace `helm install` with `helm upgrade`. Using the ONVIF protocol implementation as an example, say an IP camera with IP address 10.0.0.1 is malfunctioning and should be filtered out of discovery, the following command could be run:
A Configuration can be modified by using the `helm upgrade` command. It upgrades an existing release according to the values provided, only updating what has changed. Simply modify your `helm install` command to reflect the new **desired state** of Akri and replace `helm install` with `helm upgrade`. Using the ONVIF protocol implementation as an example, say you want to set the capacity of discovered cameras to 3:

```bash
helm upgrade akri akri-helm-charts/akri \
--set onvif.configuration.enabled=true \
--set onvif.configuration.brokerPod.image.repository=<your broker image name> \
--set onvif.configuration.brokerPod.image.tag=<your broker image tag> \
--set onvif.configuration.discoveryDetails.ipAddresses.action=Exclude \
--set onvif.configuration.discoveryDetails.ipAddresses.items[0]=10.0.0.1
--set onvif.configuration.capacity=3
```

Note that the command is not simply `helm upgrade --set onvif.configuration.discoveryDetails.ipAddresses.items[0]=10.0.0.1`; rather, it includes all the old settings along with the new one. Also, note that we assumed you specified a broker pod image in your original installation command, so that brokers were deployed to utilize discovered cameras.
Note that the command is not simply `helm upgrade --set onvif.configuration.capacity=3`; rather, it includes all the old settings along with the new one. Also, note that we assumed you specified a broker pod image in your original installation command, so that brokers were deployed to utilize discovered cameras.

Helm will create a new ONVIF Configuration and apply it to the cluster. When the Agent sees that a Configuration has been updated, it deletes all Instances associated with that Configuration and the controller brings down all associated broker pods. Then, new Instances and broker pods are created. Therefore, the command above will bring down all ONVIF broker pods and then bring them all back up except for the ones servicing the IP camera at IP address 10.0.0.1.
Helm will create a new ONVIF Configuration and apply it to the cluster. When the Agent sees that a Configuration has been updated, it updates all Instances associated with that new Configuration.

## Adding another Configuration to a cluster

Expand Down Expand Up @@ -184,38 +185,10 @@ helm install udev-config akri-helm-charts/akri \
--set udev.configuration.enabled=true \
--set udev.configuration.discoveryDetails.udevRules[0]='KERNEL=="video[0-9]*"\, ENV{ID_V4L_CAPABILITIES}==":capture:"'
```
## Modifying a broker
Want to change what broker is deployed to already discovered devices or deploy a new Job to the devices? Instead of deleting and reapplying the Configuration, you can modify the `brokerSpec` of the Configuration using one of the strategies from the [section on modifying a deployed Configuration](#Modifying-a-deployed-Configuration).

This can be illustrated using Akri's [mock debug echo Discovery Handler](../development/debugging.md). The following installation deploys a BusyBox Job
to each discovered mock device. That Job simply echos "Hello World".
```sh
helm install akri akri-helm-charts/akri \
--set agent.allowDebugEcho=true \
--set debugEcho.discovery.enabled=true \
--set debugEcho.configuration.brokerJob.image.repository=busybox \
--set debugEcho.configuration.brokerJob.command[0]="sh" \
--set debugEcho.configuration.brokerJob.command[1]="-c" \
--set debugEcho.configuration.brokerJob.command[2]="echo 'Hello World'"
--set debugEcho.configuration.enabled=true
```

Say you are feeling more exuberant and want the Job to echo "Hello Amazing World", you can update the `brokerSpec` like so:

```sh
helm upgrade akri akri-helm-charts/akri \
--set agent.allowDebugEcho=true \
--set debugEcho.discovery.enabled=true \
--set debugEcho.configuration.brokerJob.image.repository=busybox \
--set debugEcho.configuration.brokerJob.command[0]="sh" \
--set debugEcho.configuration.brokerJob.command[1]="-c" \
--set debugEcho.configuration.brokerJob.command[2]="echo 'Hello World'"
--set debugEcho.configuration.enabled=true
```

New Jobs will be spun up.
## Modifying a broker

> Note: The Agent and Controller can only gracefully handle changes to the `brokerSpec`. If any other parts of the Configuration are modified, the Agent will restart discovery, deleting and recreating the Instances.
Currently, to modify a broker (be it a Job or Pod), you need to delete and re-apply the Configuration.

## Deleting a Configuration from a cluster

Expand Down

0 comments on commit 57318c8

Please sign in to comment.