feat: add utils for generating metadata

This commit is contained in:
Chi-En Wu
2020-04-15 15:12:37 +08:00
parent a168077551
commit 66727cc7cb
2 changed files with 88 additions and 0 deletions

31
templates/_metadata.tpl Normal file
View File

@ -0,0 +1,31 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Common labels
*/}}
{{- define "common.labels" -}}
helm.sh/chart: {{ include "common.chart" . }}
{{ include "common.selectorLabels" . }}
{{- with .Chart.AppVersion }}
app.kubernetes.io/version: {{ . | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "common.selectorLabels" -}}
app.kubernetes.io/name: {{ include "common.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{- /*
Create a standard metadata header
*/ -}}
{{ define "common.metadata" -}}
metadata:
name: {{ include "common.fullname" . }}
labels:
{{- include "common.labels" . | nindent 4 -}}
{{- end -}}