I have 3 helm charts. I would like to deploy either two or one based on a condition. global.useFirstChart is a boolean variable.
- name: first-chart
version: 0.1.0
condition: charts.useFirstChart
- name: second-chart
version: 0.1.0
condition: not charts.useFirstChart
- name: third-chart
version: 0.1.0
condition: not global.useFirstChart
However when we tried using this chart, if useFirstChart equals true it deploys all three, if it equals false, it deploys second-chart and third-chart (like expected).
I used 'not' to negate the boolean value, but it doesn't work.
Also we're suspecting the value is string not bool because we set it from Terraform.
is there a way to negate the bool value in helm ?
is there a workaround to deploy specific charts and not others ?
Due to security concerns, I can't keep the credentials in values.yaml in the CI/CD system. I'm trying to pass the credentials directly to the helm using --set argument instead. The application requires some of its configs to be in nested formats as shown below.
https://github.com/StackStorm/stackstorm-k8s/blob/master/values.yaml#L67
https://github.com/StackStorm/stackstorm-k8s/blob/master/values.yaml#L89
I'm unable to find a better way to pass these variables to helm during install/upgrade.
configs:
core.yaml: |
---
name: "CoreName"
value: "CoreValue"
element1.yaml: |
---
element_url: "https://example.com/element/"
invit_invite: "var1,var2,var3"
element_token: "elementtokenhere"
element_labels:
name: "value"
type: "value"
element2.yaml: |
---
name: "name"
type: "value"
Is there a better way to handle this within helm arguments before I look for options to change the chart itself?
I am using helm 3 with k8s, with two siblings charts on root folder: <my-folder>/<chart-1> and <my-folder>/<chart-2>.
The kubectl version:
Client Version: version.Info{Major:"1", Minor:"21",
GitVersion:"v1.21.6",
GitCommit:"d921bc6d1810da51177fbd0ed61dc811c5228097",
GitTreeState:"clean", BuildDate:"2021-10-27T17:50:34Z",
GoVersion:"go1.16.9", Compiler:"gc", Platform:"linux/amd64"} Server
Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.6",
GitCommit:"d921bc6d1810da51177fbd0ed61dc811c5228097",
GitTreeState:"clean", BuildDate:"2021-10-27T17:44:26Z",
GoVersion:"go1.16.9", Compiler:"gc", Platform:"linux/amd64"}
Helm version:
version.BuildInfo{Version:"v3.3.4",
GitCommit:"a61ce5633af99708171414353ed49547cf05013d",
GitTreeState:"clean", GoVersion:"go1.14.9"}
I have some common data that is used for both charts.
I want to use common data for both of the charts, event they do do not participate the same folders.
In yaml files something like:
`{{ include from specific common directory + file }}
In values.yaml file I need to add a dynamic variable, that is used in different attributes.
i.e. in the file:
mybasevar: "text"
myvariable: {{mybasevar}}-test
myvalue: {{ myvariable }}-tag1
myvalue2: {{ myvariable }}-tag2
In general, I didn't see an option for variables in yaml (maybe some Go-Lang code, or maybe this is basic on yaml files).
How can I the above?
Thanks.
After reading your message carefully and trying to understand what you want to achieve, I would advice to use Helm Subcharts and Global Values
Let me explain. You could create your Chart (parent) which contains componentA and componentB as subcharts. In the Chart.yaml of the parent chart, you would define the next dependencies:
dependencies:
- name: componentA
version: "0.0.1"
repository: "file://../componentA"
condition: componentA.enabled
- name: componentB
version: "0.0.1"
repository: "file://../componentB"
condition: componentB .enabled
At this point, you can deploy both components as a whole by using
helm install test parent/
Going back to your specific case:
I have some common data that is used for both charts.
Then, define it as global in the values.yaml of the parent chart. For example,
autoscaling:
enabled: false
In values.yaml file I need to add a dynamic variable, that is used in different attributes.
In this case, add the name of the component in the values.yaml of the parent in the next way:
componentA:
service:
port: 80
componentB:
service:
port: 90
At this point, the variables will be dynamically filled in the subchart level. I think this approach would cover your needs nicely.
I want to know how multiple values files are applied in helmsman.
I have something like below in helmsman dsf file.I want to know whether values-common.yaml will be applied first and then values-dev.yaml so the common values will be overridden by dev values file? Or the order does not matter and it just gets merged .If there is a conflict like commons values has enabled:false,and dev values contains enabled:true,which one will be picked up?
prometheus-msteams:
enabled: true
group: infra
namespace: kube-system
chart: prometheus-msteams/prometheus-msteams
version: 0.4.3
valuesFiles:
- config/prometheus-msteams/values-common.yaml
- config/prometheus-msteams/values-dev.yaml
priority: -450
I installed Jenkins (https://github.com/helm/charts/tree/master/stable/jenkins) Helm Chart as a requirement in my own chart.
I'm trying to add the the sonarGlobalConfiguration to the installation:
unclassified:
sonarGlobalConfiguration:
installations:
- name: sonar
serverUrl: 'http://sonar.local.host'
This code works fine with docker, but not with the Jenkins Chart, any idea under which tag i can add it?
Any help would be awesome!
This solved it:
JCasC:
enabled: true
defaultConfig: true
configScripts:
globalConfig: |
unclassified:
sonarGlobalConfiguration:
buildWrapperEnabled: true
installations:
- name: "sonar"
serverUrl: "http://delivery-pipeline-sonarqube:9000"