Skip to content

Commit

Permalink
Add option for setting annotations to the pod template (#101)
Browse files Browse the repository at this point in the history
Signed-off-by: Torsten Walter <[email protected]>
  • Loading branch information
TwoStone authored Oct 21, 2020
1 parent 46a857e commit f0b7414
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions charts/jenkins/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Use the following links to reference issues, PRs, and commits prior to v2.6.0.

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.

## 2.14.0

Added support for annotations in podTemplates

## 2.13.2

Add nodeSelector in the backup pod
Expand Down
2 changes: 1 addition & 1 deletion charts/jenkins/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: jenkins
home: https://jenkins.io/
version: 2.13.2
version: 2.14.0
appVersion: lts
description: Open source continuous integration server. It supports multiple SCM tools
including CVS, Subversion and Git. It can execute Apache Ant and Apache Maven-based
Expand Down
1 change: 1 addition & 0 deletions charts/jenkins/VALUES_SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ The following tables list the configurable parameters of the Jenkins chart and t
| `agent.volumes` | Additional volumes | `[]` |
| `agent.yamlTemplate` | The raw yaml of a Pod API Object to merge into the agent spec | Not set |
| `agent.yamlMergeStrategy` | Defines how the raw yaml field gets merged with yaml definitions from inherited pod templates | `override` |
| `agent.annotations` | Annotations to apply to the pod | `{}` |

#### Side Container Configuration
| Parameter | Description | Default |
Expand Down
7 changes: 7 additions & 0 deletions charts/jenkins/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ Returns kubernetes pod template configuration as code
*/}}
{{- define "jenkins.casc.podTemplate" -}}
- name: "{{ .Values.agent.podName }}"
{{- if .Values.agent.annotations }}
annotations:
{{- range $key, $value := .Values.agent.annotations }}
- key: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
containers:
- name: "{{ .Values.agent.sideContainerName }}"
alwaysPullImage: {{ .Values.agent.alwaysPullImage }}
Expand Down
5 changes: 5 additions & 0 deletions charts/jenkins/tests/jcasc-config-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ tests:
defaultMode: "600"
mountPath: /var/myapp/mysecret
secretName: mysecret
annotations:
ci.jenkins-agent/test: "custom"
yamlTemplate: |-
apiVersion: v1
kind: Pod
Expand Down Expand Up @@ -442,6 +444,9 @@ tests:
value: "true"
templates:
- name: "my-agent"
annotations:
- key: ci.jenkins-agent/test
value: "custom"
containers:
- name: "sideContainer"
alwaysPullImage: true
Expand Down
2 changes: 2 additions & 0 deletions charts/jenkins/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,8 @@ agent:
yamlMergeStrategy: "override"
# Timeout in seconds for an agent to be online
slaveConnectTimeout: 100
# Annotations to apply to the pod.
annotations: {}

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

0 comments on commit f0b7414

Please sign in to comment.