Helm Libraries
The Helm libraries provide a unified interface for Helm chart deployments, repository management, values templating, and chart version management. All CD pipeline stages use these functions for consistent deployment behavior.
Source: scripts/lib/helm/
deploy.sh -- Unified Deployment
Module: scripts/lib/helm/deploy.sh
The primary deployment module used by all pipeline stages.
Key Functions
| Function | Description |
|---|---|
helm_release_exists | Check if a Helm release exists in a namespace |
helm_release_status | Get the status of a Helm release (deployed, failed, pending) |
helm_releases_list | List all releases in a namespace |
helm_cleanup_stuck_deployment | Clean up releases stuck due to CrashLoopBackOff pods |
helm_deploy_external | Deploy an external chart (from Helm repository) |
helm_deploy_local | Deploy a local chart (from infrastructure/helm/) |
Deployment Pattern
helm_deploy_local "ai-service" "matih-data-plane" \
"--set image.tag=${IMAGE_TAG}"This wraps helm upgrade --install with:
- Automatic namespace creation
- Wait and timeout configuration
- Error handling and retry logic
- Release status verification
Configuration
| Setting | Default | Description |
|---|---|---|
DEFAULT_TIMEOUT | 10m | Helm deployment timeout |
DEFAULT_WAIT | true | Wait for deployment to complete |
HELM_CHARTS_DIR | infrastructure/helm | Base directory for local charts |
repo.sh -- Repository Management
Module: scripts/lib/helm/repo.sh
Manages Helm chart repositories.
Functions
| Function | Description |
|---|---|
helm_repo_exists | Check if a repository is already added |
helm_repo_add | Add a Helm repository |
helm_repo_update | Update all repository indices |
helm_repo_ensure | Add repository if not exists, then update |
template.sh -- Values Template Engine
Module: scripts/lib/helm/template.sh
Generates Helm values files from templates with variable substitution.
Functions
| Function | Description |
|---|---|
init_template_vars | Initialize template variables from config and environment |
render_values | Render a values template with variable substitution |
Template Variables
| Variable | Source | Example |
|---|---|---|
TPL_ACR_URL | Terraform outputs | matihlabsacr.azurecr.io |
TPL_IMAGE_TAG | Build metadata | 20260212-abc1234 |
TPL_ENVIRONMENT | Environment variable | dev |
TPL_NS_CONTROL_PLANE | Default | matih-control-plane |
TPL_NS_DATA_PLANE | Default | matih-data-plane |
versioning.sh -- Chart Version Management
Module: scripts/lib/helm/versioning.sh
Manages chart versions and appVersion fields.
Functions
| Function | Description |
|---|---|
helm_get_chart_version | Read version from Chart.yaml |
helm_bump_version | Increment chart version |
Related Pages
- Core Libraries -- Configuration and logging
- Kubernetes Libraries -- K8s operations
- CD Pipeline -- Pipeline using these libraries