Customizing Helm Values
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
Customizing Helm values is a critical process for deploying the OdooConnectorAPI into a Kubernetes environment. The project provides a Helm chart (version 0.1.0) that abstracts the complexity of Kubernetes manifest management by using a centralized values.yaml file. This configuration allows developers to define container images, resource scaling, network exposure, and Odoo connection parameters without modifying the underlying template logic.
Sources: charts/odooconnectorapi/Chart.yaml:1-5, README.md:58-67
Core Configuration Structure
The Helm chart uses the values.yaml file to inject data into Kubernetes templates. This data flow ensures that the deployment remains environment-agnostic, allowing for different settings across development, staging, and production clusters.
Configuration Data Flow
The following diagram illustrates how values from values.yaml are propagated through the Helm templates to create the final Kubernetes resources.
The diagram shows the transformation of static configuration values into active Kubernetes resources.
Sources: charts/odooconnectorapi/templates/deployment.yaml:1-24, charts/odooconnectorapi/templates/service.yaml:1-13
Key Configuration Parameters
The values.yaml file is divided into several logical sections: image management, service networking, environment variables for Odoo connectivity, and replica scaling.
1. Image and Scaling
These settings define which container image the Kubernetes cluster should pull and how many instances of the application should run.
| Parameter | Type | Default Value | Description |
|---|---|---|---|
image.repository | String | <your_image> | The Docker image repository for the API. |
image.tag | String | latest | The specific version/tag of the image. |
image.pullPolicy | String | IfNotPresent | Strategy for pulling the image from the registry. |
replicaCount | Integer | 1 | Number of desired pod instances. |
Sources: charts/odooconnectorapi/values.yaml:4-8, charts/odooconnectorapi/values.yaml:21
2. Odoo Connection Environment
The deployment template maps these values to environment variables within the container, which are then consumed by the FastAPI application's initialization logic.
| Parameter | Type | Default Value | Description |
|---|---|---|---|
env.ODOO_URL | String | "localhost" | The address of the Odoo server. |
env.ODOO_DB | String | "mydb" | The target Odoo database name. |
env.ODOO_USERNAME | String | "admin" | Username for Odoo RPC authentication. |
env.ODOO_PASSWORD | String | "admin" | Password for Odoo RPC authentication. |
Sources: charts/odooconnectorapi/values.yaml:14-19, charts/odooconnectorapi/templates/deployment.yaml:13-22, app/main.py:10-13
3. Service Exposure
The service section configures how the API is accessed within or outside the cluster.
| Parameter | Type | Default Value | Description |
|---|---|---|---|
service.type | String | ClusterIP | Kubernetes service type (e.g., ClusterIP, NodePort, LoadBalancer). |
service.port | Integer | 80 | The port exposed by the service. |
Sources: charts/odooconnectorapi/values.yaml:10-12, charts/odooconnectorapi/templates/service.yaml:6-10
Implementation in Deployment
The deployment.yaml template utilizes these values to construct the container specification. Specifically, it maps the env values from the Helm chart directly to the environment variables expected by the Python application code.
# Example mapping in deployment.yaml
env:
- name: ODOO_URL
value: {{ .Values.env.ODOO_URL }}
- name: ODOO_DB
value: {{ .Values.env.ODOO_DB }}
Sources: charts/odooconnectorapi/templates/deployment.yaml:13-18
The application code in app/main.py retrieves these values using os.getenv() to establish connection parameters for the odoorpc.ODOO client.
Sources: app/main.py:10-13, app/main.py:25-26
Summary
Customizing Helm values for OdooConnectorAPI allows for flexible deployment configurations by separating infrastructure concerns from the application code. By modifying the values.yaml file, users can define Odoo credentials, manage container image versions, and scale the application replicas to meet production demands.