Unverified Commit 356c37c1 authored by Enno Lohmeier's avatar Enno Lohmeier Committed by GitHub

clean up labels for telegraf/telegraf-ds (#102)

parent a8103183
apiVersion: v1 apiVersion: v1
name: telegraf-ds name: telegraf-ds
version: 1.0.11 version: 1.0.12
appVersion: 1.14 appVersion: 1.14
deprecated: false deprecated: false
description: Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics. description: Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics.
......
...@@ -32,6 +32,23 @@ Create chart name and version as used by the chart label. ...@@ -32,6 +32,23 @@ Create chart name and version as used by the chart label.
{{- end -}} {{- end -}}
{{/* {{/*
Common labels
*/}}
{{- define "telegraf.labels" -}}
helm.sh/chart: {{ include "telegraf.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{ include "telegraf.selectorLabels" . }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "telegraf.selectorLabels" -}}
app.kubernetes.io/name: {{ include "telegraf.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
CUSTOM TEMPLATES: This section contains templates that make up the different parts of the telegraf configuration file. CUSTOM TEMPLATES: This section contains templates that make up the different parts of the telegraf configuration file.
- global_tags section - global_tags section
- agent section - agent section
......
...@@ -3,10 +3,7 @@ kind: ConfigMap ...@@ -3,10 +3,7 @@ kind: ConfigMap
metadata: metadata:
name: {{ include "telegraf.fullname" . }} name: {{ include "telegraf.fullname" . }}
labels: labels:
app.kubernetes.io/name: {{ include "telegraf.name" . }} {{- include "telegraf.labels" . | nindent 4 }}
helm.sh/chart: {{ include "telegraf.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data: data:
telegraf.conf: |+ telegraf.conf: |+
{{ template "global_tags" .Values.config.global_tags }} {{ template "global_tags" .Values.config.global_tags }}
......
...@@ -3,9 +3,7 @@ kind: DaemonSet ...@@ -3,9 +3,7 @@ kind: DaemonSet
metadata: metadata:
name: {{ include "telegraf.fullname" . }} name: {{ include "telegraf.fullname" . }}
labels: labels:
app.kubernetes.io/name: {{ include "telegraf.name" . }} {{- include "telegraf.labels" . | nindent 4 }}
helm.sh/chart: {{ include "telegraf.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec: spec:
selector: selector:
matchLabels: matchLabels:
......
...@@ -5,6 +5,7 @@ apiVersion: rbac.authorization.k8s.io/v1 ...@@ -5,6 +5,7 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: influx:stats:viewer name: influx:stats:viewer
labels: labels:
{{- include "telegraf.labels" . | nindent 4 }}
rbac.authorization.k8s.io/aggregate-view-telegraf-stats: "true" rbac.authorization.k8s.io/aggregate-view-telegraf-stats: "true"
rules: rules:
- apiGroups: ["metrics.k8s.io"] - apiGroups: ["metrics.k8s.io"]
......
...@@ -3,6 +3,8 @@ apiVersion: rbac.authorization.k8s.io/v1 ...@@ -3,6 +3,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding
metadata: metadata:
name: influx:telegraf:viewer name: influx:telegraf:viewer
labels:
{{- include "telegraf.labels" . | nindent 4 }}
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: {{ include "telegraf.fullname" . }} name: {{ include "telegraf.fullname" . }}
......
...@@ -4,8 +4,5 @@ kind: ServiceAccount ...@@ -4,8 +4,5 @@ kind: ServiceAccount
metadata: metadata:
name: {{ include "telegraf.serviceAccountName" . }} name: {{ include "telegraf.serviceAccountName" . }}
labels: labels:
app: {{ include "telegraf.name" . }} {{- include "telegraf.labels" . | nindent 4 }}
chart: {{ include "telegraf.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- end }} {{- end }}
apiVersion: v1 apiVersion: v1
name: telegraf name: telegraf
version: 1.7.16 version: 1.7.17
appVersion: 1.14 appVersion: 1.14
deprecated: false deprecated: false
description: Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics. description: Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics.
......
...@@ -32,6 +32,24 @@ Create chart name and version as used by the chart label. ...@@ -32,6 +32,24 @@ Create chart name and version as used by the chart label.
{{- end -}} {{- end -}}
{{/* {{/*
Common labels
*/}}
{{- define "telegraf.labels" -}}
helm.sh/chart: {{ include "telegraf.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{ include "telegraf.selectorLabels" . }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "telegraf.selectorLabels" -}}
app.kubernetes.io/name: {{ include "telegraf.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
CUSTOM TEMPLATES: This section contains templates that make up the different parts of the telegraf configuration file. CUSTOM TEMPLATES: This section contains templates that make up the different parts of the telegraf configuration file.
- global_tags section - global_tags section
- agent section - agent section
......
...@@ -3,10 +3,7 @@ kind: ConfigMap ...@@ -3,10 +3,7 @@ kind: ConfigMap
metadata: metadata:
name: {{ include "telegraf.fullname" . }} name: {{ include "telegraf.fullname" . }}
labels: labels:
app.kubernetes.io/name: {{ include "telegraf.name" . }} {{- include "telegraf.labels" . | nindent 4 }}
helm.sh/chart: {{ include "telegraf.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data: data:
telegraf.conf: |+ telegraf.conf: |+
{{ template "global_tags" .Values.config.global_tags }} {{ template "global_tags" .Values.config.global_tags }}
......
...@@ -3,9 +3,7 @@ kind: Deployment ...@@ -3,9 +3,7 @@ kind: Deployment
metadata: metadata:
name: {{ include "telegraf.fullname" . }} name: {{ include "telegraf.fullname" . }}
labels: labels:
app.kubernetes.io/name: {{ include "telegraf.name" . }} {{- include "telegraf.labels" . | nindent 4 }}
helm.sh/chart: {{ include "telegraf.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec: spec:
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.replicaCount }}
selector: selector:
......
...@@ -8,6 +8,8 @@ kind: Role ...@@ -8,6 +8,8 @@ kind: Role
metadata: metadata:
name: {{ template "telegraf.fullname" . }} name: {{ template "telegraf.fullname" . }}
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels:
{{- include "telegraf.labels" . | nindent 4 }}
rules: rules:
{{ toYaml .Values.rbac.rules | indent 2 }} {{ toYaml .Values.rbac.rules | indent 2 }}
{{- end }} {{- end }}
\ No newline at end of file
...@@ -7,6 +7,8 @@ kind: RoleBinding ...@@ -7,6 +7,8 @@ kind: RoleBinding
{{- end }} {{- end }}
metadata: metadata:
name: {{ template "telegraf.fullname" . }} name: {{ template "telegraf.fullname" . }}
labels:
{{- include "telegraf.labels" . | nindent 4 }}
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: {{ template "telegraf.fullname" . }} name: {{ template "telegraf.fullname" . }}
......
...@@ -4,10 +4,7 @@ kind: Service ...@@ -4,10 +4,7 @@ kind: Service
metadata: metadata:
name: {{ include "telegraf.fullname" . }} name: {{ include "telegraf.fullname" . }}
labels: labels:
app.kubernetes.io/name: {{ include "telegraf.name" . }} {{- include "telegraf.labels" . | nindent 4 }}
helm.sh/chart: {{ include "telegraf.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.service.annotations }} {{- if .Values.service.annotations }}
annotations: annotations:
{{ toYaml .Values.service.annotations | indent 4 }} {{ toYaml .Values.service.annotations | indent 4 }}
...@@ -66,6 +63,5 @@ spec: ...@@ -66,6 +63,5 @@ spec:
{{- end -}} {{- end -}}
{{- end }} {{- end }}
selector: selector:
app.kubernetes.io/name: {{ include "telegraf.name" . }} {{- include "telegraf.selectorLabels" . | nindent 4 }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}} {{- end -}}
...@@ -4,8 +4,5 @@ kind: ServiceAccount ...@@ -4,8 +4,5 @@ kind: ServiceAccount
metadata: metadata:
name: {{ template "telegraf.serviceAccountName" . }} name: {{ template "telegraf.serviceAccountName" . }}
labels: labels:
app: {{ template "telegraf.name" . }} {{- include "telegraf.labels" . | nindent 4 }}
chart: {{ template "telegraf.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- end }} {{- end }}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment