Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Patch existing resource using helm

Is it possible to have a helm template that gets applied as in kubectl patch? This would mean that the values provided are merged into the existing resource, rather than overriding the complete resource.

As an example, if there was a resource living in the cluster like:

foo:
  - bar
huu:
  - har

I'd like to only update this partly by patching foo: [bar] with e.g. foo: [pear] on applying the chart without any knowledge regarding the rest of this resource.

Also if this was an antipattern I'd be very thankful to get any hints on how to achieve this without manually running kubectl patch.

like image 381
Busykoala Avatar asked May 18 '26 12:05

Busykoala


1 Answers

Helm needs to know, that this resource is managed by Helm. So you have to adopt the resource by adding labels to it:

labels:
  app.kubernetes.io/managed-by: Helm
  app.kubernetes.io/release-name: your-release

There's also a Helm plugin to adopt existing resources with helm: https://github.com/HamzaZo/helm-adopt

like image 157
Louis Haußknecht Avatar answered May 21 '26 17:05

Louis Haußknecht



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!