Skip to content

Commit 5822f59

Browse files
committed
update jenkins chart
1 parent 1266982 commit 5822f59

14 files changed

+378
-37
lines changed

charts/jenkins/Chart.yaml

+45-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,49 @@
1+
annotations:
2+
artifacthub.io/category: integration-delivery
3+
artifacthub.io/changes: |
4+
- Update `docker.io/kiwigrid/k8s-sidecar` to version `1.30.1`
5+
artifacthub.io/images: |
6+
- name: jenkins
7+
image: docker.io/jenkins/jenkins:2.492.1-jdk17
8+
- name: k8s-sidecar
9+
image: docker.io/kiwigrid/k8s-sidecar:1.30.1
10+
- name: inbound-agent
11+
image: jenkins/inbound-agent:3283.v92c105e0f819-9
12+
artifacthub.io/license: Apache-2.0
13+
artifacthub.io/links: |
14+
- name: Chart Source
15+
url: https://github.com/jenkinsci/helm-charts/tree/main/charts/jenkins
16+
- name: Jenkins
17+
url: https://www.jenkins.io/
18+
- name: support
19+
url: https://github.com/jenkinsci/helm-charts/issues
120
apiVersion: v2
2-
appVersion: 2.440.3
3-
description: Helm chart for Jenkins
4-
21+
appVersion: 2.492.1
22+
description: 'Jenkins - Build great things at any scale! As the leading open source
23+
automation server, Jenkins provides over 2000 plugins to support building, deploying
24+
and automating any project. '
25+
home: https://www.jenkins.io/
26+
icon: https://get.jenkins.io/art/jenkins-logo/logo.svg
27+
keywords:
28+
- jenkins
29+
- ci
30+
- devops
531
maintainers:
6-
- name: nikitaevdokimov
7-
email: zalupa@gmail.com
8-
32+
- email: maor.friedman@redhat.com
33+
name: maorfr
34+
- email: mail@torstenwalter.de
35+
name: torstenwalter
36+
- email: garridomota@gmail.com
37+
name: mogaal
38+
- email: wmcdona89@gmail.com
39+
name: wmcdona89
40+
- email: timjacomb1@gmail.com
41+
name: timja
942
name: jenkins
43+
sources:
44+
- https://github.com/jenkinsci/jenkins
45+
- https://github.com/jenkinsci/docker-inbound-agent
46+
- https://github.com/maorfr/kube-tasks
47+
- https://github.com/jenkinsci/configuration-as-code-plugin
1048
type: application
11-
version: 5.1.11
49+
version: 5.8.16

charts/jenkins/templates/NOTES.txt

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{{- $prefix := .Values.controller.jenkinsUriPrefix | default "" -}}
2+
{{- $url := "" -}}
3+
1. Get your '{{ .Values.controller.admin.username }}' user password by running:
4+
kubectl exec --namespace {{ template "jenkins.namespace" . }} -it svc/{{ template "jenkins.fullname" . }} -c jenkins -- /bin/cat /run/secrets/additional/chart-admin-password && echo
5+
{{- if .Values.controller.ingress.hostName -}}
6+
{{- if .Values.controller.ingress.tls -}}
7+
{{- $url = print "https://" .Values.controller.ingress.hostName $prefix -}}
8+
{{- else -}}
9+
{{- $url = print "http://" .Values.controller.ingress.hostName $prefix -}}
10+
{{- end }}
11+
2. Visit {{ $url }}
12+
{{- else }}
13+
2. Get the Jenkins URL to visit by running these commands in the same shell:
14+
{{- if contains "NodePort" .Values.controller.serviceType }}
15+
export NODE_PORT=$(kubectl get --namespace {{ template "jenkins.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "jenkins.fullname" . }})
16+
export NODE_IP=$(kubectl get nodes --namespace {{ template "jenkins.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
17+
{{- if .Values.controller.httpsKeyStore.enable -}}
18+
{{- $url = print "https://$NODE_IP:$NODE_PORT" $prefix -}}
19+
{{- else -}}
20+
{{- $url = print "http://$NODE_IP:$NODE_PORT" $prefix -}}
21+
{{- end }}
22+
echo {{ $url }}
23+
24+
{{- else if contains "LoadBalancer" .Values.controller.serviceType }}
25+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
26+
You can watch the status of by running 'kubectl get svc --namespace {{ template "jenkins.namespace" . }} -w {{ template "jenkins.fullname" . }}'
27+
export SERVICE_IP=$(kubectl get svc --namespace {{ template "jenkins.namespace" . }} {{ template "jenkins.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
28+
{{- if .Values.controller.httpsKeyStore.enable -}}
29+
{{- $url = print "https://$SERVICE_IP:" .Values.controller.servicePort $prefix -}}
30+
{{- else -}}
31+
{{- $url = print "http://$SERVICE_IP:" .Values.controller.servicePort $prefix -}}
32+
{{- end }}
33+
echo {{ $url }}
34+
35+
{{- else if contains "ClusterIP" .Values.controller.serviceType -}}
36+
{{- if .Values.controller.httpsKeyStore.enable -}}
37+
{{- $url = print "https://127.0.0.1:" .Values.controller.servicePort $prefix -}}
38+
{{- else -}}
39+
{{- $url = print "http://127.0.0.1:" .Values.controller.servicePort $prefix -}}
40+
{{- end }}
41+
echo {{ $url }}
42+
kubectl --namespace {{ template "jenkins.namespace" . }} port-forward svc/{{template "jenkins.fullname" . }} {{ .Values.controller.servicePort }}:{{ .Values.controller.servicePort }}
43+
{{- end }}
44+
{{- end }}
45+
46+
3. Login with the password from step 1 and the username: {{ .Values.controller.admin.username }}
47+
4. Configure security realm and authorization strategy
48+
5. Use Jenkins Configuration as Code by specifying configScripts in your values.yaml file, see documentation: {{ $url }}/configuration-as-code and examples: https://github.com/jenkinsci/configuration-as-code-plugin/tree/master/demos
49+
50+
For more information on running Jenkins on Kubernetes, visit:
51+
https://cloud.google.com/solutions/jenkins-on-container-engine
52+
53+
For more information about Jenkins Configuration as Code, visit:
54+
https://jenkins.io/projects/jcasc/
55+
56+
{{ if and (eq .Values.controller.image.repository "jenkins/jenkins") (eq .Values.controller.image.registry "docker.io") }}
57+
NOTE: Consider using a custom image with pre-installed plugins
58+
{{- else if .Values.controller.installPlugins }}
59+
NOTE: Consider disabling `installPlugins` if your image already contains plugins.
60+
{{- end }}
61+
62+
{{- if .Values.persistence.enabled }}
63+
{{- else }}
64+
#################################################################################
65+
###### WARNING: Persistence is disabled!!! You will lose your data when #####
66+
###### the Jenkins pod is terminated. #####
67+
#################################################################################
68+
{{- end }}

charts/jenkins/templates/_helpers.tpl

+31-1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ jenkins:
140140
clouds:
141141
- kubernetes:
142142
containerCapStr: "{{ .Values.agent.containerCap }}"
143+
{{- if .Values.agent.garbageCollection.enabled }}
144+
garbageCollection:
145+
{{- if .Values.agent.garbageCollection.namespaces }}
146+
namespaces: |-
147+
{{- .Values.agent.garbageCollection.namespaces | nindent 10 }}
148+
{{- end }}
149+
timeout: "{{ .Values.agent.garbageCollection.timeout }}"
150+
{{- end }}
143151
{{- if .Values.agent.jnlpregistry }}
144152
jnlpregistry: "{{ .Values.agent.jnlpregistry }}"
145153
{{- end }}
@@ -164,6 +172,8 @@ jenkins:
164172
webSocket: true
165173
{{- end }}
166174
{{- end }}
175+
skipTlsVerify: {{ .Values.agent.skipTlsVerify | default false}}
176+
usageRestricted: {{ .Values.agent.usageRestricted | default false}}
167177
maxRequestsPerHostStr: {{ .Values.agent.maxRequestsPerHostStr | quote }}
168178
retentionTimeout: {{ .Values.agent.retentionTimeout | quote }}
169179
waitForPodSec: {{ .Values.agent.waitForPodSec | quote }}
@@ -248,6 +258,8 @@ jenkins:
248258
webSocket: true
249259
{{- end }}
250260
{{- end }}
261+
skipTlsVerify: {{ .Values.agent.skipTlsVerify | default false}}
262+
usageRestricted: {{ .Values.agent.usageRestricted | default false}}
251263
maxRequestsPerHostStr: {{ .Values.agent.maxRequestsPerHostStr | quote }}
252264
retentionTimeout: {{ .Values.agent.retentionTimeout | quote }}
253265
waitForPodSec: {{ .Values.agent.waitForPodSec | quote }}
@@ -297,6 +309,7 @@ jenkins:
297309
{{- /* restore root */}}
298310
{{- $_ := set $ "Values" $oldRoot.Values }}
299311
{{- end }}
312+
slaveAgentPort: {{ .Values.controller.agentListenerPort }}
300313
{{- if .Values.controller.csrf.defaultCrumbIssuer.enabled }}
301314
crumbIssuer:
302315
standard:
@@ -471,7 +484,10 @@ Returns kubernetes pod template configuration as code
471484
nodeUsageMode: {{ quote .Values.agent.nodeUsageMode }}
472485
podRetention: {{ .Values.agent.podRetention }}
473486
showRawYaml: {{ .Values.agent.showRawYaml }}
474-
serviceAccount: "{{ include "jenkins.serviceAccountAgentName" . }}"
487+
{{- $asaname := default (include "jenkins.serviceAccountAgentName" .) .Values.agent.serviceAccount -}}
488+
{{- if or (.Values.agent.useDefaultServiceAccount) (.Values.agent.serviceAccount) }}
489+
serviceAccount: "{{ $asaname }}"
490+
{{- end }}
475491
slaveConnectTimeoutStr: "{{ .Values.agent.connectTimeout }}"
476492
{{- if .Values.agent.volumes }}
477493
volumes:
@@ -520,6 +536,7 @@ Returns kubernetes pod template configuration as code
520536
{{- tpl (trim .Values.agent.yamlTemplate) . | nindent 4 }}
521537
{{- end }}
522538
yamlMergeStrategy: {{ .Values.agent.yamlMergeStrategy }}
539+
inheritYamlMergeStrategy: {{ .Values.agent.inheritYamlMergeStrategy }}
523540
{{- end -}}
524541

525542
{{- define "jenkins.kubernetes-version" -}}
@@ -640,6 +657,10 @@ Create the HTTP port for interacting with the controller
640657
{{- end -}}
641658
{{- end -}}
642659
{{- end }}
660+
{{- if $root.Values.controller.sidecars.configAutoReload.logging.configuration.override }}
661+
- name: LOG_CONFIG
662+
value: "{{ $root.Values.controller.jenkinsHome }}/auto-reload/auto-reload-config.yaml"
663+
{{- end }}
643664

644665
resources:
645666
{{ toYaml $root.Values.controller.sidecars.configAutoReload.resources | indent 4 }}
@@ -651,5 +672,14 @@ Create the HTTP port for interacting with the controller
651672
{{- if $root.Values.persistence.subPath }}
652673
subPath: {{ $root.Values.persistence.subPath }}
653674
{{- end }}
675+
{{- if $root.Values.controller.sidecars.configAutoReload.logging.configuration.override }}
676+
- name: auto-reload-config
677+
mountPath: {{ $root.Values.controller.jenkinsHome }}/auto-reload
678+
- name: auto-reload-config-logs
679+
mountPath: {{ $root.Values.controller.jenkinsHome }}/auto-reload-logs
680+
{{- end }}
681+
{{- if $root.Values.controller.sidecars.configAutoReload.additionalVolumeMounts }}
682+
{{ (tpl (toYaml $root.Values.controller.sidecars.configAutoReload.additionalVolumeMounts) $root) | indent 4 }}
683+
{{- end }}
654684

655685
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{{- if .Values.controller.sidecars.configAutoReload.logging.configuration.override }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ template "jenkins.fullname" . }}-auto-reload-config
6+
namespace: {{ template "jenkins.namespace" . }}
7+
labels:
8+
"app.kubernetes.io/name": {{ template "jenkins.name" . }}
9+
{{- if .Values.renderHelmLabels }}
10+
"helm.sh/chart": "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
11+
{{- end }}
12+
"app.kubernetes.io/managed-by": "{{ $.Release.Service }}"
13+
"app.kubernetes.io/instance": "{{ $.Release.Name }}"
14+
"app.kubernetes.io/component": "{{ $.Values.controller.componentName }}"
15+
data:
16+
auto-reload-config.yaml: |-
17+
version: 1
18+
disable_existing_loggers: false
19+
root:
20+
level: {{ .Values.controller.sidecars.configAutoReload.logging.configuration.logLevel }}
21+
handlers:
22+
{{- if .Values.controller.sidecars.configAutoReload.logging.configuration.logToConsole}}
23+
- console
24+
{{- end }}
25+
{{- if .Values.controller.sidecars.configAutoReload.logging.configuration.logToFile }}
26+
- file
27+
{{- end }}
28+
handlers:
29+
{{- if .Values.controller.sidecars.configAutoReload.logging.configuration.logToConsole}}
30+
console:
31+
class: logging.StreamHandler
32+
level: {{ .Values.controller.sidecars.configAutoReload.logging.configuration.logLevel }}
33+
formatter: {{ .Values.controller.sidecars.configAutoReload.logging.configuration.formatter }}
34+
{{- end }}
35+
{{- if .Values.controller.sidecars.configAutoReload.logging.configuration.logToFile }}
36+
file:
37+
class : logging.handlers.RotatingFileHandler
38+
formatter: {{ .Values.controller.sidecars.configAutoReload.logging.configuration.formatter }}
39+
filename: {{ .Values.controller.jenkinsHome }}/auto-reload-logs/file.log
40+
maxBytes: {{ .Values.controller.sidecars.configAutoReload.logging.configuration.maxBytes }}
41+
backupCount: {{ .Values.controller.sidecars.configAutoReload.logging.configuration.backupCount }}
42+
{{- end }}
43+
formatters:
44+
JSON:
45+
"()": logger.JsonFormatter
46+
format: "%(levelname)s %(message)s"
47+
rename_fields:
48+
message: msg
49+
levelname: level
50+
LOGFMT:
51+
"()": logger.LogfmtFormatter
52+
keys:
53+
- time
54+
- level
55+
- msg
56+
mapping:
57+
time: asctime
58+
level: levelname
59+
msg: message
60+
{{- end }}

charts/jenkins/templates/home-pvc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
{{- if (eq "-" .Values.persistence.storageClass) }}
3535
storageClassName: ""
3636
{{- else }}
37-
storageClassName: "{{ .Values.persistence.storageClass }}"
37+
storageClassName: "{{ tpl .Values.persistence.storageClass . }}"
3838
{{- end }}
3939
{{- end }}
4040
{{- end }}

charts/jenkins/templates/jcasc-config.yaml

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ metadata:
1111
labels:
1212
"app.kubernetes.io/name": {{ template "jenkins.name" $root}}
1313
{{- if $root.Values.renderHelmLabels }}
14-
"helm.sh/chart": "{{ $root.Chart.Name }}-{{ $root.Chart.Version }}"
14+
"helm.sh/chart": "{{ $root.Chart.Name }}-{{ $root.Chart.Version | replace "+" "_" }}"
1515
{{- end }}
1616
"app.kubernetes.io/managed-by": "{{ $.Release.Service }}"
1717
"app.kubernetes.io/instance": "{{ $.Release.Name }}"
1818
"app.kubernetes.io/component": "{{ $.Values.controller.componentName }}"
1919
{{ template "jenkins.fullname" $root }}-jenkins-config: "true"
20+
{{- if $root.Values.controller.JCasC.configMapAnnotations }}
21+
annotations:
22+
{{ toYaml $root.Values.controller.JCasC.configMapAnnotations | indent 4 }}
23+
{{- end }}
2024
data:
2125
{{ $key }}.yaml: |-
2226
{{ tpl $val $| indent 4 }}
@@ -32,12 +36,16 @@ metadata:
3236
labels:
3337
"app.kubernetes.io/name": {{ template "jenkins.name" $root}}
3438
{{- if .Values.renderHelmLabels }}
35-
"helm.sh/chart": "{{ $root.Chart.Name }}-{{ $root.Chart.Version }}"
39+
"helm.sh/chart": "{{ $root.Chart.Name }}-{{ $root.Chart.Version | replace "+" "_" }}"
3640
{{- end }}
3741
"app.kubernetes.io/managed-by": "{{ $.Release.Service }}"
3842
"app.kubernetes.io/instance": "{{ $.Release.Name }}"
3943
"app.kubernetes.io/component": "{{ $.Values.controller.componentName }}"
4044
{{ template "jenkins.fullname" $root }}-jenkins-config: "true"
45+
{{- if $root.Values.controller.JCasC.configMapAnnotations }}
46+
annotations:
47+
{{ toYaml $root.Values.controller.JCasC.configMapAnnotations | indent 4 }}
48+
{{- end }}
4149
data:
4250
jcasc-default-config.yaml: |-
4351
{{- include "jenkins.casc.defaults" . | nindent 4 }}

charts/jenkins/templates/jenkins-controller-ingress.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ metadata:
2323
{{- end }}
2424
{{- if .Values.controller.ingress.annotations }}
2525
annotations:
26-
{{ toYaml .Values.controller.ingress.annotations | indent 4 }}
26+
{{ tpl (toYaml .Values.controller.ingress.annotations) . | indent 4 }}
2727
{{- end }}
2828
name: {{ template "jenkins.fullname" . }}
2929
spec:
3030
{{- if .Values.controller.ingress.ingressClassName }}
31-
ingressClassName: {{ .Values.controller.ingress.ingressClassName | quote }}
31+
ingressClassName: {{ tpl .Values.controller.ingress.ingressClassName . | quote }}
3232
{{- end }}
3333
rules:
3434
- http:

charts/jenkins/templates/jenkins-controller-route.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{{- if .Values.controller.route.enabled }}
2-
---
32
apiVersion: route.openshift.io/v1
43
kind: Route
54
metadata:

charts/jenkins/templates/jenkins-controller-statefulset.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ spec:
6666
{{- if .Values.controller.affinity }}
6767
affinity:
6868
{{ toYaml .Values.controller.affinity | indent 8 }}
69+
{{- end }}
70+
{{- if .Values.controller.topologySpreadConstraints }}
71+
topologySpreadConstraints:
72+
{{ toYaml .Values.controller.topologySpreadConstraints | indent 8 }}
6973
{{- end }}
7074
{{- if quote .Values.controller.terminationGracePeriodSeconds }}
7175
terminationGracePeriodSeconds: {{ .Values.controller.terminationGracePeriodSeconds }}
@@ -76,6 +80,9 @@ spec:
7680
{{- if .Values.controller.shareProcessNamespace }}
7781
shareProcessNamespace: true
7882
{{- end }}
83+
{{- if not .Values.controller.enableServiceLinks }}
84+
enableServiceLinks: false
85+
{{- end }}
7986
{{- if .Values.controller.usePodSecurityContext }}
8087
securityContext:
8188
{{- if kindIs "map" .Values.controller.podSecurityContextOverride }}
@@ -100,6 +107,7 @@ spec:
100107
{{- end }}
101108
{{- end }}
102109
serviceAccountName: "{{ template "jenkins.serviceAccountName" . }}"
110+
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
103111
{{- if .Values.controller.hostNetworking }}
104112
hostNetwork: true
105113
dnsPolicy: ClusterFirstWithHostNet
@@ -321,6 +329,13 @@ spec:
321329
{{- if .Values.persistence.volumes }}
322330
{{ tpl (toYaml .Values.persistence.volumes | indent 6) . }}
323331
{{- end }}
332+
{{- if .Values.controller.sidecars.configAutoReload.logging.configuration.override }}
333+
- name: auto-reload-config
334+
configMap:
335+
name: {{ template "jenkins.fullname" . }}-auto-reload-config
336+
- name: auto-reload-config-logs
337+
emptyDir: {}
338+
{{- end }}
324339
{{- if .Values.controller.installPlugins }}
325340
{{- if .Values.controller.overwritePluginsFromImage }}
326341
- name: plugins

charts/jenkins/templates/jenkins-controller-svc.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ spec:
4141
targetPort: {{ $port.port }}
4242
{{- end -}}
4343
{{- end }}
44+
{{- if .Values.controller.publishNotReadyAddresses }}
45+
publishNotReadyAddresses: true
46+
{{- end }}
4447
selector:
4548
"app.kubernetes.io/component": "{{ .Values.controller.componentName }}"
4649
"app.kubernetes.io/instance": "{{ .Release.Name }}"

0 commit comments

Comments
 (0)