From 5eebfa88db362e71bce38f61d2f35e1ba643b13c Mon Sep 17 00:00:00 2001 From: Hampus Carlsson Date: Wed, 14 Aug 2024 22:16:16 +0200 Subject: [PATCH] Update labels to follow best practices --- .../templates/configmaps/birdnet.yaml | 9 ++++--- .../templates/configurations/microphones.yaml | 9 ++++--- .../templates/deployments/birdnet.yaml | 25 +++++++++++-------- .../templates/deployments/rtsp-clients.yaml | 21 ++++++++++------ .../templates/deployments/rtsp-server.yaml | 21 ++++++++++------ .../templates/ingresses/birdnet.yaml | 11 ++++---- charts/birdnet-go/templates/pvcs/birdnet.yaml | 11 ++++---- .../templates/services/birdnet.yaml | 15 ++++++----- .../templates/services/rtsp-server.yaml | 13 ++++++---- 9 files changed, 79 insertions(+), 56 deletions(-) diff --git a/charts/birdnet-go/templates/configmaps/birdnet.yaml b/charts/birdnet-go/templates/configmaps/birdnet.yaml index ab6d2e5..64fd6fc 100644 --- a/charts/birdnet-go/templates/configmaps/birdnet.yaml +++ b/charts/birdnet-go/templates/configmaps/birdnet.yaml @@ -3,10 +3,11 @@ kind: ConfigMap metadata: name: {{ template "birdnet-go.fullname" . }}-birdnet labels: - app: {{ template "birdnet-go.name" . }} - chart: {{ template "birdnet-go.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + helm.sh/chart: {{ template "birdnet-go.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: birdnet-go data: config.yaml: | {{- range .Values.birdnet.config }} diff --git a/charts/birdnet-go/templates/configurations/microphones.yaml b/charts/birdnet-go/templates/configurations/microphones.yaml index d415a1d..6c1cdcb 100644 --- a/charts/birdnet-go/templates/configurations/microphones.yaml +++ b/charts/birdnet-go/templates/configurations/microphones.yaml @@ -4,10 +4,11 @@ kind: Configuration metadata: name: {{ template "birdnet-go.fullname" $ }}-mic-{{ $microphone.name }} labels: - app: {{ template "birdnet-go.name" $ }} - chart: {{ template "birdnet-go.chart" $ }} - release: {{ $.Release.Name }} - heritage: {{ $.Release.Service }} + app.kubernetes.io/name: {{ template "birdnet-go.name" $ }} + helm.sh/chart: {{ template "birdnet-go.chart" $ }} + app.kubernetes.io/instance: {{ $.Release.Name }} + app.kubernetes.io/managed-by: {{ $.Release.Service }} + app.kubernetes.io/component: rtsp-client spec: capacity: 1 discoveryHandler: diff --git a/charts/birdnet-go/templates/deployments/birdnet.yaml b/charts/birdnet-go/templates/deployments/birdnet.yaml index bed4479..d53462e 100644 --- a/charts/birdnet-go/templates/deployments/birdnet.yaml +++ b/charts/birdnet-go/templates/deployments/birdnet.yaml @@ -1,23 +1,28 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ template "birdnet-go.fullname" . }}-birdnet + name: {{ template "birdnet-go.fullname" . }}-birdnet-go labels: - app: {{ template "birdnet-go.name" . }} - chart: {{ template "birdnet-go.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + helm.sh/chart: {{ template "birdnet-go.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: birdnet-go spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: - app: {{ template "birdnet-go.name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: birdnet-go template: metadata: labels: - app: {{ template "birdnet-go.name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + helm.sh/chart: {{ template "birdnet-go.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: birdnet-go spec: containers: - image: {{ .Values.birdnet.image }} @@ -61,4 +66,4 @@ spec: {{- end }} - name: config configMap: - name: {{ template "birdnet-go.fullname" . }}-birdnet + name: {{ template "birdnet-go.fullname" . }}-birdnet-go diff --git a/charts/birdnet-go/templates/deployments/rtsp-clients.yaml b/charts/birdnet-go/templates/deployments/rtsp-clients.yaml index 407bce9..16f39bc 100644 --- a/charts/birdnet-go/templates/deployments/rtsp-clients.yaml +++ b/charts/birdnet-go/templates/deployments/rtsp-clients.yaml @@ -4,24 +4,29 @@ kind: Deployment metadata: name: {{ template "birdnet-go.fullname" $ }}-rtsp-client-{{ $microphone.name }} labels: - app: {{ template "birdnet-go.name" $ }} - chart: {{ template "birdnet-go.chart" $ }} - release: {{ $.Release.Name }} - heritage: {{ $.Release.Service }} + app.kubernetes.io/name: {{ template "birdnet-go.name" $ }} + helm.sh/chart: {{ template "birdnet-go.chart" $ }} + app.kubernetes.io/instance: {{ $.Release.Name }} + app.kubernetes.io/managed-by: {{ $.Release.Service }} + app.kubernetes.io/component: rtsp-client spec: replicas: {{ $.Values.replicaCount }} strategy: type: Recreate # Needed for akri since bound to single USB device selector: matchLabels: - app: {{ template "birdnet-go.name" $ }} - release: {{ $.Release.Name }} + app.kubernetes.io/name: {{ template "birdnet-go.name" $ }} + app.kubernetes.io/instance: {{ $.Release.Name }} + app.kubernetes.io/component: rtsp-client microphone: {{ $microphone.name }} template: metadata: labels: - app: {{ template "birdnet-go.name" $ }} - release: {{ $.Release.Name }} + app.kubernetes.io/name: {{ template "birdnet-go.name" $ }} + helm.sh/chart: {{ template "birdnet-go.chart" $ }} + app.kubernetes.io/instance: {{ $.Release.Name }} + app.kubernetes.io/managed-by: {{ $.Release.Service }} + app.kubernetes.io/component: rtsp-client microphone: {{ $microphone.name }} spec: containers: diff --git a/charts/birdnet-go/templates/deployments/rtsp-server.yaml b/charts/birdnet-go/templates/deployments/rtsp-server.yaml index d4bffef..cdc46fb 100644 --- a/charts/birdnet-go/templates/deployments/rtsp-server.yaml +++ b/charts/birdnet-go/templates/deployments/rtsp-server.yaml @@ -3,21 +3,26 @@ kind: Deployment metadata: name: {{ template "birdnet-go.fullname" . }}-rtsp-server labels: - app: {{ template "birdnet-go.name" . }}-rtsp-server - chart: {{ template "birdnet-go.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + helm.sh/chart: {{ template "birdnet-go.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: rtsp-server spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: - app: {{ template "birdnet-go.name" . }}-rtsp-server - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: rtsp-server template: metadata: labels: - app: {{ template "birdnet-go.name" . }}-rtsp-server - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + helm.sh/chart: {{ template "birdnet-go.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: rtsp-server spec: containers: - image: {{ .Values.rtsp.server.image }} diff --git a/charts/birdnet-go/templates/ingresses/birdnet.yaml b/charts/birdnet-go/templates/ingresses/birdnet.yaml index beab6ff..056d573 100644 --- a/charts/birdnet-go/templates/ingresses/birdnet.yaml +++ b/charts/birdnet-go/templates/ingresses/birdnet.yaml @@ -5,10 +5,11 @@ kind: Ingress metadata: name: {{ template "birdnet-go.fullname" . }}-birdnet labels: - app: {{ template "birdnet-go.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + helm.sh/chart: {{ template "birdnet-go.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: birdnet-go {{- with .Values.birdnet.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -30,7 +31,7 @@ spec: pathType: ImplementationSpecific backend: service: - name: {{ template "birdnet-go.name" . }} + name: {{ template "birdnet-go.name" . }}-birdnet-go port: name: http {{- end }} diff --git a/charts/birdnet-go/templates/pvcs/birdnet.yaml b/charts/birdnet-go/templates/pvcs/birdnet.yaml index 45180bc..4bbf586 100644 --- a/charts/birdnet-go/templates/pvcs/birdnet.yaml +++ b/charts/birdnet-go/templates/pvcs/birdnet.yaml @@ -8,12 +8,11 @@ metadata: {{ toYaml .Values.birdnet.persistentVolumeClaim.annotations | indent 4 }} {{- end }} labels: - app: {{ template "birdnet-go.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - component: "{{ .Values.birdnet.persistentVolumeClaim.name }}" - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - name: {{ template "birdnet-go.fullname" . }} + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + helm.sh/chart: {{ template "birdnet-go.chart" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + name: {{ template "birdnet-go.fullname" . }}-birdnet-go spec: accessModes: {{ toYaml .Values.birdnet.persistentVolumeClaim.accessModes | indent 4 }} diff --git a/charts/birdnet-go/templates/services/birdnet.yaml b/charts/birdnet-go/templates/services/birdnet.yaml index 01692bd..66d4e23 100644 --- a/charts/birdnet-go/templates/services/birdnet.yaml +++ b/charts/birdnet-go/templates/services/birdnet.yaml @@ -1,16 +1,19 @@ apiVersion: v1 kind: Service metadata: - name: {{ template "birdnet-go.fullname" . }}-birdnet + name: {{ template "birdnet-go.fullname" . }}-birdnet-go labels: - app: {{ template "birdnet-go.name" . }} - chart: {{ template "birdnet-go.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + helm.sh/chart: {{ template "birdnet-go.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: birdnet-go spec: type: ClusterIP selector: - app: {{ template "birdnet-go.name" . }}-birdnet + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: birdnet-go ports: - name: http protocol: TCP diff --git a/charts/birdnet-go/templates/services/rtsp-server.yaml b/charts/birdnet-go/templates/services/rtsp-server.yaml index 467d0c1..11de93e 100644 --- a/charts/birdnet-go/templates/services/rtsp-server.yaml +++ b/charts/birdnet-go/templates/services/rtsp-server.yaml @@ -3,14 +3,17 @@ kind: Service metadata: name: {{ template "birdnet-go.fullname" . }}-rtsp-server labels: - app: {{ template "birdnet-go.name" . }}-rtsp-server - chart: {{ template "birdnet-go.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + helm.sh/chart: {{ template "birdnet-go.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: rtsp-server spec: type: ClusterIP selector: - app: {{ template "birdnet-go.name" . }}-rtsp-server + app.kubernetes.io/name: {{ template "birdnet-go.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: rtsp-server ports: - name: rtsp protocol: TCP