From 7a7564f76b902a51512e29c1445b3370ada4b90a Mon Sep 17 00:00:00 2001 From: Sylwia Brant Date: Wed, 23 Sep 2020 15:25:45 +0200 Subject: [PATCH 1/2] Added labels and annotations to Helm Chart Added configuration option for a user to specify annotations and labels for Jenkins CR and pod. --- chart/jenkins-operator/templates/jenkins.yaml | 8 +++++++- chart/jenkins-operator/values.yaml | 3 +++ website/content/en/docs/Installation/_index.md | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/chart/jenkins-operator/templates/jenkins.yaml b/chart/jenkins-operator/templates/jenkins.yaml index 783d3461a..5713501b0 100644 --- a/chart/jenkins-operator/templates/jenkins.yaml +++ b/chart/jenkins-operator/templates/jenkins.yaml @@ -7,6 +7,9 @@ metadata: {{- with .Values.jenkins.labels }} labels: {{ toYaml . | nindent 4 }} {{- end }} + {{- with .Values.jenkins.annotations }} + annotations: {{ toYaml . | nindent 4 }} + {{- end }} spec: configurationAsCode: configurations: @@ -68,6 +71,9 @@ spec: {{- with .Values.jenkins.labels }} labels: {{ toYaml . | nindent 6 }} {{- end }} + {{- with .Values.jenkins.annotations }} + annotations: {{ toYaml . | nindent 6 }} + {{- end }} {{- with .Values.jenkins.basePlugins }} basePlugins: {{ toYaml . | nindent 4 }} {{- end }} @@ -133,4 +139,4 @@ spec: {{- with .Values.jenkins.seedJobs }} seedJobs: {{- toYaml . | nindent 4 }} {{- end }} -{{- end }} + {{- end }} diff --git a/chart/jenkins-operator/values.yaml b/chart/jenkins-operator/values.yaml index f6a5cceae..ac300b916 100644 --- a/chart/jenkins-operator/values.yaml +++ b/chart/jenkins-operator/values.yaml @@ -23,6 +23,9 @@ jenkins: # labels are injected into metadata labels field labels: {} + # annotations are injected into metadata annotations field + annotations: {} + # image is the name (and tag) of the Jenkins instance # Default: jenkins/jenkins:lts # It's recommended to use LTS (tag: "lts") version diff --git a/website/content/en/docs/Installation/_index.md b/website/content/en/docs/Installation/_index.md index 7d470982c..4786ad19c 100644 --- a/website/content/en/docs/Installation/_index.md +++ b/website/content/en/docs/Installation/_index.md @@ -56,5 +56,11 @@ To install, you need only to type these commands: ```bash $ helm repo add jenkins https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart -$ helm install jenkins/jenkins-operator +$ helm install jenkins/jenkins-operator +``` + +To add custom labels and annotations, you can use `values.yaml` file or pass them into `helm install` command, e.g.: + +```bash +$ helm install jenkins/jenkins-operator --set jenkins.labels.LabelKey=LabelValue,jenkins.annotations.AnnotationKey=AnnotationValue ``` \ No newline at end of file From 7c823a763c1d377c8b123258c69535ddce8b8224 Mon Sep 17 00:00:00 2001 From: Sylwia Brant Date: Mon, 28 Sep 2020 12:47:23 +0200 Subject: [PATCH 2/2] Added labels and annotations to Helm Chart Added configuration option for the user to specify annotations and labels for Jenkins pod via helm. Updated installation guide with information about this feature. --- chart/jenkins-operator/templates/jenkins.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/chart/jenkins-operator/templates/jenkins.yaml b/chart/jenkins-operator/templates/jenkins.yaml index 5713501b0..23abc4976 100644 --- a/chart/jenkins-operator/templates/jenkins.yaml +++ b/chart/jenkins-operator/templates/jenkins.yaml @@ -7,9 +7,6 @@ metadata: {{- with .Values.jenkins.labels }} labels: {{ toYaml . | nindent 4 }} {{- end }} - {{- with .Values.jenkins.annotations }} - annotations: {{ toYaml . | nindent 4 }} - {{- end }} spec: configurationAsCode: configurations: @@ -139,4 +136,4 @@ spec: {{- with .Values.jenkins.seedJobs }} seedJobs: {{- toYaml . | nindent 4 }} {{- end }} - {{- end }} +{{- end }}