Skip to content

Instantly share code, notes, and snippets.

@jwillker
Created May 8, 2022 21:46
Show Gist options
  • Save jwillker/5ac004968aa6db43f357666fada05d72 to your computer and use it in GitHub Desktop.
Save jwillker/5ac004968aa6db43f357666fada05d72 to your computer and use it in GitHub Desktop.
{{- define "generic.fullname" -}}
{{- .Release.Name | trunc 6 -}}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "generic.selectorLabels" -}}
app.kubernetes.io/name: {{ include "generic.fullname" .}}
app.kubernetes.io/instance: '{{ include "generic.fullname" . }}-{{ .Values.app.version }}'
{{- end }}
{{/*
Common labels
'app' and 'version' are duplicated because the
first one is the k8s default format following
https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/#labels
and the second is a requirement for istio works properly.
https://istio.io/latest/docs/ops/deployment/requirements/#pod-requirements
*/}}
{{- define "generic.commonLabels" -}}
{{ include "generic.selectorLabels" . }}
app.kubernetes.io/component: {{ .Values.app.component }}
app.kubernetes.io/version: {{ .Values.app.version | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "generic.chart" . }}
env: {{ .Values.app.env }}
app: {{ include "generic.fullname" .}}
version: {{ .Values.app.version | quote }}
{{- end }}
{{/*
Common annotations
*/}}
{{- define "generic.commonAnnotations" -}}
app/protocol: {{ .Values.app.protocol }}
app/owner: {{ .Values.app.owner }}
app/project: {{ .Values.app.project }}
app/bu: {{ .Values.app.bu }}
app/compliance: {{ .Values.app.compliance }}
{{- end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment