From 03696c7e2a43d9f7ef9ca0314f7eef27ce5a78fd Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Fri, 19 Jul 2024 09:59:04 +0200 Subject: [PATCH 1/2] Refactoring labels - Support all Kubernetes recommended labels - Support for additional labels Signed-off-by: Nicolas Lamirault --- charts/openlit/Chart.yaml | 2 +- charts/openlit/templates/_helpers.tpl | 4 ++++ charts/openlit/templates/clickhouse.yml | 16 +++++++++++++++- charts/openlit/templates/client.yaml | 15 ++++++++++++++- charts/openlit/templates/ingress.yml | 4 +++- charts/openlit/values.yaml | 4 ++++ 6 files changed, 41 insertions(+), 4 deletions(-) diff --git a/charts/openlit/Chart.yaml b/charts/openlit/Chart.yaml index 17b77f0..5457b97 100644 --- a/charts/openlit/Chart.yaml +++ b/charts/openlit/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: openlit description: A Helm chart for OpenLIT type: application -version: 1.1.0 +version: 1.2.0 appVersion: 1.2.0 icon: https://avatars.githubusercontent.com/u/149867240?s=200&v=4 diff --git a/charts/openlit/templates/_helpers.tpl b/charts/openlit/templates/_helpers.tpl index b9d057f..9f76b75 100644 --- a/charts/openlit/templates/_helpers.tpl +++ b/charts/openlit/templates/_helpers.tpl @@ -40,6 +40,10 @@ helm.sh/chart: {{ include "openlit.chart" . }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} +app.kubernetes.io/part-of: openlit +{{- if .Values.additionalLabels }} +{{ toYaml .Values.additionalLabels }} +{{- end }} {{- end }} {{/* diff --git a/charts/openlit/templates/clickhouse.yml b/charts/openlit/templates/clickhouse.yml index 0a68e8f..2b03b67 100644 --- a/charts/openlit/templates/clickhouse.yml +++ b/charts/openlit/templates/clickhouse.yml @@ -1,6 +1,10 @@ apiVersion: apps/v1 kind: StatefulSet metadata: + labels: + app: {{ .Release.Name }}-db + {{- include "openlit.labels" . | nindent 4 }} + app.kubernetes.io/component: database name: {{ .Release.Name }}-db namespace: {{ .Release.Namespace }} spec: @@ -9,10 +13,14 @@ spec: selector: matchLabels: app: {{ .Release.Name }}-db + {{- include "openlit.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: database template: metadata: labels: app: {{ .Release.Name }}-db + {{- include "openlit.labels" . | nindent 8 }} + app.kubernetes.io/component: database spec: terminationGracePeriodSeconds: 10 containers: @@ -59,6 +67,10 @@ spec: apiVersion: v1 kind: Service metadata: + labels: + app: {{ .Release.Name }}-db + {{- include "openlit.labels" . | nindent 4 }} + app.kubernetes.io/component: database name: {{ .Release.Name }}-db spec: ports: @@ -70,4 +82,6 @@ spec: name: http type: {{ .Values.clickhouse.service.type }} selector: - app: {{ .Release.Name }}-db \ No newline at end of file + app: {{ .Release.Name }}-db + {{- include "openlit.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: database \ No newline at end of file diff --git a/charts/openlit/templates/client.yaml b/charts/openlit/templates/client.yaml index ccb2129..343b8e0 100644 --- a/charts/openlit/templates/client.yaml +++ b/charts/openlit/templates/client.yaml @@ -5,7 +5,8 @@ metadata: name: openlit-collector-config labels: app: {{ include "openlit.fullname" . }} - component: opentelemetry-collector + {{- include "openlit.labels" . | nindent 4 }} + app.kubernetes.io/component: opentelemetry-collector data: opentelemetry-collector-config: | receivers: @@ -58,6 +59,10 @@ data: apiVersion: apps/v1 kind: StatefulSet metadata: + labels: + app: {{ include "openlit.fullname" . }} + {{- include "openlit.labels" . | nindent 4 }} + app.kubernetes.io/component: openlit name: {{ include "openlit.fullname" . }} namespace: {{ .Release.Namespace }} spec: @@ -66,10 +71,14 @@ spec: selector: matchLabels: app: {{ include "openlit.fullname" . }} + {{- include "openlit.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: openlit template: metadata: labels: app: {{ include "openlit.fullname" . }} + {{- include "openlit.labels" . | nindent 8 }} + app.kubernetes.io/component: openlit spec: containers: - name: openlit @@ -174,6 +183,8 @@ metadata: name: {{ include "openlit.fullname" . }} labels: app: {{ include "openlit.fullname" . }} + {{- include "openlit.labels" . | nindent 4 }} + app.kubernetes.io/component: openlit spec: type: {{ .Values.service.type }} ports: @@ -188,4 +199,6 @@ spec: targetPort: 4318 selector: app: {{ include "openlit.fullname" . }} + {{- include "openlit.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: openlit sessionAffinity: {{ .Values.service.sessionAffinity }} \ No newline at end of file diff --git a/charts/openlit/templates/ingress.yml b/charts/openlit/templates/ingress.yml index 62771cf..da460a1 100644 --- a/charts/openlit/templates/ingress.yml +++ b/charts/openlit/templates/ingress.yml @@ -17,7 +17,9 @@ kind: Ingress metadata: name: {{ $fullName }} labels: - {{- include "test.labels" . | nindent 4 }} + app: {{ include "openlit.fullname" . }} + {{- include "openlit.labels" . | nindent 4 }} + app.kubernetes.io/component: networking {{- with .Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/openlit/values.yaml b/charts/openlit/values.yaml index 27c521c..1072ef0 100644 --- a/charts/openlit/values.yaml +++ b/charts/openlit/values.yaml @@ -3,6 +3,10 @@ nameOverride: "" # Overrides the default fullname for the release. fullnameOverride: "" +# Additional labels to add to all resources. +additionalLabels: {} + # my-label: my-value + # Number of replicas replicaCount: 1 From 75cc4c37ed4155be522f3a14a8c989b5500a9f9e Mon Sep 17 00:00:00 2001 From: patcher9 Date: Sun, 21 Jul 2024 15:40:35 +0530 Subject: [PATCH 2/2] Update charts/openlit/Chart.yaml --- charts/openlit/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/openlit/Chart.yaml b/charts/openlit/Chart.yaml index 5457b97..6d5a1dd 100644 --- a/charts/openlit/Chart.yaml +++ b/charts/openlit/Chart.yaml @@ -3,7 +3,7 @@ name: openlit description: A Helm chart for OpenLIT type: application version: 1.2.0 -appVersion: 1.2.0 +appVersion: 1.6.0 icon: https://avatars.githubusercontent.com/u/149867240?s=200&v=4 maintainers: