You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Álvaro Torres Cogollo
8ffdc81970
feat: New --values-tpl flag with limited template support
Use --values-tpl to dynamically generate values based on previously
merged configuration. Templates have access to .Values with basic
template functions.
This is especially useful when you don't have control over upstream
chart templates and want to avoid forking just to add tpl support.
Templates are rendered after all other value sources (--values, --set)
and have access to the merged .Values context:
```bash
helm install myapp ./chart --values-tpl dynamic.yaml.tpl
helm install myapp ./chart \
--values base.yaml \
--set environment=production \
--values-tpl computed.yaml.tpl
```
```yaml
region: us-east-1
environment: dev
replicas: {{ if eq .Values.environment "production" }}5{{ else }}1{{ end }}
resourceTier: {{ .Values.environment | upper }}
endpoint: "https://{{ .Values.region }}.example.com"
```
1. Chart defaults (`values.yaml`)
2. All `--values` files
3. All `--set*` flags
4. All `--values-tpl` files (rendered with access to steps 1-3)
**Problem:** Each cluster is in a different AWS region/account, and you need
different ECR registries. You want to:
- Avoid committing per-cluster files (values-prod-us.yaml, values-prod-eu.yaml, etc.)
- Not edit upstream chart templates to add tpl support
- Keep ArgoCD unaware of chart-specific paths (image.registry, etc.)
**Solution:** Single template file in git, cluster-specific values via ArgoCD:
```yaml
image:
registry: "{{ .Values.accountId }}.dkr.ecr.{{ .Values.region }}.amazonaws.com"
repository: myapp
tag: "1.0.0"
service:
extraEnvironment: # Arbitrary path in values
CLUSTER_NAME: "{{ .Values.clusterName }}"
```
```yaml
spec:
helm:
parameters:
- name: clusterName
value: prod-us-east
- name: region
value: us-east-1
- name: accountId
value: "123456789"
valueTplFiles:
- values-custom.yaml.tpl
```
```yaml
spec:
helm:
parameters:
- name: clusterName
value: prod-eu-west
- name: region
value: eu-west-1
- name: accountId
value: "987654321"
valueTplFiles:
- values-custom.yaml.tpl
```
- Access to `.Values` from previous merge steps
- Sprig functions: `default`, `upper`, `lower`, `trim`, etc.
- Format functions: `toYaml`, `toJson`, `toToml`, `fromYaml`, `fromJson`, `fromToml`
- Conditionals: `if`/`else`, `range`
- Remote templates: `http://`, `https://`, etc.
- `include` (requires chart template context)
- `tpl` (requires chart template context)
- `lookup` (requires Kubernetes client)
Signed-off-by: Álvaro Torres Cogollo <atorrescogollo@gmail.com>
|
3 weeks ago |
| .. |
|
action
|
pkg/kube: introduce support for custom kstatus readers
|
4 weeks ago |
|
chart
|
Replace reflect.Ptr with reflect.Pointer
|
1 month ago |
|
cli
|
feat: New --values-tpl flag with limited template support
|
3 weeks ago |
|
cmd
|
feat: New --values-tpl flag with limited template support
|
3 weeks ago |
|
downloader
|
chore: fix typo in pkg/downloader/chart_downloader.go
|
2 months ago |
|
engine
|
feat: New --values-tpl flag with limited template support
|
3 weeks ago |
|
gates
|
…
|
|
|
getter
|
fix(getter): pass settings environment variables
|
2 months ago |
|
helmpath
|
…
|
|
|
ignore
|
Enable the sloglint linter
|
2 months ago |
|
kube
|
Merge pull request #31412 from fmuyassarov/devel/rollback
|
4 weeks ago |
|
postrenderer
|
…
|
|
|
provenance
|
…
|
|
|
pusher
|
for all other similar cases
|
3 months ago |
|
registry
|
Merge pull request #31562 from atombrella/feature/modernize
|
2 months ago |
|
release
|
Reproducible chart archive builds
|
3 months ago |
|
repo/v1
|
Fix `TestConcurrencyDownloadIndex` typo
|
2 months ago |
|
storage
|
Enable the sloglint linter
|
2 months ago |
|
strvals
|
Use errors.Is to check for io.EOF and gzip.ErrHeader
|
2 months ago |
|
uploader
|
…
|
|