|
|
@ -257,6 +257,83 @@ The definition of the listed keys is as follows:
|
|
|
|
You can read more about the available formats and limitations in
|
|
|
|
You can read more about the available formats and limitations in
|
|
|
|
the [Helm documentation](https://helm.sh/docs/intro/using_helm/#the-format-and-limitations-of---set).
|
|
|
|
the [Helm documentation](https://helm.sh/docs/intro/using_helm/#the-format-and-limitations-of---set).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Refer to values in `ConfigMaps` generated with Kustomize
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
It is possible to use Kustomize [ConfigMap generator](https://kubectl.docs.kubernetes.io/references/kustomize/configmapgenerator/)
|
|
|
|
|
|
|
|
to trigger a Helm release upgrade every time the encoded values change.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
First create a `kustomizeconfig.yaml` for Kustomize to be able to patch
|
|
|
|
|
|
|
|
`ConfigMaps` referenced in `HelmRelease` manifests:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
|
|
|
nameReference:
|
|
|
|
|
|
|
|
- kind: ConfigMap
|
|
|
|
|
|
|
|
version: v1
|
|
|
|
|
|
|
|
fieldSpecs:
|
|
|
|
|
|
|
|
- path: spec/valuesFrom/name
|
|
|
|
|
|
|
|
kind: HelmRelease
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Create a `HelmRelease` definition that references a `ConfigMap`:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
|
|
|
apiVersion: helm.toolkit.fluxcd.io/v2beta1
|
|
|
|
|
|
|
|
kind: HelmRelease
|
|
|
|
|
|
|
|
metadata:
|
|
|
|
|
|
|
|
name: podinfo
|
|
|
|
|
|
|
|
namespace: podinfo
|
|
|
|
|
|
|
|
spec:
|
|
|
|
|
|
|
|
interval: 5m
|
|
|
|
|
|
|
|
releaseName: podinfo
|
|
|
|
|
|
|
|
chart:
|
|
|
|
|
|
|
|
spec:
|
|
|
|
|
|
|
|
chart: podinfo
|
|
|
|
|
|
|
|
sourceRef:
|
|
|
|
|
|
|
|
kind: HelmRepository
|
|
|
|
|
|
|
|
name: podinfo
|
|
|
|
|
|
|
|
valuesFrom:
|
|
|
|
|
|
|
|
- kind: ConfigMap
|
|
|
|
|
|
|
|
name: podinfo-values
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Create a `kustomization.yaml` that generates the `ConfigMap` using our kustomize config:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
|
|
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
|
|
|
|
|
|
kind: Kustomization
|
|
|
|
|
|
|
|
namespace: podinfo
|
|
|
|
|
|
|
|
resources:
|
|
|
|
|
|
|
|
- namespace.yaml
|
|
|
|
|
|
|
|
- repository.yaml
|
|
|
|
|
|
|
|
- release.yaml
|
|
|
|
|
|
|
|
configMapGenerator:
|
|
|
|
|
|
|
|
- name: podinfo-values
|
|
|
|
|
|
|
|
files:
|
|
|
|
|
|
|
|
- values.yaml=my-values.yaml
|
|
|
|
|
|
|
|
configurations:
|
|
|
|
|
|
|
|
- kustomizeconfig.yaml
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
When [kustomize-controller](../components/kustomize/controller.md) reconciles the above manifests, it will generate
|
|
|
|
|
|
|
|
a unique name of the `ConfigMap` every time `my-values.yaml` content is updated in Git:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
|
|
|
apiVersion: helm.toolkit.fluxcd.io/v2beta1
|
|
|
|
|
|
|
|
kind: HelmRelease
|
|
|
|
|
|
|
|
metadata:
|
|
|
|
|
|
|
|
name: podinfo
|
|
|
|
|
|
|
|
namespace: podinfo
|
|
|
|
|
|
|
|
spec:
|
|
|
|
|
|
|
|
valuesFrom:
|
|
|
|
|
|
|
|
- kind: ConfigMap
|
|
|
|
|
|
|
|
name: podinfo-values-2mh2t8m94h
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!!! hint "Note"
|
|
|
|
|
|
|
|
Stale `ConfigMaps`, previously generated by Kustomize, will be
|
|
|
|
|
|
|
|
removed from the cluster by kustomize-controller if
|
|
|
|
|
|
|
|
[pruning](../components/kustomize/kustomization/#garbage-collection) is enabled.
|
|
|
|
|
|
|
|
|
|
|
|
## Refer to values inside the chart
|
|
|
|
## Refer to values inside the chart
|
|
|
|
|
|
|
|
|
|
|
|
It is possible to replace the `values.yaml` with a different file present inside the Helm chart.
|
|
|
|
It is possible to replace the `values.yaml` with a different file present inside the Helm chart.
|
|
|
|