Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Helm chart] Refactoring labels #325

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions charts/podinfo/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ Common labels
{{- define "podinfo.labels" -}}
helm.sh/chart: {{ include "podinfo.chart" . }}
{{ include "podinfo.selectorLabels" . }}
app.kubernetes.io/instance: podinfo
app.kubernetes.io/part-of: podinfo
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.additionalLabels }}
{{ toYaml .Values.additionalLabels }}
{{- end }}
{{- end }}

{{/*
Expand Down
1 change: 1 addition & 0 deletions charts/podinfo/templates/certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: {{ template "podinfo.fullname" . }}
labels:
{{- include "podinfo.labels" . | nindent 4 }}
app.kubernetes.io/component: certificate
spec:
dnsNames:
{{- range .Values.certificate.dnsNames }}
Expand Down
4 changes: 3 additions & 1 deletion charts/podinfo/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: {{ template "podinfo.fullname" . }}
labels:
{{- include "podinfo.labels" . | nindent 4 }}
app.kubernetes.io/component: application
spec:
{{- if not .Values.hpa.enabled }}
replicas: {{ .Values.replicaCount }}
Expand All @@ -18,7 +19,8 @@ spec:
template:
metadata:
labels:
{{- include "podinfo.selectorLabels" . | nindent 8 }}
{{- include "podinfo.labels" . | nindent 8 }}
app.kubernetes.io/component: application
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "{{ .Values.service.httpPort }}"
Expand Down
3 changes: 2 additions & 1 deletion charts/podinfo/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ kind: HorizontalPodAutoscaler
metadata:
name: {{ template "podinfo.fullname" . }}
labels:
{{- include "podinfo.labels" . | nindent 4 }}
{{- include "podinfo.labels" . | nindent 4 }}
app.kubernetes.io/component: autoscaling
spec:
scaleTargetRef:
apiVersion: apps/v1
Expand Down
1 change: 1 addition & 0 deletions charts/podinfo/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
name: {{ $fullName }}
labels:
{{- include "podinfo.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
{{- with .Values.ingress.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
3 changes: 2 additions & 1 deletion charts/podinfo/templates/linkerd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ kind: ServiceProfile
metadata:
name: {{ template "podinfo.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
labels:
{{- include "podinfo.labels" . | nindent 4 }}
{{- include "podinfo.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
spec:
routes:
- condition:
Expand Down
1 change: 1 addition & 0 deletions charts/podinfo/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: {{ template "podinfo.fullname" . }}
labels:
{{- include "podinfo.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
{{- with .Values.service.annotations }}
annotations:
{{ toYaml . | indent 4 }}
Expand Down
1 change: 1 addition & 0 deletions charts/podinfo/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: {{ template "podinfo.serviceAccountName" . }}
labels:
{{- include "podinfo.labels" . | nindent 4 }}
app.kubernetes.io/component: rbac
{{- with .Values.serviceAccount.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 2 }}
Expand Down
1 change: 1 addition & 0 deletions charts/podinfo/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: {{ template "podinfo.fullname" . }}
labels:
{{- include "podinfo.labels" . | nindent 4 }}
app.kubernetes.io/component: metrics
{{- with .Values.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
4 changes: 4 additions & 0 deletions charts/podinfo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ ui:
message: ""
logo: ""

# -- Labels to be added to all other resources.
additionalLabels: {}
# app: podinfo

# failure conditions
faults:
delay: false
Expand Down