values.yaml
image:
repoprefix: harbor.com/library
repository: nginx
pullPolicy: IfNotPresent
tag: "0.1.1"
---
{{- $image := printf "%s/%s:%s" .Values.image.repoprefix .Values.image.repository .Values.image.tag }}
apiVersion: apps/v1
kind: Deployment
metadata:
#......
template:
#......
spec:
containers:
- name: {{ .Chart.Name }}
image: {{ $image }}
key: a
data:
a:
a: "aaabbb"
b:
b: "2"
[root@k8s-master aaaaaa]# cat templates/cm.yaml
{{- $meta := .Values.data }}
{{ $key := .Values.key }}
apiVersion: v1
kind: ConfigMap
metadata:
name: test
namespace: default
data:
{{- range $k, $v := get $meta $key }}
{{ $k }}: {{ $v }}
{{- end }}
[root@k8s-master aaaaaa]# helm template aa .
---
# Source: aaaaaa/templates/cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: test
namespace: default
data:
a: aaabbb
标签:aaaaaa,常用,image,语法,Values,key,helm,data
From: https://www.cnblogs.com/outsrkem/p/17334420.html