{{- if not .Values.Master.CustomConfigMap }} apiVersion: v1 kind: ConfigMap metadata: name: {{ template "jenkins.fullname" . }} data: config.xml: |- {{ .Values.Master.ImageTag }} 0 NORMAL {{ .Values.Master.UseSecurity }} true false ${JENKINS_HOME}/workspace/${ITEM_FULLNAME} ${ITEM_ROOTDIR}/builds kubernetes {{- if .Values.Agent.Enabled }} default 2147483647 0 {{- $local := dict "first" true }} {{- range $key, $value := .Values.Agent.NodeSelector }} {{- if not $local.first }},{{- end }} {{- $key }}={{ $value }} {{- $_ := set $local "first" false }} {{- end }} NORMAL {{- range $index, $volume := .Values.Agent.volumes }} {{- range $key, $value := $volume }}{{- if not (eq $key "type") }} <{{ $key }}>{{ $value }} {{- end }}{{- end }} {{- end }} jnlp {{ .Values.Agent.Image }}:{{ .Values.Agent.ImageTag }} {{- if .Values.Agent.Privileged }} true {{- else }} false {{- end }} {{ .Values.Agent.AlwaysPullImage }} /home/jenkins ${computer.jnlpmac} ${computer.name} false {{.Values.Agent.Cpu}} {{.Values.Agent.Memory}} {{.Values.Agent.Cpu}} {{.Values.Agent.Memory}} {{- if .Values.Agent.ImagePullSecret }} {{ .Values.Agent.ImagePullSecret }} {{- else }} {{- end }} {{- end -}} https://kubernetes false {{ .Release.Namespace }} http://{{ template "jenkins.fullname" . }}:{{.Values.Master.ServicePort}}{{ default "" .Values.Master.JenkinsUriPrefix }} {{ template "jenkins.fullname" . }}-agent:50000 10 5 0 0 5 0 All false false All 50000 {{- range .Values.Master.DisabledAgentProtocols }} {{ . }} {{- end }} {{- if .Values.Master.CSRF.DefaultCrumbIssuer.Enabled }} {{- if .Values.Master.CSRF.DefaultCrumbIssuer.ProxyCompatability }} true {{- end }} {{- end }} true {{- if .Values.Master.ScriptApproval }} scriptapproval.xml: |- {{- range $key, $val := .Values.Master.ScriptApproval }} {{ $val }} {{- end }} {{- end }} jenkins.CLI.xml: |- {{- if .Values.Master.CLI }} true {{- else }} false {{- end }} hudson.model.UpdateCenter.xml: |- default {{- if .Values.Master.UpdateCenter }} {{ .Values.Master.UpdateCenter }} {{- else }} https://updates.jenkins.io/update-center.json {{- end }} apply_config.sh: |- mkdir -p /usr/share/jenkins/ref/secrets/; echo "false" > /usr/share/jenkins/ref/secrets/slave-to-master-security-kill-switch; cp -n /var/jenkins_config/config.xml /var/jenkins_home; cp -n /var/jenkins_config/jenkins.CLI.xml /var/jenkins_home; cp -n /var/jenkins_config/hudson.model.UpdateCenter.xml /var/jenkins_home; {{- if .Values.Master.InstallPlugins }} # Install missing plugins cp /var/jenkins_config/plugins.txt /var/jenkins_home; rm -rf /usr/share/jenkins/ref/plugins/*.lock /usr/local/bin/install-plugins.sh `echo $(cat /var/jenkins_home/plugins.txt)`; # Copy plugins to shared volume cp -n /usr/share/jenkins/ref/plugins/* /var/jenkins_plugins; {{- end }} {{- if .Values.Master.ScriptApproval }} cp -n /var/jenkins_config/scriptapproval.xml /var/jenkins_home/scriptApproval.xml; {{- end }} {{- if .Values.Master.InitScripts }} mkdir -p /var/jenkins_home/init.groovy.d/; cp -n /var/jenkins_config/*.groovy /var/jenkins_home/init.groovy.d/ {{- end }} {{- if .Values.Master.CredentialsXmlSecret }} cp -n /var/jenkins_credentials/credentials.xml /var/jenkins_home; {{- end }} {{- if .Values.Master.SecretsFilesSecret }} cp -n /var/jenkins_secrets/* /usr/share/jenkins/ref/secrets; {{- end }} {{- if .Values.Master.Jobs }} for job in $(ls /var/jenkins_jobs); do mkdir -p /var/jenkins_home/jobs/$job cp -n /var/jenkins_jobs/$job /var/jenkins_home/jobs/$job/config.xml done {{- end }} {{- range $key, $val := .Values.Master.InitScripts }} init{{ $key }}.groovy: |- {{ $val | indent 4 }} {{- end }} plugins.txt: |- {{- if .Values.Master.InstallPlugins }} {{- range $index, $val := .Values.Master.InstallPlugins }} {{ $val | indent 4 }} {{- end }} {{- end }} {{ else }} {{ include "override_config_map" . }} {{- end -}}