Kubernetes Deployment Specification
Relevant source files
The following files were used as context for generating this wiki page:
The Kubernetes deployment specification for the OdooConnectorAPI project provides a scalable and manageable infrastructure for hosting a FastAPI-based RESTful service. This system is designed to facilitate communication between external applications and Odoo ERP instances by abstracting the connection logic into a containerized environment.
The deployment infrastructure is managed via Helm, which packages Kubernetes manifests into a versioned chart. This allows for consistent deployments across different environments (development, staging, production) by utilizing configurable values for container images, replica counts, and Odoo connection parameters.
Sources: README.md:3-8, charts/odooconnectorapi/Chart.yaml:1-5
Architecture and Components
The Kubernetes architecture for OdooConnectorAPI consists of three primary resources: a Deployment, a Service, and a configuration layer managed through Helm values.
Core Resources
- Deployment: Manages the lifecycle of the application pods. It defines the desired state, including the number of replicas and the container image to run.
- Service: Provides a stable network endpoint (ClusterIP) to expose the application pods within the cluster.
- Configurable Values: A set of parameters that allow operators to inject environment-specific data without modifying the underlying manifest templates.
The following diagram illustrates the relationship between these Kubernetes components:
Deployment Configuration
The Deployment manifest (deployment.yaml) specifies how the FastAPI application container is executed. It utilizes standard labels and selectors to ensure the controller can track the pods it creates.
Container Specification
The container runs on port 8000 and is configured via environment variables that correspond to Odoo connection settings. The image used is defined by the image.repository and image.tag values.
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
env:
- name: ODOO_URL
value: {{ .Values.env.ODOO_URL }}
- name: ODOO_DB
value: {{ .Values.env.ODOO_DB }}
- name: ODOO_USERNAME
value: {{ .Values.env.ODOO_USERNAME }}
- name: ODOO_PASSWORD
value: {{ .Values.env.ODOO_PASSWORD }}
ports:
- containerPort: 8000
Sources: charts/odooconnectorapi/templates/deployment.yaml:9-24
Service Specification
The Service manifest (service.yaml) defines how the application is accessed internally. It acts as a load balancer across the pods managed by the Deployment.
| Feature | Specification | Source |
|---|---|---|
| Service Type | ClusterIP (Default) | values.yaml:11 |
| External Port | 80 (Default) | values.yaml:12 |
| Target Port | 8000 | service.yaml:10 |
| Selector | app: {{ include "odooconnectorapi.name" . }} | service.yaml:12 |
Sources: charts/odooconnectorapi/templates/service.yaml:1-13, charts/odooconnectorapi/values.yaml:10-12
Helm Configuration (values.yaml)
The values.yaml file serves as the single source of truth for customizing the deployment. It allows for the modification of scaling, image selection, and application secrets.
| Parameter | Type | Default Value | Description |
|---|---|---|---|
replicaCount | Integer | 1 | Number of pod instances to run. |
image.repository | String | <your_image> | The Docker image location. |
image.tag | String | latest | The specific version/tag of the image. |
service.port | Integer | 80 | The port exposed by the Kubernetes service. |
env.ODOO_URL | String | "localhost" | The URL of the target Odoo server. |
env.ODOO_DB | String | "mydb" | The name of the Odoo database. |
Sources: charts/odooconnectorapi/values.yaml:4-21
Deployment Workflow
The deployment process involves packaging the Helm chart and installing it into the cluster.
Installation Commands
To deploy the application to a configured Kubernetes cluster:
- Navigate to the chart directory:
cd charts/odooconnectorapi - Package the chart:
helm package . - Install:
helm install odooconnectorapi odooconnectorapi-0.1.0.tgz --values values.yaml
Sources: README.md:46-60
Conclusion
The Kubernetes Deployment Specification for OdooConnectorAPI leverages Helm to provide a flexible and repeatable deployment pattern. By decoupling configuration from code and using standard Kubernetes abstractions like Deployments and Services, the system ensures that the FastAPI application can scale according to demand while maintaining secure and reliable connections to Odoo ERP.