Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
[kibana] Add extensible label support (#555)
Browse files Browse the repository at this point in the history
Common labels were moved to helpers template to have only one source of truth of common/added labels shared between all Kibana resources.

Also, this extends the capability to add a custom label and this will be common between all the resources.
  • Loading branch information
ramrodo authored May 29, 2020
1 parent 4ece77d commit 41cf8fc
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
12 changes: 12 additions & 0 deletions kibana/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@ Return the appropriate apiVersion for ingress.
{{- print "networking.k8s.io/v1beta1" -}}
{{- end -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "kibana.labels" -}}
app: {{ .Chart.Name }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service }}
{{- if .Values.labels }}
{{ toYaml .Values.labels }}
{{- end }}
{{- end -}}
4 changes: 1 addition & 3 deletions kibana/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "kibana.fullname" . }}-config
labels:
app: {{ .Chart.Name }}
release: {{ .Release.Name | quote }}
labels: {{ include "kibana.labels" . | nindent 4 }}
data:
{{- range $path, $config := .Values.kibanaConfig }}
{{ $path }}: |
Expand Down
7 changes: 1 addition & 6 deletions kibana/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "kibana.fullname" . }}
labels:
app: {{ .Chart.Name }}
release: {{ .Release.Name | quote }}
{{- range $key, $value := .Values.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
labels: {{ include "kibana.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
strategy:
Expand Down
5 changes: 1 addition & 4 deletions kibana/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ apiVersion: {{ template "kibana.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app: {{ .Chart.Name }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
labels: {{ include "kibana.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
Expand Down
5 changes: 1 addition & 4 deletions kibana/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "kibana.fullname" . }}
labels:
app: {{ .Chart.Name }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service }}
labels: {{ include "kibana.labels" . | nindent 4 }}
{{- if .Values.service.labels }}
{{ toYaml .Values.service.labels | indent 4}}
{{- end }}
Expand Down

0 comments on commit 41cf8fc

Please sign in to comment.