2018-06-27 16:54:50 +02:00
|
|
|
{{- define "override_config_map" }}
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
metadata:
|
|
|
|
name: {{ template "jenkins.fullname" . }}
|
|
|
|
data:
|
|
|
|
config.xml: |-
|
|
|
|
<?xml version='1.0' encoding='UTF-8'?>
|
|
|
|
<hudson>
|
|
|
|
<disabledAdministrativeMonitors/>
|
|
|
|
<version>{{ .Values.Master.ImageTag }}</version>
|
|
|
|
<numExecutors>0</numExecutors>
|
|
|
|
<mode>NORMAL</mode>
|
|
|
|
<useSecurity>{{ .Values.Master.UseSecurity }}</useSecurity>
|
|
|
|
<authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy">
|
|
|
|
<denyAnonymousReadAccess>true</denyAnonymousReadAccess>
|
|
|
|
</authorizationStrategy>
|
2018-07-16 12:57:59 +02:00
|
|
|
{{- if .Values.Master.Security.UseGitHub }}
|
2018-07-03 23:44:36 +02:00
|
|
|
<securityRealm class="org.jenkinsci.plugins.GithubSecurityRealm">
|
|
|
|
<githubWebUri>https://github.com</githubWebUri>
|
|
|
|
<githubApiUri>https://api.github.com</githubApiUri>
|
2018-07-16 11:51:46 +02:00
|
|
|
<clientID>{{ .Values.Master.Security.GitHub.ClientID }}</clientID>
|
|
|
|
<clientSecret>{{ .Values.Master.Security.GitHub.ClientSecret }}</clientSecret>
|
2018-07-03 23:44:36 +02:00
|
|
|
<oauthScopes>read:org,user:email</oauthScopes>
|
|
|
|
</securityRealm>
|
|
|
|
{{- else }}
|
2018-06-27 16:54:50 +02:00
|
|
|
<securityRealm class="hudson.security.LegacySecurityRealm"/>
|
2018-07-03 23:44:36 +02:00
|
|
|
{{- end }}
|
2018-06-27 16:54:50 +02:00
|
|
|
<disableRememberMe>false</disableRememberMe>
|
|
|
|
<projectNamingStrategy class="jenkins.model.ProjectNamingStrategy$DefaultProjectNamingStrategy"/>
|
|
|
|
<workspaceDir>${JENKINS_HOME}/workspace/${ITEM_FULLNAME}</workspaceDir>
|
|
|
|
<buildsDir>${ITEM_ROOTDIR}/builds</buildsDir>
|
|
|
|
<markupFormatter class="hudson.markup.EscapedMarkupFormatter"/>
|
|
|
|
<jdks/>
|
2018-07-19 19:16:21 +02:00
|
|
|
<primaryView>dev</primaryView>
|
2018-06-27 16:54:50 +02:00
|
|
|
<viewsTabBar class="hudson.views.DefaultViewsTabBar"/>
|
|
|
|
<myViewsTabBar class="hudson.views.DefaultMyViewsTabBar"/>
|
|
|
|
<clouds>
|
|
|
|
<org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud plugin="kubernetes@{{ template "jenkins.kubernetes-version" . }}">
|
|
|
|
<name>kubernetes</name>
|
|
|
|
<templates>
|
2018-06-29 12:34:52 +02:00
|
|
|
{{- range $podName, $pod := .Values.Pods }}
|
2018-06-27 16:54:50 +02:00
|
|
|
<org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
|
2018-07-16 12:57:59 +02:00
|
|
|
<inheritFrom>{{ $pod.InheritFrom | default "" }}</inheritFrom>
|
2018-06-29 12:34:52 +02:00
|
|
|
<name>{{ $podName }}</name>
|
2018-06-27 16:54:50 +02:00
|
|
|
<instanceCap>2147483647</instanceCap>
|
|
|
|
<idleMinutes>0</idleMinutes>
|
2018-06-29 15:21:00 +02:00
|
|
|
<label>{{ .Label }}</label>
|
2018-06-27 16:54:50 +02:00
|
|
|
<nodeSelector>
|
|
|
|
{{- $local := dict "first" true }}
|
2018-06-29 14:10:14 +02:00
|
|
|
{{- range $key, $value := .NodeSelector }}
|
2018-06-27 16:54:50 +02:00
|
|
|
{{- if not $local.first }},{{- end }}
|
|
|
|
{{- $key }}={{ $value }}
|
|
|
|
{{- $_ := set $local "first" false }}
|
|
|
|
{{- end }}</nodeSelector>
|
2018-06-29 14:53:09 +02:00
|
|
|
<nodeUsageMode>{{ .NodeUsageMode }}</nodeUsageMode>
|
2018-06-27 16:54:50 +02:00
|
|
|
<volumes>
|
2018-06-29 14:10:14 +02:00
|
|
|
{{- range $index, $volume := .volumes }}
|
|
|
|
<org.csanchez.jenkins.plugins.kubernetes.volumes.{{ .type }}Volume>
|
2018-06-27 16:54:50 +02:00
|
|
|
{{- range $key, $value := $volume }}{{- if not (eq $key "type") }}
|
|
|
|
<{{ $key }}>{{ $value }}</{{ $key }}>
|
|
|
|
{{- end }}{{- end }}
|
2018-06-29 14:10:14 +02:00
|
|
|
</org.csanchez.jenkins.plugins.kubernetes.volumes.{{ .type }}Volume>
|
2018-06-27 16:54:50 +02:00
|
|
|
{{- end }}
|
|
|
|
</volumes>
|
|
|
|
<containers>
|
2018-06-29 14:10:14 +02:00
|
|
|
{{- range $containerName, $container := .Containers }}
|
2018-06-27 16:54:50 +02:00
|
|
|
<org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
|
2018-06-29 12:34:52 +02:00
|
|
|
<name>{{ $containerName }}</name>
|
2018-06-29 14:10:14 +02:00
|
|
|
<image>{{ .Image }}:{{ .ImageTag | default "latest" }}</image>
|
2018-06-29 14:53:09 +02:00
|
|
|
<ports>
|
|
|
|
{{- range $index, $envVar := .Ports }}
|
|
|
|
<org.csanchez.jenkins.plugins.kubernetes.PortMapping>
|
|
|
|
<name>{{ .name }}</name>
|
|
|
|
<containerPort>{{ .containerPort }}</containerPort>
|
|
|
|
<hostPort>{{ .hostPort }}</hostPort>
|
|
|
|
</org.csanchez.jenkins.plugins.kubernetes.PortMapping>
|
|
|
|
{{- end }}
|
|
|
|
</ports>
|
2018-06-29 14:10:14 +02:00
|
|
|
{{- if .Privileged }}
|
2018-06-27 16:54:50 +02:00
|
|
|
<privileged>true</privileged>
|
|
|
|
{{- else }}
|
|
|
|
<privileged>false</privileged>
|
|
|
|
{{- end }}
|
2018-06-29 14:10:14 +02:00
|
|
|
{{- if .AlwaysPullImage }}
|
2018-06-29 12:34:52 +02:00
|
|
|
<alwaysPullImage>true</alwaysPullImage>
|
2018-06-27 16:54:50 +02:00
|
|
|
{{- else }}
|
2018-06-29 12:34:52 +02:00
|
|
|
<alwaysPullImage>false</alwaysPullImage>
|
2018-06-27 17:59:04 +02:00
|
|
|
{{- end }}
|
2018-07-19 22:35:53 +02:00
|
|
|
<workingDir>{{ .WorkingDir | default "" }}</workingDir>
|
2018-06-29 23:37:47 +02:00
|
|
|
<command>{{ .Command | default "" }}</command>
|
2018-06-29 14:10:14 +02:00
|
|
|
<args>{{ .Args | default "" }}</args>
|
|
|
|
{{- if .TTY }}
|
2018-06-27 16:54:50 +02:00
|
|
|
<ttyEnabled>true</ttyEnabled>
|
2018-06-27 17:59:04 +02:00
|
|
|
{{- else }}
|
|
|
|
<ttyEnabled>false</ttyEnabled>
|
|
|
|
{{- end }}
|
2018-07-16 12:57:59 +02:00
|
|
|
<envVars>
|
|
|
|
{{- range $index, $envVar := .EnvVars }}
|
|
|
|
<org.csanchez.jenkins.plugins.kubernetes.model.{{ .type }}EnvVar>
|
|
|
|
{{- range $key, $value := $envVar }}{{- if not (eq $key "type") }}
|
|
|
|
<{{ $key }}>{{ $value }}</{{ $key }}>
|
|
|
|
{{- end }}{{- end }}
|
|
|
|
</org.csanchez.jenkins.plugins.kubernetes.model.{{ .type }}EnvVar>
|
|
|
|
{{- end }}
|
|
|
|
</envVars>
|
2018-06-29 14:10:14 +02:00
|
|
|
{{- if .resources }}
|
|
|
|
{{- if .resources.requests }}
|
2018-06-29 14:53:09 +02:00
|
|
|
<resourceRequestCpu>{{ .resources.requests.cpu | default "" }}</resourceRequestCpu>
|
|
|
|
<resourceRequestMemory>{{ .resources.requests.memory | default "" }}</resourceRequestMemory>
|
2018-06-29 12:34:52 +02:00
|
|
|
{{- end }}
|
2018-06-29 14:10:14 +02:00
|
|
|
{{- if .resources.limits }}
|
2018-06-29 14:53:09 +02:00
|
|
|
<resourceLimitCpu>{{ .resources.limits.cpu | default "" }}</resourceLimitCpu>
|
|
|
|
<resourceLimitMemory>{{ .resources.limits.memory | default "" }}</resourceLimitMemory>
|
2018-06-29 12:34:52 +02:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2018-06-29 00:15:16 +02:00
|
|
|
</org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
|
2018-06-29 12:34:52 +02:00
|
|
|
{{- end }}
|
2018-06-27 16:54:50 +02:00
|
|
|
</containers>
|
2018-06-28 09:25:27 +02:00
|
|
|
<envVars>
|
2018-06-29 00:15:16 +02:00
|
|
|
<org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
|
|
|
|
<key>JENKINS_URL</key>
|
2018-06-29 12:34:52 +02:00
|
|
|
<value>http://{{ template "jenkins.fullname" $ }}:{{$.Values.Master.ServicePort}}{{ default "" $.Values.Master.JenkinsUriPrefix }}</value>
|
2018-06-29 00:15:16 +02:00
|
|
|
</org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
|
2018-06-29 14:10:14 +02:00
|
|
|
{{- range $index, $envVar := .EnvVars }}
|
|
|
|
<org.csanchez.jenkins.plugins.kubernetes.model.{{ .type }}EnvVar>
|
2018-06-29 12:34:52 +02:00
|
|
|
{{- range $key, $value := $envVar }}{{- if not (eq $key "type") }}
|
|
|
|
<{{ $key }}>{{ $value }}</{{ $key }}>
|
|
|
|
{{- end }}{{- end }}
|
2018-06-29 14:10:14 +02:00
|
|
|
</org.csanchez.jenkins.plugins.kubernetes.model.{{ .type }}EnvVar>
|
2018-06-29 12:34:52 +02:00
|
|
|
{{- end }}
|
2018-06-28 09:25:27 +02:00
|
|
|
</envVars>
|
2018-06-27 16:54:50 +02:00
|
|
|
<annotations/>
|
2018-06-29 14:10:14 +02:00
|
|
|
{{- if .ImagePullSecret }}
|
2018-06-27 17:59:04 +02:00
|
|
|
<imagePullSecrets>
|
|
|
|
<org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret>
|
2018-06-29 14:10:14 +02:00
|
|
|
<name>{{ .ImagePullSecret }}</name>
|
2018-06-27 17:59:04 +02:00
|
|
|
</org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret>
|
|
|
|
</imagePullSecrets>
|
|
|
|
{{- else }}
|
2018-06-27 16:54:50 +02:00
|
|
|
<imagePullSecrets/>
|
2018-06-27 17:59:04 +02:00
|
|
|
{{- end }}
|
|
|
|
<nodeProperties/>
|
2018-06-27 16:54:50 +02:00
|
|
|
</org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
|
2018-06-29 12:34:52 +02:00
|
|
|
{{- end }}
|
2018-06-27 16:54:50 +02:00
|
|
|
</templates>
|
|
|
|
<serverUrl>https://kubernetes.default</serverUrl>
|
|
|
|
<skipTlsVerify>false</skipTlsVerify>
|
|
|
|
<namespace>{{ .Release.Namespace }}</namespace>
|
|
|
|
<jenkinsUrl>http://{{ template "jenkins.fullname" . }}:{{.Values.Master.ServicePort}}{{ default "" .Values.Master.JenkinsUriPrefix }}</jenkinsUrl>
|
|
|
|
<jenkinsTunnel>{{ template "jenkins.fullname" . }}-agent:50000</jenkinsTunnel>
|
2018-06-29 23:31:08 +02:00
|
|
|
<containerCap>50</containerCap>
|
2018-06-27 16:54:50 +02:00
|
|
|
<retentionTimeout>5</retentionTimeout>
|
|
|
|
<connectTimeout>0</connectTimeout>
|
|
|
|
<readTimeout>0</readTimeout>
|
|
|
|
</org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud>
|
|
|
|
</clouds>
|
|
|
|
<quietPeriod>5</quietPeriod>
|
|
|
|
<scmCheckoutRetryCount>0</scmCheckoutRetryCount>
|
|
|
|
<views>
|
|
|
|
<hudson.model.AllView>
|
|
|
|
<owner class="hudson" reference="../../.."/>
|
2018-07-19 23:15:28 +02:00
|
|
|
<name>all</name>
|
2018-06-27 16:54:50 +02:00
|
|
|
<filterExecutors>false</filterExecutors>
|
|
|
|
<filterQueue>false</filterQueue>
|
|
|
|
<properties class="hudson.model.View$PropertyList"/>
|
|
|
|
</hudson.model.AllView>
|
2018-07-19 23:27:38 +02:00
|
|
|
{{- range $viewName, $view := .Values.Master.Views }}
|
2018-07-19 23:15:28 +02:00
|
|
|
<listView>
|
|
|
|
<owner class="hudson" reference="../../.."/>
|
2018-07-19 23:51:58 +02:00
|
|
|
<name>{{ $viewName }}</name>
|
2018-07-19 23:15:28 +02:00
|
|
|
<filterExecutors>false</filterExecutors>
|
|
|
|
<filterQueue>false</filterQueue>
|
|
|
|
<properties class="hudson.model.View$PropertyList"/>
|
|
|
|
<jobNames>
|
|
|
|
<comparator class="hudson.util.CaseInsensitiveComparator" reference="../../../listView/jobNames/comparator"/>
|
2018-07-19 23:42:39 +02:00
|
|
|
{{- range $index, $job := .Jobs }}
|
2018-07-20 00:04:46 +02:00
|
|
|
<string>{{ .name }}</string>
|
2018-07-19 23:15:28 +02:00
|
|
|
{{- end }}
|
|
|
|
</jobNames>
|
|
|
|
<jobFilters/>
|
|
|
|
<columns>
|
|
|
|
<hudson.views.StatusColumn/>
|
|
|
|
<hudson.views.WeatherColumn/>
|
|
|
|
<hudson.views.JobColumn/>
|
|
|
|
<hudson.views.LastSuccessColumn/>
|
|
|
|
<hudson.views.LastFailureColumn/>
|
|
|
|
<hudson.views.LastDurationColumn/>
|
|
|
|
<hudson.views.BuildButtonColumn/>
|
|
|
|
<hudson.plugins.favorite.column.FavoriteColumn plugin="favorite@2.3.2"/>
|
|
|
|
</columns>
|
|
|
|
<recurse>false</recurse>
|
|
|
|
</listView>
|
|
|
|
{{- end }}
|
2018-06-27 16:54:50 +02:00
|
|
|
</views>
|
2018-07-19 23:15:28 +02:00
|
|
|
<primaryView>dev</primaryView>
|
2018-06-27 16:54:50 +02:00
|
|
|
<slaveAgentPort>50000</slaveAgentPort>
|
|
|
|
<disabledAgentProtocols>
|
|
|
|
{{- range .Values.Master.DisabledAgentProtocols }}
|
|
|
|
<string>{{ . }}</string>
|
|
|
|
{{- end }}
|
|
|
|
</disabledAgentProtocols>
|
|
|
|
<label></label>
|
|
|
|
{{- if .Values.Master.CSRF.DefaultCrumbIssuer.Enabled }}
|
|
|
|
<crumbIssuer class="hudson.security.csrf.DefaultCrumbIssuer">
|
|
|
|
{{- if .Values.Master.CSRF.DefaultCrumbIssuer.ProxyCompatability }}
|
|
|
|
<excludeClientIPFromCrumb>true</excludeClientIPFromCrumb>
|
|
|
|
{{- end }}
|
|
|
|
</crumbIssuer>
|
|
|
|
{{- end }}
|
|
|
|
<nodeProperties/>
|
|
|
|
<globalNodeProperties/>
|
|
|
|
<noUsageStatistics>true</noUsageStatistics>
|
|
|
|
</hudson>
|
|
|
|
{{- if .Values.Master.ScriptApproval }}
|
|
|
|
scriptapproval.xml: |-
|
|
|
|
<?xml version='1.0' encoding='UTF-8'?>
|
|
|
|
<scriptApproval plugin="script-security@1.27">
|
|
|
|
<approvedScriptHashes/>
|
|
|
|
<approvedSignatures>
|
|
|
|
{{- range $key, $val := .Values.Master.ScriptApproval }}
|
|
|
|
<string>{{ $val }}</string>
|
|
|
|
{{- end }}
|
|
|
|
</approvedSignatures>
|
|
|
|
<aclApprovedSignatures/>
|
|
|
|
<approvedClasspathEntries/>
|
|
|
|
<pendingScripts/>
|
|
|
|
<pendingSignatures/>
|
|
|
|
<pendingClasspathEntries/>
|
|
|
|
</scriptApproval>
|
|
|
|
{{- end }}
|
|
|
|
jenkins.CLI.xml: |-
|
|
|
|
<?xml version='1.1' encoding='UTF-8'?>
|
|
|
|
<jenkins.CLI>
|
|
|
|
{{- if .Values.Master.CLI }}
|
|
|
|
<enabled>true</enabled>
|
|
|
|
{{- else }}
|
|
|
|
<enabled>false</enabled>
|
|
|
|
{{- end }}
|
|
|
|
</jenkins.CLI>
|
|
|
|
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;
|
|
|
|
{{- 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 }}
|
|
|
|
{{- end }}
|