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

Commit

Permalink
Add extensible label support on Kibana
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 committed Apr 2, 2020
1 parent e7ed45d commit f9103b3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion kibana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ helm install --name kibana elastic/kibana --set imageTag=7.6.2
| `tolerations` | Configurable [tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) | `[]` |
| `ingress` | Configurable [ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) to expose the Kibana service. See [`values.yaml`](https://github.com/elastic/helm-charts/tree/master/kibana/values.yaml) for an example | `enabled: false` |
| `service` | Configurable [service](https://kubernetes.io/docs/concepts/services-networking/service/) to expose the Kibana service. See [`values.yaml`](https://github.com/elastic/helm-charts/tree/master/kibana/values.yaml) for an example | `type: ClusterIP`<br>`port: 5601`<br>`nodePort:`<br>`annotations: {}`<br>`loadBalancerSourceRanges: {}` |
| `labels` | Configurable [label](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) applied to all Kibana pods | `{}` |
| `labels` | Configurable [label](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) applied to all Kibana resources | `{}` |
| `lifecycle` | Allows you to add lifecycle configuration. See [values.yaml](https://github.com/elastic/helm-charts/tree/master/kibana/values.yaml) for an example of the formatting. | `{}` |
| `fullnameOverride` | Overrides the full name of the resources. If not set the name will default to "`.Release.Name`-`.Values.nameOverride or .Chart.Name`" | `""` |
| `extraContainers` | Templatable string of additional containers to be passed to the `tpl` function | `""` |
Expand Down
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 f9103b3

Please sign in to comment.