mirror of
https://github.com/helm/charts.git
synced 2026-08-21 05:17:23 +00:00
[stable/jenkins] Add support for custom pod templates (#21671)
* [stable/jenkins] Add support for custom pod templates Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com> * [stable/jenkins] change value name to agent.podTemplates Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com> * [stable/jenkins] change value name to agent.podTemplates Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>
This commit is contained in:
@@ -5,6 +5,10 @@ numbering uses [semantic versioning](http://semver.org).
|
||||
|
||||
NOTE: The change log until version 1.5.7 is auto generated based on git commits. Those include a reference to the git commit to be able to get more details.
|
||||
|
||||
## 1.11.0 Add support for configuring custom pod templates
|
||||
|
||||
Add `agent.podTemplates` option for declaring custom pod templates in the default configured kubernetes cloud.
|
||||
|
||||
## 1.10.1 Only copy JCasC files if there are any
|
||||
|
||||
The chart always tried to copy Configuration as Code configs even if there are none. That resulted in an error which is resolved with this.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apiVersion: v1
|
||||
name: jenkins
|
||||
home: https://jenkins.io/
|
||||
version: 1.10.2
|
||||
version: 1.11.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
|
||||
|
||||
@@ -216,6 +216,7 @@ Some third-party systems, e.g. GitHub, use HTML-formatted data in their payload
|
||||
| `agent.idleMinutes` | Allows the Pod to remain active for reuse | 0 |
|
||||
| `agent.yamlTemplate` | The raw yaml of a Pod API Object to merge into the agent spec | Not set |
|
||||
| `agent.slaveConnectTimeout`| Timeout in seconds for an agent to be online | 100 |
|
||||
| `agent.podTemplates` | Configures extra pod templates for the default kubernetes cloud | `{}` |
|
||||
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
|
||||
@@ -482,6 +483,39 @@ master:
|
||||
Docs taken from https://github.com/jenkinsci/docker/blob/master/Dockerfile:
|
||||
_Jenkins is run with user `jenkins`, uid = 1000. If you bind mount a volume from the host or a data container,ensure you use the same uid_
|
||||
|
||||
## Adding custom pod templates
|
||||
It is possible to add custom pod templates for the default configured kubernetes cloud.
|
||||
Add a key under `agent.podTemplates` for each pod template. Each key (prior to | character) is just a label, and can be any value.
|
||||
Keys are only used to give the pod template a meaningful name. The only restriction is they may only contain RFC 1123 \ DNS label
|
||||
characters: lowercase letters, numbers, and hyphens. Each pod template can contain multiple containers.
|
||||
There's no need to add the *jnlp* container since the kubernetes plugin will automatically inject it into the pod.
|
||||
For this pod templates configuration to be loaded the following values must be set:
|
||||
```
|
||||
master.JCasC.enabled: true
|
||||
master.JCasC.defaultConfig: true
|
||||
```
|
||||
The example below creates a python pod template in the kubernetes cloud.
|
||||
```
|
||||
agent:
|
||||
podTemplates:
|
||||
python: |
|
||||
- name: python
|
||||
label: jenkins-python
|
||||
serviceAccount: jenkins
|
||||
containers:
|
||||
- name: python
|
||||
image: python:3
|
||||
command: "/bin/sh -c"
|
||||
args: "cat"
|
||||
ttyEnabled: true
|
||||
privileged: true
|
||||
resourceRequestCpu: "400m"
|
||||
resourceRequestMemory: "512Mi"
|
||||
resourceLimitCpu: "1"
|
||||
resourceLimitMemory: "1024Mi"
|
||||
```
|
||||
Best reference is https://<jenkins_url>/configuration-as-code/reference#Cloud-kubernetes.
|
||||
|
||||
## Running behind a forward proxy
|
||||
|
||||
The master pod uses an Init Container to install plugins etc. If you are behind a corporate proxy it may be useful to set `master.initContainerEnv` to add environment variables such as `http_proxy`, so that these can be downloaded.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
master:
|
||||
JCasC:
|
||||
enabled: true
|
||||
defaultConfig: true
|
||||
sidecars:
|
||||
configAutoReload:
|
||||
enabled: true
|
||||
|
||||
@@ -142,6 +142,11 @@ jenkins:
|
||||
yaml: |-
|
||||
{{ tpl .Values.agent.yamlTemplate . | nindent 10 | trim }}
|
||||
yamlMergeStrategy: "override"
|
||||
{{- if .Values.agent.podTemplates }}
|
||||
{{- range $key, $val := .Values.agent.podTemplates }}
|
||||
{{- tpl $val $ | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.master.csrf.defaultCrumbIssuer.enabled }}
|
||||
crumbIssuer:
|
||||
|
||||
@@ -470,6 +470,30 @@ agent:
|
||||
# Timeout in seconds for an agent to be online
|
||||
slaveConnectTimeout: 100
|
||||
|
||||
# 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.
|
||||
# Keys are only used to give the pod template a meaningful name. The only restriction is they may only contain RFC 1123 \ DNS label
|
||||
# characters: lowercase letters, numbers, and hyphens. Each pod template can contain multiple containers.
|
||||
# For this pod templates configuration to be loaded the following values must be set:
|
||||
# master.JCasC.enabled: true
|
||||
# master.JCasC.defaultConfig: true
|
||||
# Best reference is https://<jenkins_url>/configuration-as-code/reference#Cloud-kubernetes. The example below creates a python pod template.
|
||||
podTemplates: {}
|
||||
# python: |
|
||||
# - name: python
|
||||
# label: jenkins-python
|
||||
# serviceAccount: jenkins
|
||||
# containers:
|
||||
# - name: python
|
||||
# image: python:3
|
||||
# command: "/bin/sh -c"
|
||||
# args: "cat"
|
||||
# ttyEnabled: true
|
||||
# privileged: true
|
||||
# resourceRequestCpu: "400m"
|
||||
# resourceRequestMemory: "512Mi"
|
||||
# resourceLimitCpu: "1"
|
||||
# resourceLimitMemory: "1024Mi"
|
||||
persistence:
|
||||
enabled: true
|
||||
## A manually managed Persistent Volume and Claim
|
||||
|
||||
Reference in New Issue
Block a user