I can't seem to figure out whey my nginx template is not using the values file when I pass it with the helm template --debug nginx charts/transport-latency -f charts/transport-latency/values.yaml > .ignore/nginx-out.yaml command.
Output using --debug
install.go:178: [debug] Original chart version: ""
install.go:195: [debug] CHART PATH: /Users/<userName>/src/Repos/helm_charts/charts/transport-latency
Here is the structure of the chart:
charts/transport-latency
├── Chart.lock
├── Chart.yaml
├── charts
│ └── nginx-13.1.0.tgz
├── templates
└── values.yaml
And when I run the above mentioned command I just get the default chart without any modification that should be included in the values.yaml file.
Here is what my values.yaml file looks like:
namespaceOverride: airflow
replicaCount: 2
service:
type: ClusterIP
If it helps here is my Chart.yaml contents:
apiVersion: v2
name: transport-latency
type: application
version: 1.0.0
appVersion: "1.0.0"
dependencies:
- name: nginx
version: 13.1.0
repository: https://charts.bitnami.com/bitnami
If you are referencing a dependent chart (in your case, the nginx chart), then you must nest values for that subchart in its own block with the name of the dependency.
So, since you named the dependency nginx as per your chart.yaml:
apiVersion: v2
name: transport-latency
type: application
version: 1.0.0
appVersion: "1.0.0"
dependencies:
- name: nginx
version: 13.1.0
repository: https://charts.bitnami.com/bitnami
You must therefore nest the values for that chart in a block labelled nginx
values.yaml
nginx:
namespaceOverride: airflow
replicaCount: 2
service:
type: ClusterIP
Using your values.yaml as it is:
namespaceOverride: airflow
replicaCount: 2
service:
type: ClusterIP
Would only provide those to your "root" chart -- which is empty.
Related
I'm looking for insights for the following situation...
I have one ArgoCD application pointing to a Git repo (A), where there's a values.yaml;
I would like to use the Helm templates stored in a different repo (B);
Any suggestions/alternatives on how to make this work?
I think helm dependency can help solve your problem.
In file Chart.yaml of repo (A), declares dependency (chart of repo B)
# Chart.yaml
dependencies:
- name: chartB
version: "0.0.1"
repository: "https://link_to_chart_B"
Link references:
https://github.com/argoproj/argocd-example-apps/tree/master/helm-dependency
P/s: You need add repo chart into ArgoCD.
The way we solved it is by writing a very simple helm plugin
and pass to it the URL where the Helm chart location (chartmuseum in our case) as an env variable
server:
name: server
config:
configManagementPlugins: |
- name: helm-yotpo
generate:
command: ["sh", "-c"]
args: ["helm template --version ${HELM_CHART_VERSION} --repo ${HELM_REPO_URL} --namespace ${NAMESPACE} $HELM_CHART_NAME --name-template=${HELM_RELEASE_NAME} -f $(pwd)/${HELM_VALUES_FILE} "]
you can run the helm command with the flag of --repo
and in the ArgoCD Application yaml you call the new plugin
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: application-test
namespace: infra
spec:
destination:
namespace: infra
server: https://kubernetes.default.svc
project: infra
source:
path: "helm-values-files/telegraf"
repoURL: https://github.com/YotpoLtd/argocd-example.git
targetRevision: HEAD
plugin:
name: helm-yotpo
env:
- name: HELM_RELEASE_NAME
value: "telegraf-test"
- name: HELM_CHART_VERSION
value: "1.8.18"
- name: NAMESPACE
value: "infra"
- name: HELM_REPO_URL
value: "https://helm.influxdata.com/"
- name: HELM_CHART_NAME
value: "telegraf"
- name: HELM_VALUES_FILE
value: "telegraf.yaml"
you can read more about it in the following blog
post
I am trying to install rabbitmq helm chart in dependencies section of my parent chart.
Here is my parent chart
apiVersion: v2
name: mychart
description: A Helm chart to install rabbitmq
type: application
version: 1.0.0
appVersion: "1.0.0"
dependencies:
- name: rabbitmq
repository: https://charts.bitnami.com/bitnami
version: 8.11.9
condition: rabbitmq.enabled
And here is the values.yml file of this chart
rabbitmq:
enabled: true
auth.username: test
auth.password: test
I am trying to override the values of auth.username and auth.password of rabbitmq dependency chart. But values are getting override. And default values are used when I deploy/test this chart.
What am I doing wrong here ?
While the helm install --set option takes options like --set rabbitmq.auth.username=..., and charts' documentation generally uses this syntax, in YAML files you need to put each part in a nested block:
rabbitmq:
enabled: true
auth:
# "username" under "auth", not a single key "auth.username"
username: test
password: test
I am new to Helm and using Helm 3. I am trying to build a simple helm chart which depends on the mongodb helm chart available from bitnami here.
This is the structure of my chart:
mychart
|- charts\
|- mongodb-8.1.1.tgz
|- Chart.yaml
|- values.yaml
I am trying to override the value of mongodb.rootPassword (and some other properties) through the values.yaml file of the parent chart. However, it does not override the value specified and reverts to the default values from the mongodb chart.
It would be a great help to understand what I am doing wrong and how can I override the value of the child chart from the parent chart.
Here are the contents of my files:
Chart.yaml
apiVersion: v2
name: mychart
appVersion: "1.0"
description: mychart has the best description
version: 0.1.0
type: application
dependencies:
- name: mongodb
version: 8.1.1
repository: https://charts.bitnami.com/bitnami
condition: mongodb.enabled
values.yaml
mongodb:
global:
namespaceOverride: production
fullnameOverride: mongo-mychart
useStatefulSet: true
auth:
rootPassword: example
persistence:
size: 100Mi
This is possible in case the format of the values.yaml file has an issue. In this case, the values.yaml file of the parent chart had a few extra encoded characters which were causing it to be ignored by helm and defaulting the child chart's values.
I am new to this group. Glad to have connected.
I am wondering if someone has experience in using an umbrella helm chart in a CI/CD process?
In our project, we have 2 separate developer contractors. Each contractor is responsible for specific microservices.
We are using Harbor as our repository for charts and accompanying container images and GitLab for our code repo and CI/CD orchestrator...via GitLab runners.
The plan is to use an umbrella chart to deploy all approx 60 microservices as one system.
I am interested in hearing from any groups that have taken a similar approach and how they treated/handled the umbrella chart in their CI/CD process.
Thank you for any input/guidance.
VR,
We use similar kind of pattern where we have 30+ microservices.
We have got a Github repo for base-charts.
The base-microservice chart has all sorts of kubernetes templates (like HPA,ConfigMap,Secrets,Deployment,Service,Ingress etc) ,each having the option to be enabled or disabled.
Note- The base chart can even contain other charts too
eg. This base-chart has a dependency of nginx-ingress chart:
apiVersion: v2
name: base-microservice
description: A base helm chart for deploying a microservice in Kubernetes
type: application
version: 0.1.6
appVersion: 1
dependencies:
- name: nginx-ingress
version: "~1.39.1"
repository: "alias:stable"
condition: nginx-ingress.enabled
Below is an example template for secrets.yaml template:
{{- if .Values.secrets.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "base-microservice.fullname" . }}
type: Opaque
data:
{{- toYaml .Values.secrets.data | nindent 2}}
{{- end}}
Now when commit happens in this base-charts repo, as part of CI process, (along with other things) we do
Check if Helm index already exists in charts repository
If exists, then download the existing index and merge currently generated index with existing one -> helm repo index --merge oldindex/index.yaml .
If it does not exist, then we create new Helm index ->( helm repo index . ) Then upload the archived charts and index yaml to our charts repository.
Now in each of our microservice, we have a charts directory , inside which we have 2 files only:
Chart.yaml
values.yaml
Directory structure of a sample microservice:
The Chart.yaml for this microservice A looks like:
apiVersion: v2
name: my-service-A
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: 1
dependencies:
- name: base-microservice
version: "0.1.6"
repository: "alias:azure"
And the values.yaml for this microservice A has those values which need to be overriden for the base-microservice values.
eg.
base-microservice:
nameOverride: my-service-A
image:
repository: myDockerRepo/my-service-A
resources:
limits:
cpu: 1000m
memory: 1024Mi
requests:
cpu: 300m
memory: 500Mi
probe:
initialDelaySeconds: 120
nginx-ingress:
enabled: true
ingress:
enabled: true
Now while doing Continuous Deployment of this microservice, we have these steps (among others):
Fetch helm dependencies (helm dependency update ./charts/my-service-A)
Deploy my release to kubernetes (helm upgrade --install my-service-a ./charts/my-service-A)
My application requires us to be running multiple instances of a database, let's say InfluxDB.
The chart we are writing should allow us to run an arbitrary number of databases, based on the values passed to the chart, so I can't alias a fixed number of times the influxdb chart in the Chart.yaml file.
The way I want to solve this challenge, is by having my main chart main have a range of values that specify the configuration. A quick example of values.yaml
databases:
- type: influxdb
name: influx1
port: 9001
- type: influxdb
name: influx2
port: 9002
I can iterate over this array with range easily, but I'm unsure of how to "call" the dependency chart from the main.yaml file. Arborescence:
main_chart
├── charts
│ └── influxdb-1.2.3.tgz
├── Chart.yaml
├── templates
│ └── main.yaml
└── values.yaml
I tried using {{- include "influxdb" .Values.some_test_config}}, but I get a No template influxdb associated with template gotpl error.
I also went through the Helm docs, but didn't find an answer.
Thanks for following through ! Any thoughts ?
You want to use helm chart dependencies with aliases:
https://helm.sh/docs/topics/charts/#alias-field-in-dependencies
Update your Chart.yaml to include:
dependencies:
- name: influxdb
repository: https://kubernetes-charts.storage.googleapis.com
version: 1.2.3
alias: influx1
- name: influxdb
repository: https://kubernetes-charts.storage.googleapis.com
version: 1.2.3
alias: influx2
Then values.yaml would look like this:
influx1:
port: 9001
<other chart values>
influx2:
port: 9002
<other chart values>