A set of tools for generating Kubernetes Helm charts for EPICS-based systems.
Project description
epik8s-tools
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.
- 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.
- IOC Execution: Run IOC configurations directly using the
epik8s-runtool. - Docker Compose Generation: Build ready-to-run single-node Docker Compose deployments with
epik8s-compose.
Installation
Install epik8s-tools via pip:
pip install epik8s-tools
CLI Options
| Option | Description |
|---|---|
--beamline |
Name of the beamline to configure. |
--namespace |
Kubernetes namespace for the beamline deployment. |
--targetRevision |
Target revision for Helm charts (default: experimental). |
--serviceAccount |
Service account for Kubernetes. |
--beamlinerepogit |
Git URL of the beamline repository. |
--beamlinereporev |
Git revision for the repository (default: main). |
--iocbaseip |
Base IP range for IOCs (e.g., 10.96.0.0/12). |
--iocstartip |
Start IP within the IOC base range (default: 2). |
--cagatewayip |
IP for the CA gateway load balancer. |
--pvagatewayip |
IP for the PVA gateway load balancer. |
--dnsnamespace |
DNS/IP address for ingress configuration. |
--ingressclass |
Specify ingress class (haproxy, nginx, or empty for no ingress class). |
--nfsserver |
NFS server address. |
--nfsdirdata |
NFS directory for data partition (default: /epik8s/data). |
--nfsdirautosave |
NFS directory for autosave partition (default: /epik8s/autosave). |
--nfsdirconfig |
NFS directory for config partition (default: /epik8s/config). |
--elasticsearch |
ElasticSearch server address. |
--mongodb |
MongoDB server address. |
--kafka |
Kafka server address. |
--vcams |
Number of simulated cameras to generate (default: 1). |
--vicpdas |
Number of simulated ICPDAS devices to generate (default: 1). |
--mysqlchart |
Use custom MySQL chart instead of Bitnami (for microk8s). |
--channelfinder |
Enable ChannelFinder and feeder services. |
--openshift |
Flag for enabling OpenShift support. |
--token |
Git personal token for repository access, if required. |
--version |
Show version information and exit. |
Examples
Basic Beamline Generation
Generate a new project structure for a beamline with the following command:
epik8s-tools my_project --beamline MyBeamline --iocbaseip 10.96.0.0/12 --beamlinerepogit https://github.com/beamline/repo.git
Generating OPI Panels
To generate OPI panels from YAML configuration files, you can use the epik8s-opigen tool. This tool reads a YAML file with OPI configurations and outputs the generated OPI files in the specified project directory.
Example Command
epik8s-opigen --yaml deploy/values.yaml --projectdir opi-output
--yaml: Path to the YAML configuration file (e.g.,deploy/values.yaml).--projectdir: Directory where the OPI files will be generated (e.g.,opi-output).
This command will generate the OPI panel files based on the configurations specified in the YAML file and save them in the specified output directory.
Specifying CA and PVA Gateway IPs
For projects that require external access to Channel Access (CA) and PV Access (PVA) gateways, you can specify the IP addresses for the respective load balancers using the --cagatewayip and --pvagatewayip options.
Example Command
epik8s-tools my_project --beamline MyBeamline --cagatewayip 10.96.1.10 --pvagatewayip 10.96.1.11
Running IOCs with epik8s-run
The epik8s-run tool allows you to execute IOC configurations directly from a YAML file.
Example Command
epik8s-run beamline-config.yaml ioc1 ioc2 --workdir ./workdir --native
beamline-config.yaml: Path to the YAML configuration file containing IOC definitions.ioc1,ioc2: Names of the IOCs to run.--workdir: Working directory for temporary files (default:.).--native: Run natively without using Docker.--image: Specify the Docker image to use (default:ghcr.io/infn-epics/infn-epics-ioc-runtime:latest).
This command will validate the IOC configurations, generate necessary files, and start the IOCs either natively or in a Docker container.
Generating a Single-Node Docker Compose with epik8s-compose
The epik8s-compose tool converts a beamline YAML configuration into a ready-to-use directory for Docker Compose.
Example Command
epik8s-compose --config tests/beamline.yaml --output test-compose
Generated output includes:
docker-compose.yamlepics.env(shared EPICS environment)epics-channel.env(host helper for CA/PVA access)- per-IOC directories in
iocs/<iocname>/
Start the Beamline
cd test-compose
docker compose up
Useful Options
--caport: starting CA port for gateway mappings (default5064)--pvaport: starting PVA port for gateway mappings (default5075)--htmlport: starting HTTP port for ingress-mapped services (default8090)--services: include only selected services/IOCs--exclude: exclude selected services/IOCs--platform: target container platform (defaultlinux/amd64)
GitHub Actions
This repository includes GitHub workflows for CI, tag creation, and PyPI publishing.
Compose CI
Workflow: .github/workflows/compose-ci.yml
- Runs on push and pull request to
main - Tests
epik8s-composegeneration on sample configurations - Uploads generated compose artifacts for inspection
Create Release Tag
Workflow: .github/workflows/create-release-tag.yml
- Manual trigger (
workflow_dispatch) - Input: semantic version without
v(for example0.10.4) - Creates and pushes tag
v<version> - Creates a GitHub Release with generated notes
Publish to PyPI
Workflow: .github/workflows/publish-pypi.yml
- Triggered automatically on tag push matching
v* - Builds the package and uploads to PyPI via
twine
Required GitHub secret:
PYPI_API_TOKEN: PyPI API token with upload permissions forepik8s-tools
Recommended Release Flow
- Update package version in
epik8s_tools/__init__.py. - Merge changes to
main. - Run
Create Release Tagworkflow and provide the new version. Publish PyPIworkflow runs automatically on the pushed tag.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file epik8s_tools-0.12.0.tar.gz.
File metadata
- Download URL: epik8s_tools-0.12.0.tar.gz
- Upload date:
- Size: 41.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65d9c50353fe9327120d8393f0c93d59a3b85daa00abafbdb81a1959478e20af
|
|
| MD5 |
a93474e254e06fa7223372a8514f1c45
|
|
| BLAKE2b-256 |
ad88aa2b4f6ec8d4dc3088277216aa2ba6eddbbe2aed378b8ae899428ac6574d
|
File details
Details for the file epik8s_tools-0.12.0-py3-none-any.whl.
File metadata
- Download URL: epik8s_tools-0.12.0-py3-none-any.whl
- Upload date:
- Size: 46.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2b258b8bcbe430de30c4c030a32cb9ef02b371e60c3a6833643be1ae5d96e87
|
|
| MD5 |
37ad7bc2d0cd581fd17b25e34897e973
|
|
| BLAKE2b-256 |
b6145aa8cf18078c551d51fee4a6966e71c4eb61fd95ed00a07e59b8e24f80dd
|