Helm values.yml Configuration
Relevant source files
The following files were used as context for generating this wiki page:
The values.yml file serves as the primary configuration interface for deploying the swimctl swimming pool automation controller via Helm. It defines the operational parameters for a Node-RED based environment, including container image specifications, hardware resource requirements (specifically I2C access), environment variables sourced from Kubernetes Secrets, and persistent storage configurations.
This configuration is specifically designed to work within a k3s environment running on a Raspberry Pi, leveraging the smarter-device-manager to expose physical I2C buses to the containerized application. It orchestrates the lifecycle of the automation logic by cloning external flows from a GitHub repository and establishing Git-based synchronization hooks.
Sources: values.yml, README.md:1-5
Core Container and Deployment Settings
The configuration specifies the deployment of the bgshacklett/swimctl image, which is hosted on the GitHub Container Registry. The deployment strategy is set to Recreate, ensuring that pods are completely terminated before new ones are started, which is often necessary when handling exclusive hardware locks like I2C interfaces.
| Parameter | Value | Description |
|---|---|---|
image.registry | ghcr.io | Container registry host |
image.repository | bgshacklett/swimctl | Application image repository |
image.tag | latest | Image version tag |
deploymentStrategy | Recreate | Strategy to replace existing pods |
| Sources: values.yml:1-6, values.yml:25 |
Hardware Resource Management
A critical aspect of the swimctl configuration is its integration with hardware devices. It requests specific access to I2C buses through the smarter-device-manager. This is facilitated by a DaemonSet that monitors the /dev directory and maps devices to Kubernetes resources.
The diagram shows how hardware I2C devices are mapped through the smarter-device-manager to be consumable by the pod via values.yml resource requests.
Sources: smarter-device-manager.yaml:39-65, values.yml:9-17
Resource Limits and Requests
The values.yml file explicitly defines requirements for three specific I2C interfaces:
smarter-devices/i2c-1smarter-devices/i2c-20smarter-devices/i2c-21
These resources are configured in both limits and requests blocks to ensure the pod is scheduled on a node with these devices and granted exclusive access.
Sources: values.yml:9-17
Security Context and Permissions
To interact with these hardware devices, the pod runs with specific UID/GID configurations. Notably, it includes the GID 994 in supplementalGroups to provide the necessary permissions for I2C bus access on the host system.
Sources: values.yml:20-23
Environment Variables and Secret Integration
The application relies on several environment variables for Node-RED project management and external service authentication (GitHub and MQTT). These are primarily mapped from a Kubernetes Secret named swimctl.
| Environment Variable | Source Secret Key | Purpose |
|---|---|---|
GITHUB_TOKEN_FLOWS | gh_token | Authentication for GitHub API |
GITHUB_OWNER_FLOWS | gh_owner | GitHub username/organization |
GITHUB_REPO_NAME_FLOWS | gh_repo_name | Name of the flows repository |
MQTT_PASSWORD | mqtt_password | Authentication for the MQTT broker |
NODE_RED_ACTIVE_PROJECT | N/A (Static) | Sets "swimctl-flows" as active |
| Sources: values.yml:32-60, README.md:31-37 |
Initialization and Git Integration
The values.yml defines an initContainer named clone-repo that prepares the Node-RED workspace before the main application starts. This container clones the automation flows from a GitHub repository and configures a post-commit hook to enable automated deployment updates.
This sequence illustrates the initialization process where the Git repository is synchronized to the shared volume before the main Node-RED container starts.
Sources: values.yml:84-110
Git Post-Commit Hook Logic
The initialization script creates a post-commit hook that automatically triggers a GitHub Action (apply-patch.yml) whenever a change is committed within the Node-RED environment. It uses curl to send a repository dispatch event containing the base64-encoded patch of the latest commit.
Sources: values.yml:101-115
Network and Storage Configuration
Ingress and mDNS
The system is accessible via the hostname swimctl.local. This is supported by an external-mdns deployment that listens for Ingress resources and broadcasts their hostnames over mDNS on the host network.
Sources: values.yml:63-69, external-mdns.yaml:47-66
Storage Volume Mapping
The configuration utilizes extraVolumes and extraVolumeMounts to inject custom settings into the Node-RED environment. Specifically, it mounts a .config.projects.json file from a ConfigMap to define the project structure and the active project name.
Sources: values.yml:76-81, configMaps.yaml:32-42
Summary
The values.yml configuration is the central orchestration point for the swimctl system. It bridges the gap between the containerized Node-RED environment and the physical Raspberry Pi hardware (I2C), while establishing a robust CI/CD-like workflow for pool automation logic via Git integration and GitHub Actions.