Skip to content

Commit f0b7414

Browse files
authored
Add option for setting annotations to the pod template (#101)
Signed-off-by: Torsten Walter <mail@torstenwalter.de>
1 parent 46a857e commit f0b7414

6 files changed

Lines changed: 20 additions & 1 deletion

File tree

charts/jenkins/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Use the following links to reference issues, PRs, and commits prior to v2.6.0.
1010

1111
The change log until v1.5.7 was auto-generated based on git commits. Those entries include a reference to the git commit to be able to get more details.
1212

13+
## 2.14.0
14+
15+
Added support for annotations in podTemplates
16+
1317
## 2.13.2
1418

1519
Add nodeSelector in the backup pod

charts/jenkins/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
name: jenkins
33
home: https://jenkins.io/
4-
version: 2.13.2
4+
version: 2.14.0
55
appVersion: lts
66
description: Open source continuous integration server. It supports multiple SCM tools
77
including CVS, Subversion and Git. It can execute Apache Ant and Apache Maven-based

charts/jenkins/VALUES_SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ The following tables list the configurable parameters of the Jenkins chart and t
266266
| `agent.volumes` | Additional volumes | `[]` |
267267
| `agent.yamlTemplate` | The raw yaml of a Pod API Object to merge into the agent spec | Not set |
268268
| `agent.yamlMergeStrategy` | Defines how the raw yaml field gets merged with yaml definitions from inherited pod templates | `override` |
269+
| `agent.annotations` | Annotations to apply to the pod | `{}` |
269270

270271
#### Side Container Configuration
271272
| Parameter | Description | Default |

charts/jenkins/templates/_helpers.tpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ Returns kubernetes pod template configuration as code
173173
*/}}
174174
{{- define "jenkins.casc.podTemplate" -}}
175175
- name: "{{ .Values.agent.podName }}"
176+
{{- if .Values.agent.annotations }}
177+
annotations:
178+
{{- range $key, $value := .Values.agent.annotations }}
179+
- key: {{ $key }}
180+
value: {{ $value | quote }}
181+
{{- end }}
182+
{{- end }}
176183
containers:
177184
- name: "{{ .Values.agent.sideContainerName }}"
178185
alwaysPullImage: {{ .Values.agent.alwaysPullImage }}

charts/jenkins/tests/jcasc-config-test.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ tests:
351351
defaultMode: "600"
352352
mountPath: /var/myapp/mysecret
353353
secretName: mysecret
354+
annotations:
355+
ci.jenkins-agent/test: "custom"
354356
yamlTemplate: |-
355357
apiVersion: v1
356358
kind: Pod
@@ -442,6 +444,9 @@ tests:
442444
value: "true"
443445
templates:
444446
- name: "my-agent"
447+
annotations:
448+
- key: ci.jenkins-agent/test
449+
value: "custom"
445450
containers:
446451
- name: "sideContainer"
447452
alwaysPullImage: true

charts/jenkins/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,8 @@ agent:
578578
yamlMergeStrategy: "override"
579579
# Timeout in seconds for an agent to be online
580580
slaveConnectTimeout: 100
581+
# Annotations to apply to the pod.
582+
annotations: {}
581583

582584
# Below is the implementation of custom pod templates for the default configured kubernetes cloud.
583585
# Add a key under podTemplates for each pod template. Each key (prior to | character) is just a label, and can be any value.

0 commit comments

Comments
 (0)