【发布时间】:2019-12-31 14:37:37
【问题描述】:
我有一个伞形图表,它有一个几乎所有子图表部署配置的模板。如何从子图表中获取基本图表版本。
也许一个解决方案是覆盖子图表 chart.yaml 版本,但我也尝试这样做但没有成功。
我在基本图表上尝试了 _helpers.tpl 并在基本图表上的我的 _deployment-config.yaml 上定义
{{- 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 -}}
我期望复杂的版本(7.0.0-snapshot-dev-872),但我得到了子图表版本 0.1.0
【问题讨论】:
标签: charts kubernetes kubernetes-helm