From 1430688e73e5a67606b0171515358ed18caf36a4 Mon Sep 17 00:00:00 2001 From: Gagan H R Date: Fri, 21 Nov 2025 23:32:25 +0530 Subject: [PATCH] feat: adds common label support to the helm chart Signed-off-by: Gagan H R --- charts/artifact-hub/Chart.yaml | 2 +- charts/artifact-hub/templates/_helpers.tpl | 3 +++ charts/artifact-hub/templates/hub_deployment.yaml | 3 +++ charts/artifact-hub/templates/trivy_deployment.yaml | 3 +++ charts/artifact-hub/values.schema.json | 6 ++++++ charts/artifact-hub/values.yaml | 3 +++ 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/charts/artifact-hub/Chart.yaml b/charts/artifact-hub/Chart.yaml index a1a7ca1652..c5cf6e300e 100644 --- a/charts/artifact-hub/Chart.yaml +++ b/charts/artifact-hub/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: artifact-hub description: Artifact Hub is a web-based application that enables finding, installing, and publishing Cloud Native packages. type: application -version: 1.22.1-0 +version: 1.22.1-1 appVersion: 1.22.0 kubeVersion: ">= 1.19.0-0" home: https://artifacthub.io diff --git a/charts/artifact-hub/templates/_helpers.tpl b/charts/artifact-hub/templates/_helpers.tpl index 77d20912ab..3f6c4767c8 100644 --- a/charts/artifact-hub/templates/_helpers.tpl +++ b/charts/artifact-hub/templates/_helpers.tpl @@ -41,6 +41,9 @@ helm.sh/chart: {{ include "chart.chart" . }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- with .Values.commonLabels }} +{{ toYaml . }} +{{- end }} {{- end -}} {{/* diff --git a/charts/artifact-hub/templates/hub_deployment.yaml b/charts/artifact-hub/templates/hub_deployment.yaml index a633717123..9c687322bb 100644 --- a/charts/artifact-hub/templates/hub_deployment.yaml +++ b/charts/artifact-hub/templates/hub_deployment.yaml @@ -23,6 +23,9 @@ spec: labels: app.kubernetes.io/component: hub {{- include "chart.selectorLabels" . | nindent 8 }} + {{- with .Values.commonLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.hub.deploy.extraPodLabels }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/artifact-hub/templates/trivy_deployment.yaml b/charts/artifact-hub/templates/trivy_deployment.yaml index d8687a7ad5..1dd92e9aec 100644 --- a/charts/artifact-hub/templates/trivy_deployment.yaml +++ b/charts/artifact-hub/templates/trivy_deployment.yaml @@ -22,6 +22,9 @@ spec: labels: app.kubernetes.io/component: trivy {{- include "chart.selectorLabels" . | nindent 8 }} + {{- with .Values.commonLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.trivy.deploy.extraPodLabels }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/artifact-hub/values.schema.json b/charts/artifact-hub/values.schema.json index fa09fbfeb3..bdd07cd172 100644 --- a/charts/artifact-hub/values.schema.json +++ b/charts/artifact-hub/values.schema.json @@ -3,6 +3,12 @@ "title": "Artifact Hub Chart JSON Schema", "type": "object", "properties": { + "commonLabels": { + "title": "Common labels", + "description": "Labels to add to all kubernetes resources provisioned by the helm chart", + "type": "object", + "default": {} + }, "creds": { "type": "object", "properties": { diff --git a/charts/artifact-hub/values.yaml b/charts/artifact-hub/values.yaml index 3a9433e47c..8beeb5f059 100644 --- a/charts/artifact-hub/values.yaml +++ b/charts/artifact-hub/values.yaml @@ -1,5 +1,8 @@ # Artifact Hub Chart default configuration values +# Common labels to add to all resources +commonLabels: {} + imagePullSecrets: [] imageTag: "" nameOverride: ""