Update helm chart with additional properties - kubernetes

We are using the prometheus operator chart
Currently, Im creating my own values.yaml that im overriding the default values from the chart like
helm install po -f values.yaml stable/prometheus-operator -n po
There is a Grafana properties which I need to modify as the opertor come with grafana properties
https://github.com/helm/charts/blob/master/stable/prometheus-operator/values.yaml#L486
However, I want to modify properties that is not in the values.yaml of the prometheus chart and found here:
https://github.com/helm/charts/blob/master/stable/grafana/values.yaml#L422 (there is a reference on the chart)
My question is assume I want to modify the client_id , what is the recommended way to do it?
https://github.com/helm/charts/blob/master/stable/grafana/values.yaml#L431

You can overwrite the values of dependent charts by using the name of the dependency (which for grafana in the prometheus chart can be found here) as another key within the values.yml.
In thise case, it is just grafana and so to overwrite it in your values.yml, do it like this:
# ... config of the original prometheus chart
# overwrite grafana's yaml by using the dependency name
grafana:
grafana.ini:
auth.github:
client_id: 'what you need to put here'

Related

how to define entrypoint command in dependency helm chart

I have this issue. I need to setup oauth2-proxy in kubernetes via helm, and I need it to use injected vault secret for configuration of proxy. I know that this would be possible by defining
'command' : ['sh', '-c', 'source /vault/secrets/client-secret && '], in some override-values.yaml i would create, but problem is that this helm chart values.yaml file does not provide any keyword like "command" and i am using it as a dependency chart so I cannot directly edit it's manifests.
Is there any way how can I define command for a pod of dependency helm chart even if it does not have command key in values? chart link: https://artifacthub.io/packages/helm/oauth2-proxy/oauth2-proxy if somebody wants to see
I also tried to reference secrets in the configuartion file for the proxy but i got error that i should not provide values like this: client_secret=$(cat /vault/secrets/secret), and many other things

Helm - Override existing configmap or pass contents in

I am working with the Community Prometheus helm charts, and am trying to override the existing configmap without having to install with helm, then do a kubectl apply. I was curious if there is a way to either:
During the helm install set my configmap in place of the one it installs
If not, the chart provides a custom value to set your configurations. This is going to include a lot of lines and I wanted to avoid putting this in the command, so I was wondering what is the best way to to just cat the file out and set it as the value instead.'
If it helps, I am essentially passing a --set rules.custom here and then wanting to fill in the configmap myself. If I can just override the configmap with my own that would be even better.

Update helm chart values for different environments

I have helm charts created for a microservice that I have built and everything is working as expected. Now, I have created a new k8s namespace and I want to try to deploy the same helm charts as my old namespace. Although, I have just one value that I need it different while everything else remain the same.
Do I have to create another values.yaml for the new namespace and copy everything over and update the one field I want updated ? Or is there any other way ? I do not want to use the --set method of passing updates to the command line.
David suggested the right way. You can use different values.yaml where you can specify the namespace you want to deploy the chart:
$ helm install -f another-namespace-values.yaml <my-release> .
It's also entirely possible to launch helm chart with multiple values.
For more reading please check values section of helm docs.

Helm, customicing only certain values

I want to deploy nextcloud with helm and a custom value.yaml file that fits my needs. Do i have to specify all values given from the original value.yaml or is it possible to only change the values needed, Eg if the only thing I want to change is the host adress my file can look like this:
nextlcoud:
host: 192.168.178.10
instead of copying this file and changing only a few values.
As the underlying issue was resolved by the answer of user #Kun Li, I wanted to add some examples when customizing Helm charts as well as some additional reference.
As asked in the question:
Do i have to specify all values given from the original value.yaml or is it possible to only change the values needed
In short you don't need to specify all of the values. You can change only some of them (like the host from your question).
The ways to change the values are following:
Individual parameters passed with --set (such as helm install --set foo=bar ./mychart)
A values file if passed into helm install or helm upgrade with the -f flag (helm install -f myvals.yaml ./mychart)
If this is a subchart, the values.yaml file of a parent chart
The values.yaml file in the chart
You can read more about it by following official Helm documentation:
Helm.sh: Docs: Chart template guide: Values files
A side note!
Above points are set in the order of priority. The first one (--set) will have the highest priority to override the values.
Example
A side note!
This examples assume that you are in the directory of a pulled Helm chart and you are using Helm v3
Using the nextcloud Helm chart used in the question you can set the nextcloud.host value by:
Pulling the Helm chart and editing the values.yaml
Creating additional new-values.yaml to pass it in (the values.yaml from Helm chart will be used regardless with lower priority):
$ helm install NAME . -f new-values.yaml
new-values.yaml
nextcloud:
host: 192.168.0.2
Setting the value with helm install NAME . --set nextcloud.host=192.168.0.2
You can check if the changes were done correctly by either:
$ helm template . - as pointed by user #David Maze
$ helm install NAME . --dry-run --debug
you misspelled the nextcloud to nextlcoud in your value file.

How to add smtp settings to prometheus-operator using helm chart?

I am new to the Kubernetes and especially using helm. I installed the charts and it works fine with default values. I want to the add smtp server setting in the values.yml file for the chart. I am confused on how to inject the values while installing the chart. This is the chart that I am using https://github.com/helm/charts/tree/master/stable/prometheus-operator.
After installing the helm chart with default values I see that there is a deployment called prometheus-operator-grafana which has values GF_SECURITY_ADMIN_USER and GF_SECURITY_ADMIN_PASSWORD but I am not sure where these values are coming from.
Help with how these values work and how to inject them would be appreciated.
The interaction between parent and child chart values is summarize very well in this SO answer: helm overriding Chart and Values yaml from a base template chart
There are two separate grafana chart mechanisms that control such a thing: adminUser and adminPassword or admin.existingSecret along with admin.userKey and admin.passwordkey
Thus, helm ... --set grafana.adminUser=ninja --set grafana.adminPassword=hunter2 will do what you want. The fine manual even says they are using grafana as a subchart, and documents that exact setting as the first value underneath the grafana.enabled setting. Feel free to file an issue with the helm chart to spend the extra characters and document the grafana.adminUser setting, too