|
1 | | -# Helm Chart Structure Refactoring |
| 1 | +# Service-Specific Templates |
2 | 2 |
|
3 | | -This directory contains the refactored Helm chart templates for the EOAPI services. |
4 | | - |
5 | | -## Overview |
6 | | - |
7 | | -The templates have been refactored from a loop-based approach to a service-specific approach where each service has its own dedicated template files. This improves readability, maintainability, and flexibility. |
| 3 | +This directory contains service-specific templates organized to improve readability, maintainability, and flexibility. |
8 | 4 |
|
9 | 5 | ## Directory Structure |
10 | 6 |
|
11 | 7 | ``` |
12 | 8 | services/ |
13 | | -├── _common.tpl # Limited common helper functions |
14 | | -├── ingress.yaml # Single ingress for all services |
15 | | -├── traefik-middleware.yaml # Traefik middleware for path stripping |
16 | | -├── raster/ # One directory per service |
| 9 | +├── _common.tpl # Limited common helper functions |
| 10 | +├── ingress.yaml # Single shared ingress for all services |
| 11 | +├── raster/ # Raster service templates |
| 12 | +│ ├── deployment.yaml # Deployment definition |
| 13 | +│ ├── service.yaml # Service definition |
| 14 | +│ ├── configmap.yaml # ConfigMap definition |
| 15 | +│ └── hpa.yaml # HorizontalPodAutoscaler definition |
| 16 | +├── stac/ # STAC service templates |
17 | 17 | │ ├── deployment.yaml |
18 | 18 | │ ├── service.yaml |
19 | 19 | │ ├── configmap.yaml |
20 | 20 | │ └── hpa.yaml |
21 | | -├── stac/ |
| 21 | +├── vector/ # Vector service templates |
22 | 22 | │ ├── deployment.yaml |
23 | 23 | │ ├── service.yaml |
24 | 24 | │ ├── configmap.yaml |
25 | 25 | │ └── hpa.yaml |
26 | | -├── vector/ |
27 | | -│ ├── deployment.yaml |
28 | | -│ ├── service.yaml |
29 | | -│ ├── configmap.yaml |
30 | | -│ └── hpa.yaml |
31 | | -└── multidim/ |
| 26 | +└── multidim/ # Multidimensional service templates |
32 | 27 | ├── deployment.yaml |
33 | 28 | ├── service.yaml |
34 | 29 | ├── configmap.yaml |
35 | 30 | └── hpa.yaml |
36 | 31 | ``` |
37 | 32 |
|
38 | | -## Key Improvements |
| 33 | +## Common Helpers |
| 34 | + |
| 35 | +The `_common.tpl` file provides limited helper functions for truly common elements: |
| 36 | + |
| 37 | +- `eoapi.mountServiceSecrets`: For mounting service secrets |
| 38 | +- `eoapi.commonEnvVars`: For common environment variables like SERVICE_NAME, RELEASE_NAME, GIT_SHA |
| 39 | +- `eoapi.pgstacInitContainers`: For init containers that wait for pgstac jobs |
| 40 | + |
| 41 | +For database environment variables, we leverage the existing `eoapi.postgresqlEnv` helper from the main `_helpers.tpl` file. |
39 | 42 |
|
40 | | -1. **Enhanced Readability**: Each service's configuration is explicitly defined in its own files, making it easier to understand. |
41 | | -2. **Improved Debugging**: Errors are isolated to specific service files, making troubleshooting simpler. |
42 | | -3. **Lower Risk Changes**: Changes intended for one service are contained within its files, reducing the risk of affecting other services. |
43 | | -4. **True Flexibility**: Each service can evolve independently, and new services can be added by copying and modifying existing patterns. |
44 | | -5. **Limited Helper Functions**: Common logic is extracted into the `_common.tpl` file but only for the most mechanical, repetitive parts. |
| 43 | +## Refactoring Benefits |
45 | 44 |
|
46 | | -## How to Use |
| 45 | +1. **Improved Readability**: Service configurations are explicit and clearly visible |
| 46 | +2. **Better Maintainability**: Changes to one service don't affect others |
| 47 | +3. **Enhanced Flexibility**: Each service can evolve independently |
| 48 | +4. **Easier Debugging**: Errors are isolated to specific service files |
| 49 | +5. **Safer Changes**: Template modifications can be tested on individual services |
47 | 50 |
|
48 | | -The chart maintains the same values.yaml structure but templates are now organized by service. The original looping templates have been preserved with `.old` extensions for reference. |
| 51 | +## Usage |
49 | 52 |
|
50 | | -For adding a new service: |
51 | | -1. Create a new directory with the service name |
52 | | -2. Copy and adapt the deployment, service, configmap, and hpa templates |
53 | | -3. Add an entry to ingress.yaml and traefik-middleware.yaml if needed |
54 | | -4. Update values.yaml with the new service configuration |
| 53 | +No changes to `values.yaml` structure were required. The chart maintains full backward compatibility with existing deployments. |
0 commit comments