# Configuration ```{warning} This project is still evolving, so these docs may be incomplete or out-of-date. ``` Jumpstarter can be configured as either a client, an exporter, or both depending on your use case and deployment strategy. By default, a local client and exporter session are automatically initialized when running test scripts through `jmp start` or the `jmp shell` commands. This allows for easy testing of new drivers, client libraries, or verifying that tests work on your local bench. When interacting with remote exporters in a CLI or CI environment, multiple clients can be configured on the same system and used to interact with different devices and different exporter instances. Similarly, multiple exporters can be configured on a single host system to interact with many different devices. However, each exporter instance is independent, making it possible to stop, restart, and add new exporters while others are executing tests. ## User Configuration Jumpstarter stores user-specific configs in the `~/.config/jumpstarter` directory within the user's home folder. The user config file defines the current client config and any user-specific configurations for `jmp` CLI tool. ```yaml # ~/.config/jumpstarter/config.yaml apiVersion: jumpstarter.dev/v1alpha1 kind: UserConfig config: current-client: default ``` ## System Configuration Jumpstarter stores system configs in the `/etc/jumpstarter` directory. This configuration directory is primarily used by the exporters `/etc/jumpstarter/exporters` as they often run as daemon services on the host system. ## Clients Client configurations are stored in the Jumpstarter user configuration directory `~/.config/jumpstarter/clients`. Each client config is a YAML file that contains the client name, access token, and any configuration parameters. ### Client Config ```yaml # ~/.config/jumpstarter/clients/myclient.yaml apiVersion: jumpstarter.dev/v1alpha1 kind: Client endpoint: "jumpstarter.my-lab.com:1443" token: "dGhpc2lzYXRva2VuLTEyMzQxMjM0MTIzNEyMzQtc2Rxd3Jxd2VycXdlcnF3ZXJxd2VyLTEyMzQxMjM0MTIz" drivers: # Wildcards are supported allow: ["jumpstarter.drivers.*", "vendorpackage.*"] ``` - `endpoint` - The gRPC endpoint of the Jumpstarter controller server. - `token` - A client auth token generated by the controller. - `drivers` - Driver client library configuration. - `allow` - A list of allowed driver namespaces to automatically load. - `unsafe: true` - Should all drivers be allowed to load? ### Multiple Clients Multiple client configs can be added to the `~/.config/jumpstarter/clients` directory manually or by using the Jumpstarter CLI. Similar to kubectl, Jumpstarter allows you to switch between different client configurations using the CLI tool. A `default` client is automatically configured when installing the Jumpstarter Helm chart with `jmp install`. ### Creating a client in the distributed service To create a new client in the distributed service you must use the `jmpctl` command, please follow the instructions in the [Jumpstarter service CLI](./cli/clients.md). ### Importing a client created by the administrator Importing a new client is as simple as copying the administrator provided yaml file to `~/.config/jumpstarter/clients/`, alternatively if we have the token and endpoint the `jmp create ` command can be used to create the config file. To switch between different client configs, use the `jmp use ` command: ```bash $ jmp use another Using client config '/home/jdoe/.config/jumpstarter/clients/another.yaml' ``` All client configurations can be listed with `jmp list`: ```bash $ jmp list CURRENT NAME ENDPOINT PATH * default jumpstarter1.my-lab.com:1443 /home/jdoe/.config/jumpstarter/clients/default.yaml myclient jumpstarter2.my-lab.com:1443 /home/jdoe/.config/jumpstarter/clients/myclient.yaml another jumpstarter3.my-lab.com:1443 /home/jdoe/.config/jumpstarter/clients/another.yaml ``` Clients can also be removed using `jmp delete `: ```bash $ jmp delete myclient Deleted client config '/home/jdoe/.config/jumpstarter/clients/myclient.yaml' ``` ### Client Environment Variables The client configuration may also be provided by environment variables which may be useful in CI or when writing a script that uses Jumpstarter. - `JUMPSTARTER_GRPC_INSECURE` - Set to `1` to disable TLS verification. - `JMP_CLIENT_CONFIG` - A path to a client configuration YAML file to use. - `JMP_CLIENT` - The name of a registered client config to use. - `JMP_ENDPOINT` - The gRPC endpoint of the Jumpstarter controller server (overrides the config value). - `JMP_TOKEN` - A client auth token generated by the controller (overrides the config value). - `JMP_DRIVERS_ALLOW` - A comma-separated list of allowed driver namespaces to automatically load. Can be set to `UNSAFE` to allow unsafe loading of drivers. ## Exporters Exporter configurations are by default stored globally in the Jumpstarter config directory `/etc/jumpstarter/exporters`. Each exporter config is a YAML file that provides connection details and a list of exporter drivers. ### Exporter Config Exporters can be configured using a pure-YAML format, which allows for the configuration of built-in drivers and any additional driver packages registered by the user. ```yaml # /etc/jumpstarter/exporters/myexporter.yaml apiVersion: jumpstarter.dev/v1alpha1 kind: Exporter endpoint: "jumpstarter.my-lab.com:1443" token: "dGhpc2lzYXRva2VuLTEyMzQxMjM0MTIzNEyMzQtc2Rxd3Jxd2VycXdlcnF3ZXJxd2VyLTEyMzQxMjM0MTIz" export: power: type: "jumpstarter.drivers.power.PduPower" config: host: "192.168.1.111" port: 1234 username: "admin" password: "secret" serial: type: "jumpstarter.drivers.serial.Pyserial" config: port: "/dev/ttyUSB0" baudrate: 115200 custom: type: "vendorpackage.CustomDriver" config: hello: "world" ``` - `endpoint` - The gRPC endpoint of the Jumpstarter controller server. - `token` - An exporter auth token generated by the controller. - `export` - Exporter driver configuration. ### Exporter CLI Commands ### Creating a exporter in the distributed service To create a new exporter in the distributed service you must use the `jmpctl` command, please follow the instructions in the [Jumpstarter service CLI](./cli/exporters.md). ### Creating a exporter configuration file To create a new exporter configuration file from a know endpoint and token the `jmp-exporter create ` command can be used. ```bash $ jmp-exporter create myexporter Endpoint: grpc.jumpstarter.my.domain.com Token: <> ``` To use a specific config when starting the exporter: ```bash $ jmp-exporter run my-exporter Using exporter config '/etc/jumpstarter/exporters/another/exporter.yaml' ``` The path to a config can also be provided: ```bash jmp-exporter run -c /etc/jumpstarter/exporters/another/exporter.yaml ``` All exporter configurations can be listed with `jmp-exporter list`: ```bash $ jmp-exporter list ALIAS PATH test-exporter-2 /etc/jumpstarter/exporters/test-exporter-2.yaml my-exporter /etc/jumpstarter/exporters/my-exporter.yaml ``` Exporers can also be removed using `jmp-exporter delete `: ```bash $ jmp-exporter delete myexporter Deleted exporter config '/etc/jumpstarter/exporters/myexporter.yaml' ``` ### Exporter Environment Variables The exporter configuration may also be provided by environment variables which may be useful in CI or when writing a script that uses Jumpstarter. - `JUMPSTARTER_GRPC_INSECURE` - Set to `1` to disable TLS verification. to use. - `JMP_ENDPOINT` - The gRPC endpoint of the Jumpstarter controller server (overrides the config value). - `JMP_TOKEN` - An exporter auth token generated by the controller (overrides the config value). ## Running an Exporter The exporter service can be run as a container either within the same cluster (using node affinity) or on a remote machine that has access to the cluster over the network. ### Running using Podman To run the exporter container on a test runner using Podman: ```{code-block} bash :substitutions: $ sudo podman run --rm -ti --name my-exporter --net=host --privileged \ -e JUMPSTARTER_GRPC_INSECURE=1 \ -v /run/udev:/run/udev -v /dev:/dev -v /etc/jumpstarter:/etc/jumpstarter \ quay.io/jumpstarter-dev/jumpstarter:{{version}} \ jmp-exporter run my-exporter INFO:jumpstarter.exporter.exporter:Registering exporter with controller INFO:jumpstarter.exporter.exporter:Currently not leased ``` This will run the exporter in the foreground and allow you to observe the behavior. Please note that we are running the exporter as root, with access to all devices and network interfaces, this is most likely necessary for the exporter to access the interface devices that will allow it to control the target DUT(s). Once we are satisfied with the behavior we can install the exporter as a systemd service: #### Running as a Service To run the exporter as a service podman-systemd is recommended, by using podman-systemd you can simply create a systemd service file at `/etc/containers/systemd/my-exporter.container` with the following content: ```{code-block} ini :substitutions: [Unit] Description=My exporter [Container] ContainerName=my-exporter Environment=JUMPSTARTER_GRPC_INSECURE=1 Exec=jmp-exporter run my-exporter Image=quay.io/jumpstarter-dev/jumpstarter:{{version}} Network=host PodmanArgs=--privileged Volume=/run/udev:/run/udev Volume=/dev:/dev Volume=/etc/jumpstarter:/etc/jumpstarter [Install] WantedBy=multi-user.target default.target ``` Then enable and start the service: ```bash sudo systemctl enable --now my-exporter ```