docs: add helm section on patching resources

This commit is contained in:
Bryton Hall 2023-06-11 23:01:19 -04:00
parent baa1a6c949
commit 6c27c1d52b

View file

@ -1,4 +1,4 @@
To define a helm release, use the {{< option "kubernetes.helm.releases" >}} option.
To define a Helm release, use the {{< option "kubernetes.helm.releases" >}} option.
{{< source "default.nix" >}}
@ -7,3 +7,25 @@ Fetch and render the chart just as we did with plain manifests:
```sh
nix eval -f . --json config.kubernetes.generated
```
## patching
A common issue with Helm charts is the need to template everything under the sun.
Kubenix solves this issue by merging configuration during evaluation.
For example, to patch the deployment created by the release above:
```nix
{
# define a resource with the same name
kubernetes.resources.deployments.nginx = {
# be sure to match the corresponding namespace as well
metadata.namespace = "default";
# here we can configure anything and are no longer bound by `values.yaml`
spec.template.spec.containers.nginx.env = [{
name = "MY_VARIABLE";
value = "100";
}];
};
}
```