-
Notifications
You must be signed in to change notification settings - Fork 12
Refactor Helm Chart to Service-Specific Templates #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 26 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
8e52252
Refactor PostgreSQL configuration and remove deprecated database setup
emmanuelmathot 637dc91
Add PostgreSQL host reader and writer environment variables, and incl…
emmanuelmathot 9b6b092
Merge remote-tracking branch 'origin/main' into unified_pg
emmanuelmathot 5f45f50
Merge branch 'main' into unified_pg
emmanuelmathot ee41f4b
Added a clarifying comment in values.yaml to explain that values in t…
emmanuelmathot e6e0fed
Refactor: Implement unified ingress configuration for nginx and traef…
emmanuelmathot b091f48
Remove deprecated ingress backup template from helm chart
emmanuelmathot d6abec2
Enhance ingress configuration in test values for Traefik with path tr…
emmanuelmathot d4b5309
Add Traefik middleware for path rewriting and update ingress annotations
emmanuelmathot 6ff372d
Refactor: Update Traefik ingress annotations to use middleware for pa…
emmanuelmathot 149490d
Remove Traefik ingress annotations for entrypoints and middlewares in…
emmanuelmathot b303394
Add init container for pgstac migration and loading samples in deploy…
emmanuelmathot 0486843
Add command to retrieve and describe Traefik middleware in CI workflow
emmanuelmathot 9e4cb32
Refactor ingress configuration for Traefik and NGINX; add host for TL…
emmanuelmathot 127eb8c
Add Traefik middleware annotation for ingress tests
emmanuelmathot 193334e
Add Traefik entrypoint annotation to ingress configuration
emmanuelmathot c88a9ab
Add temporary annotation for Traefik to support ASGI prefix handling
emmanuelmathot 6784c9c
Merge branch 'main' into unified_ingress
emmanuelmathot 93cfb90
Remove testing condition from doc-server ConfigMap template
emmanuelmathot e7c3037
Update Traefik service IP address to use local endpoint in helm-tests…
emmanuelmathot bca644b
Merge branch 'main' into unified_ingress
emmanuelmathot 91c5fe9
Remove hardcoded service account name from deployment template
emmanuelmathot 4710419
Refactor code structure for improved readability and maintainability
emmanuelmathot 01e1e4f
Refactor service templates and tests for improved organization and cl…
emmanuelmathot 4f537f5
Refactor Helm chart tests: Split service tests into individual files …
emmanuelmathot e2d38fb
Add template references to service tests for multidim, raster, stac, …
emmanuelmathot 5750974
Refactor Helm chart to support service-specific ingress configuration…
emmanuelmathot e762a6f
Update helm-chart/eoapi/templates/services/multidim/hpa.yaml
emmanuelmathot 00060e4
Update helm-chart/eoapi/templates/services/raster/hpa.yaml
emmanuelmathot 8103c8b
Update helm-chart/eoapi/templates/services/vector/hpa.yaml
emmanuelmathot d490e11
Implement STAC Auth Proxy integration with EOAPI-K8S for service-spec…
emmanuelmathot 681028c
Merge branch 'chart_refactor' of https://github.com/developmentseed/e…
emmanuelmathot ee9b045
Update helm-chart/eoapi/templates/services/stac/hpa.yaml
emmanuelmathot 1baf1b5
Merge branch 'main' into chart_refactor
emmanuelmathot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # Unified Ingress Configuration | ||
|
|
||
| This document describes the unified ingress approach implemented in the eoAPI Helm chart. | ||
|
|
||
| ## Overview | ||
|
|
||
| eoAPI now uses a consolidated, controller-agnostic ingress configuration. This approach: | ||
|
|
||
| - Eliminates code duplication between different ingress controller implementations | ||
| - Provides consistent behavior across controllers | ||
| - Simplifies testing and maintainability | ||
| - Removes artificial restrictions on using certain ingress controllers in specific environments | ||
| - Makes it easier to add support for additional ingress controllers in the future | ||
|
|
||
| ## Configuration | ||
|
|
||
| The ingress configuration has been streamlined and generalized in the `values.yaml` file: | ||
|
|
||
| ```yaml | ||
| ingress: | ||
| # Unified ingress configuration for both nginx and traefik | ||
| enabled: true | ||
| # ingressClassName: "nginx" or "traefik" | ||
| className: "nginx" | ||
| # Path configuration | ||
| pathType: "Prefix" # Can be "Prefix" or "ImplementationSpecific" based on controller | ||
| pathSuffix: "" # Add a suffix to service paths (e.g. "(/|$)(.*)" for nginx regex) | ||
| rootPath: "" # Root path for doc server | ||
| # Host configuration | ||
| host: "" | ||
| # Custom annotations to add to the ingress | ||
| annotations: {} | ||
| # TLS configuration | ||
| tls: | ||
| enabled: false | ||
| secretName: eoapi-tls | ||
| certManager: false | ||
| certManagerIssuer: letsencrypt-prod | ||
| certManagerEmail: "" | ||
| ``` | ||
|
|
||
| ## Controller-Specific Configurations | ||
|
|
||
| ### NGINX Ingress Controller | ||
|
|
||
| For NGINX, use the following configuration: | ||
|
|
||
| ```yaml | ||
| ingress: | ||
| enabled: true | ||
| className: "nginx" | ||
| pathType: "Prefix" | ||
| annotations: | ||
| nginx.ingress.kubernetes.io/use-regex: "true" | ||
| nginx.ingress.kubernetes.io/enable-cors: "true" | ||
| nginx.ingress.kubernetes.io/enable-access-log: "true" | ||
| ``` | ||
|
|
||
| ### Traefik Ingress Controller | ||
|
|
||
| When using Traefik, the system automatically includes the Traefik middleware to strip prefixes (e.g., `/stac`, `/raster`) from requests before forwarding them to services. This is handled by the `traefik-middleware.yaml` template. | ||
|
|
||
| For basic Traefik configuration: | ||
|
|
||
| ```yaml | ||
| ingress: | ||
| enabled: true | ||
| className: "traefik" | ||
| pathType: "Prefix" | ||
| # When using TLS, setting host is required to avoid "No domain found" warnings | ||
| host: "example.domain.com" # Required to work properly with TLS | ||
| annotations: | ||
| traefik.ingress.kubernetes.io/router.entrypoints: web | ||
| ``` | ||
|
|
||
| For Traefik with TLS: | ||
|
|
||
| ```yaml | ||
| ingress: | ||
| enabled: true | ||
| className: "traefik" | ||
| pathType: "Prefix" | ||
| # Host is required when using TLS with Traefik | ||
| host: "example.domain.com" | ||
| annotations: | ||
| traefik.ingress.kubernetes.io/router.entrypoints: websecure | ||
| tls: | ||
| enabled: true | ||
| secretName: eoapi-tls | ||
| ``` | ||
|
|
||
| ## Migration | ||
|
|
||
| If you're migrating from a previous version, follow these guidelines: | ||
|
|
||
| 1. Update your values to use the new unified configuration | ||
| 2. Ensure your ingress controller-specific annotations are set correctly | ||
| 3. Set the appropriate `pathType` for your controller | ||
| 4. Test the configuration before deploying to production | ||
|
|
||
| ## Note for Traefik Users | ||
|
|
||
| Traefik is now fully supported in all environments, including production. The previous restriction limiting Traefik to testing environments has been removed. | ||
|
|
||
| ## Document Server | ||
|
|
||
| The document server implementation has also been unified. It now works with both NGINX and Traefik controllers using the same configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,3 +22,5 @@ | |
| *.tmproj | ||
| .vscode/ | ||
| tests/ | ||
| # Ignore all README.md in all subdirectories | ||
| README.md | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Service-Specific Templates | ||
|
|
||
| This directory contains service-specific templates organized to improve readability, maintainability, and flexibility. | ||
|
|
||
| ## Directory Structure | ||
|
|
||
| ``` | ||
| services/ | ||
| ├── _common.tpl # Limited common helper functions | ||
| ├── ingress.yaml # Single shared ingress for all services | ||
| ├── raster/ # Raster service templates | ||
| │ ├── deployment.yaml # Deployment definition | ||
| │ ├── service.yaml # Service definition | ||
| │ ├── configmap.yaml # ConfigMap definition | ||
| │ └── hpa.yaml # HorizontalPodAutoscaler definition | ||
| ├── stac/ # STAC service templates | ||
| │ ├── deployment.yaml | ||
| │ ├── service.yaml | ||
| │ ├── configmap.yaml | ||
| │ └── hpa.yaml | ||
| ├── vector/ # Vector service templates | ||
| │ ├── deployment.yaml | ||
| │ ├── service.yaml | ||
| │ ├── configmap.yaml | ||
| │ └── hpa.yaml | ||
| └── multidim/ # Multidimensional service templates | ||
| ├── deployment.yaml | ||
| ├── service.yaml | ||
| ├── configmap.yaml | ||
| └── hpa.yaml | ||
| ``` | ||
|
|
||
| ## Common Helpers | ||
|
|
||
| The `_common.tpl` file provides limited helper functions for truly common elements: | ||
|
|
||
| - `eoapi.mountServiceSecrets`: For mounting service secrets | ||
| - `eoapi.commonEnvVars`: For common environment variables like SERVICE_NAME, RELEASE_NAME, GIT_SHA | ||
| - `eoapi.pgstacInitContainers`: For init containers that wait for pgstac jobs | ||
|
|
||
| For database environment variables, we leverage the existing `eoapi.postgresqlEnv` helper from the main `_helpers.tpl` file. | ||
|
|
||
| ## Refactoring Benefits | ||
|
|
||
| 1. **Improved Readability**: Service configurations are explicit and clearly visible | ||
| 2. **Better Maintainability**: Changes to one service don't affect others | ||
| 3. **Enhanced Flexibility**: Each service can evolve independently | ||
| 4. **Easier Debugging**: Errors are isolated to specific service files | ||
| 5. **Safer Changes**: Template modifications can be tested on individual services | ||
|
|
||
| ## Usage | ||
|
|
||
| No changes to `values.yaml` structure were required. The chart maintains full backward compatibility with existing deployments. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| {{/* | ||
| Helper function for mounting service secrets | ||
| Only extract truly common elements that are mechanical and don't need customization | ||
| */}} | ||
| {{- define "eoapi.mountServiceSecrets" -}} | ||
| {{- $service := .service -}} | ||
| {{- $root := .root -}} | ||
| {{- if index $root.Values $service "settings" "envSecrets" }} | ||
| {{- range $secret := index $root.Values $service "settings" "envSecrets" }} | ||
| - secretRef: | ||
| name: {{ $secret }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end -}} | ||
|
|
||
| {{/* | ||
| Helper function for common environment variables | ||
| */}} | ||
| {{- define "eoapi.commonEnvVars" -}} | ||
| {{- $service := .service -}} | ||
| {{- $root := .root -}} | ||
| - name: SERVICE_NAME | ||
| value: {{ $service | quote }} | ||
| - name: RELEASE_NAME | ||
| value: {{ $root.Release.Name | quote }} | ||
| - name: GIT_SHA | ||
| value: {{ $root.Values.gitSha | quote }} | ||
| {{- end -}} | ||
|
|
||
| {{/* | ||
| Helper function for common init containers to wait for pgstac jobs | ||
| */}} | ||
| {{- define "eoapi.pgstacInitContainers" -}} | ||
| {{- if .Values.pgstacBootstrap.enabled }} | ||
| initContainers: | ||
| - name: wait-for-pgstac-jobs | ||
| image: bitnami/kubectl:latest | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - | | ||
| echo "Waiting for pgstac-migrate job to complete..." | ||
| until kubectl get job pgstac-migrate -o jsonpath='{.status.conditions[?(@.type=="Complete")].status}' | grep -q "True"; do | ||
| echo "pgstac-migrate job not complete yet, waiting..." | ||
| sleep 5 | ||
| done | ||
| echo "pgstac-migrate job completed successfully." | ||
|
|
||
| {{- if .Values.pgstacBootstrap.settings.loadSamples }} | ||
| echo "Waiting for pgstac-load-samples job to complete..." | ||
| until kubectl get job pgstac-load-samples -o jsonpath='{.status.conditions[?(@.type=="Complete")].status}' | grep -q "True"; do | ||
| echo "pgstac-load-samples job not complete yet, waiting..." | ||
| sleep 5 | ||
| done | ||
| echo "pgstac-load-samples job completed successfully." | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end -}} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.