(helm) add extraManifests support for custom resources

Add ability to inject custom Kubernetes manifests through the
values.yaml file. This allows users to deploy additional
resources (Deployments, Services, ConfigMaps, etc.) without
modifying the chart templates.

The template supports multiple input formats: list of objects,
map of named objects, and raw YAML strings, providing maximum
flexibility for users.

- Create templates/extra-objects.yaml with flexible rendering
- Add extraManifests parameter in values.yaml with documentation
- Support Helm template variables in injected manifests
- Handle list, map, and string YAML formats automatically
This commit is contained in:
Ghislain LE MEUR
2025-10-20 16:58:44 +02:00
committed by aleb_the_flash
parent 9f9cef7e2a
commit e2fcf7dd2c
2 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
{{- /* Normalize extraObjects to a list, easier to loop over */ -}}
{{- $extraObjects := .Values.extraManifests | default (list) -}}
{{- if kindIs "map" $extraObjects -}}
{{- $extraObjects = values $extraObjects -}}
{{- end -}}
{{- range $extraObjects }}
---
{{- if kindIs "map" . }}
{{- tpl (toYaml .) $ | nindent 0 }}
{{- else if kindIs "string" . }}
{{- tpl . $ | nindent 0 }}
{{- end }}
{{- end }}

View File

@@ -834,3 +834,21 @@ agents:
## @param agents.pdb.enabled Enable pdb on agents
pdb:
enabled: false
## @section Extra Manifests
## @param extraManifests Extra Kubernetes manifests to deploy
## @extra extraManifests[].apiVersion API version of the resource
## @extra extraManifests[].kind Kind of the resource (Deployment, Service, ConfigMap, etc.)
## @extra extraManifests[].metadata Resource metadata
## @extra extraManifests[].spec Resource specification
extraManifests: []
# - apiVersion: v1
# kind: ConfigMap
# metadata:
# name: my-custom-config
# data:
# config.json: |
# {
# "feature": "enabled"
# }