I have an umbrella chart, it has a template for almost all subcharts deploymentConfig. how do i get the base chart version from the subchart.
maybe a solution will be to overwrite sub charts chart.yaml version but i tried to do that too without success.
i tried _helpers.tpl on the base chart and to define on my _deployment-config.yaml on base chart
{{- define "bitcore.deployment" -}}
{{- $common := dict "Values" .Values.bitcore -}}
{{- $noCommon := omit .Values "bitcore" -}}
{{- $overrides := dict "Values" $noCommon -}}
{{- $noValues := omit . "Values" -}}
{{- with merge $noValues $overrides $common -}}
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
labels:
app: ## here i need base chart version ##
name: {{ .Chart.Name }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
app: {{ .Chart.Name }}
deploymentconfig: {{ .Chart.Name }}
strategy:
activeDeadlineSeconds: 21600
recreateParams:
timeoutSeconds: 600
resources: {}
type: Recreate
template:
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
labels:
app: {{ .Chart.Name }}
deploymentconfig: {{ .Chart.Name }}
test: required
spec:
containers:
- image: "{{ .Values.image.repository }}:xy"
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
env:
- name: BIT_CORE_RUNTIME_PROFILE
value: '{{ required "Please provide runtime profile" .Values.global.runtimeProfile }}'
- name: JAVA_OPTS
value: '{{ required "Please provide Java Ops." .Values.global.javaOpts }}'
livenessProbe:
httpGet:
path: management/health
port: 1489
initialDelaySeconds: 30
periodSeconds: 60
timeoutSeconds: 10
successThreshold: 1
failureThreshold: 10
name: {{ .Chart.Name }}
ports:
- containerPort: 1480
protocol: TCP
readinessProbe:
httpGet:
path: management/health
port: 1489
initialDelaySeconds: 10
timeoutSeconds: 10
periodSeconds: 60
successThreshold: 1
failureThreshold: 10
resources:
{{- toYaml .Values.global.resources | nindent 12 }}
volumeMounts:
- mountPath: /logs
name: {{ .Chart.Name }}-volume-1
terminationMessagePath: /dev/termination-log
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: {{ .Chart.Name }}-volume-1
emptyDir: {}
test: false
{{- end -}}
{{- end -}}
i excpected complicated version(7.0.0-snapshot-dev-872), but i got the subchart version 0.1.0
I don't think you can access the .Chart
of the superchart, anywhere, anyhow. After all, the subcharts are supposed to still be able to work as stand-alone.
The best you can do with helm 2 is to put the version in the .Values.global
section.
In helm 2, you have to write it to the top-level values.yaml
in the script that generates the version, because you can't have any code there. I believe in helm 3 it should be possible to generate values by script.
You can simply define version values for the subcharts in the values.yaml file inside the main chart.
In my view there is no point to create multiple subchart with the same version, you can simply run them as ordinary charts. The main goal of Umbrella charts is to deploy more/large scale application with a lots of params - more often different. So if your subcharts have similar params like for eg. the same version, try to deploy them separately.
Useful documentation: subcharts, charts-subcharts.
Useful article: helm.