epik8s-tools
is a Python-based toolset for automating project structure generation, Helm chart creation, and deployment for EPICS (Experimental Physics and Industrial Control System) applications in Kubernetes environments EPIK8s. Designed to simplify complex deployment configurations, this package includes a command-line interface for rendering templates based on YAML configurations, making it easy to manage beamline and IOC (Input/Output Controller) configurations with a consistent structure. A simple guide to bring up a k8s single node cluster (extensible) is microk8s.
Features
- Project Structure Generation: Automatically create directories and files needed for EPICS-based projects.
- Helm Chart Creation: Generate Helm charts for Kubernetes deployments with custom values and templates.
- Docker compose Creation: Generate a docker compose file to run locally, iocs and services of a given epik8s configuration
- OPI Generation: Configure OPI (Operator Interface) panels for each beamline, including macros and settings.
- Support for Ingress and Load Balancers: Configurable settings for CA and PVA gateway IPs and ingress classes.
- Customizable Options: Extensive CLI options to adapt configurations to specific project needs.
Install EPIK8S tools
## create an environment python3 -m venv epik8s source epik8s/bin/activate pip3 install epik8s-tools
epik8s-gen
Create your beamline i.e testbeamline
epik8s-gen epik8s-testbeamline --namespace testbeamline --beamlinerepogit https://baltig.infn.it/lnf-da-control/epik8s-testbeamline.git --iocbaseip "10.96.0.0/12" --cagatewayip 10.10.6.109 --pvagatewayip 10.10.6.110 --dnsnamespace "apps.k8s-da.lnf.infn.it"
This command will create a Beamline tree, the script needs some information coming from K8S installation.
In particular if you want to fix IPs of your IOC to work around CA/PVA bugs you need to know the service cidr.
iocbaseip = service cidr
cagatewayip = first unused IP from metallb metallb
pvagatewayip = second unused IP from metallb metallb
epik8s-opigen
Create your beamline opi from a beamline yaml configuration
epik8s-opigen --yaml tests/eli_values.yaml --projectdir eli-test-opi --controls polrev-icpdas01 polrev-icpdas02
epik8s-compose
Test your beamline yaml configuration in docker-compose.
You should first generate a docker file configuration with the tool.
Usage
usage: epik8s-compose [-h] --config CONFIG --host-dir HOST_DIR [--output OUTPUT] [--services SERVICES [SERVICES ...]] [--exclude EXCLUDE [EXCLUDE ...]] [--caport CAPORT] [--pvaport PVAPORT] [--htmlport HTMLPORT] Generate docker-compose.yaml and config.yaml for EPICS IOC. optional arguments: -h, --help show this help message and exit --config CONFIG Path to the configuration file (YAML). --host-dir HOST_DIR Base directory on the host. --output OUTPUT Output file for docker-compose.yaml. --services SERVICES [SERVICES ...] List of services to include in the output (default ALL). --exclude EXCLUDE [EXCLUDE ...] List of services to exclude in the output --caport CAPORT Start CA access port to map on host --pvaport PVAPORT Start PVA port to map on host --htmlport HTMLPORT Start ingress (http) port on host ## example epik8s-compose --config tests/eli_values.yaml --host-dir ./tests/eli_config --output docker-compose-eli.yaml --pvaport 5175 --exclude archiver
Then you should run it using docker compose command.
docker compose -f docker-compose-eli.yaml up