Fix #8: Make the containers in the jenkins pod template configurable through values
This commit is contained in:
parent
3eec43fad5
commit
1d1035c51d
@ -1,6 +1,6 @@
|
|||||||
name: molgenis-jenkins
|
name: molgenis-jenkins
|
||||||
home: https://jenkins.io/
|
home: https://jenkins.io/
|
||||||
version: 0.2.3
|
version: 0.2.4
|
||||||
appVersion: 2.107
|
appVersion: 2.107
|
||||||
description: Molgenis installation for the jenkins chart.
|
description: Molgenis installation for the jenkins chart.
|
||||||
sources:
|
sources:
|
||||||
|
@ -28,23 +28,23 @@ data:
|
|||||||
<org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud plugin="kubernetes@{{ template "jenkins.kubernetes-version" . }}">
|
<org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud plugin="kubernetes@{{ template "jenkins.kubernetes-version" . }}">
|
||||||
<name>kubernetes</name>
|
<name>kubernetes</name>
|
||||||
<templates>
|
<templates>
|
||||||
{{- if .Values.Agent.Enabled }}
|
{{- range $podName, $pod := .Values.Pods }}
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
|
<org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
|
||||||
<inheritFrom></inheritFrom>
|
<inheritFrom></inheritFrom>
|
||||||
<name>default</name>
|
<name>{{ $podName }}</name>
|
||||||
<instanceCap>2147483647</instanceCap>
|
<instanceCap>2147483647</instanceCap>
|
||||||
<idleMinutes>0</idleMinutes>
|
<idleMinutes>0</idleMinutes>
|
||||||
<label>{{ .Release.Name }}-{{ .Values.Agent.Component }}</label>
|
<label>{{ $.Release.Name }}-{{ $pod.Label }}</label>
|
||||||
<nodeSelector>
|
<nodeSelector>
|
||||||
{{- $local := dict "first" true }}
|
{{- $local := dict "first" true }}
|
||||||
{{- range $key, $value := .Values.Agent.NodeSelector }}
|
{{- range $key, $value := $pod.NodeSelector }}
|
||||||
{{- if not $local.first }},{{- end }}
|
{{- if not $local.first }},{{- end }}
|
||||||
{{- $key }}={{ $value }}
|
{{- $key }}={{ $value }}
|
||||||
{{- $_ := set $local "first" false }}
|
{{- $_ := set $local "first" false }}
|
||||||
{{- end }}</nodeSelector>
|
{{- end }}</nodeSelector>
|
||||||
<nodeUsageMode>EXCLUSIVE</nodeUsageMode>
|
<nodeUsageMode>$pod.NodeUsageMode</nodeUsageMode>
|
||||||
<volumes>
|
<volumes>
|
||||||
{{- range $index, $volume := .Values.Agent.volumes }}
|
{{- range $index, $volume := $pod.volumes }}
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.volumes.{{ $volume.type }}Volume>
|
<org.csanchez.jenkins.plugins.kubernetes.volumes.{{ $volume.type }}Volume>
|
||||||
{{- range $key, $value := $volume }}{{- if not (eq $key "type") }}
|
{{- range $key, $value := $volume }}{{- if not (eq $key "type") }}
|
||||||
<{{ $key }}>{{ $value }}</{{ $key }}>
|
<{{ $key }}>{{ $value }}</{{ $key }}>
|
||||||
@ -53,153 +53,59 @@ data:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
</volumes>
|
</volumes>
|
||||||
<containers>
|
<containers>
|
||||||
|
{{- range $containerName, $container := $pod.Containers }}
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
|
<org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
|
||||||
<name>jnlp</name>
|
<name>{{ $containerName }}</name>
|
||||||
<image>{{ .Values.Agent.Image }}:{{ .Values.Agent.ImageTag }}</image>
|
<image>{{ $container.Image }}:{{ $container.ImageTag | default "latest" }}</image>
|
||||||
{{- if .Values.Agent.Privileged }}
|
{{- if $container.Privileged }}
|
||||||
<privileged>true</privileged>
|
<privileged>true</privileged>
|
||||||
{{- else }}
|
{{- else }}
|
||||||
<privileged>false</privileged>
|
<privileged>false</privileged>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<alwaysPullImage>{{ .Values.Agent.AlwaysPullImage }}</alwaysPullImage>
|
{{- if $container.AlwaysPullImage }}
|
||||||
<workingDir>/home/jenkins</workingDir>
|
<alwaysPullImage>true</alwaysPullImage>
|
||||||
<command></command>
|
|
||||||
<args>${computer.jnlpmac} ${computer.name}</args>
|
|
||||||
<ttyEnabled>false</ttyEnabled>
|
|
||||||
<resourceRequestCpu>{{.Values.Agent.Cpu}}</resourceRequestCpu>
|
|
||||||
<resourceRequestMemory>{{.Values.Agent.Memory}}</resourceRequestMemory>
|
|
||||||
<resourceLimitCpu>{{.Values.Agent.Cpu}}</resourceLimitCpu>
|
|
||||||
<resourceLimitMemory>{{.Values.Agent.Memory}}</resourceLimitMemory>
|
|
||||||
<envVars>
|
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.ContainerEnvVar>
|
|
||||||
<key>JENKINS_URL</key>
|
|
||||||
<value>http://{{ template "jenkins.fullname" . }}:{{.Values.Master.ServicePort}}{{ default "" .Values.Master.JenkinsUriPrefix }}</value>
|
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.ContainerEnvVar>
|
|
||||||
</envVars>
|
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
|
|
||||||
</containers>
|
|
||||||
<envVars/>
|
|
||||||
<annotations/>
|
|
||||||
{{- if .Values.Agent.ImagePullSecret }}
|
|
||||||
<imagePullSecrets>
|
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret>
|
|
||||||
<name>{{ .Values.Agent.ImagePullSecret }}</name>
|
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret>
|
|
||||||
</imagePullSecrets>
|
|
||||||
{{- else }}
|
{{- else }}
|
||||||
<imagePullSecrets/>
|
|
||||||
{{- end }}
|
|
||||||
<nodeProperties/>
|
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
|
|
||||||
{{- end -}}
|
|
||||||
{{- if .Values.Pod.Enabled }}
|
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
|
|
||||||
<inheritFrom></inheritFrom>
|
|
||||||
<name>{{ .Values.Pod.Label }}</name>
|
|
||||||
<instanceCap>2147483647</instanceCap>
|
|
||||||
<idleMinutes>0</idleMinutes>
|
|
||||||
<label>{{ .Values.Pod.Label }}</label>
|
|
||||||
<nodeSelector>
|
|
||||||
{{- $local := dict "first" true }}
|
|
||||||
{{- range $key, $value := .Values.Pod.NodeSelector }}
|
|
||||||
{{- if not $local.first }},{{- end }}
|
|
||||||
{{- $key }}={{ $value }}
|
|
||||||
{{- $_ := set $local "first" false }}
|
|
||||||
{{- end }}</nodeSelector>
|
|
||||||
<nodeUsageMode>NORMAL</nodeUsageMode>
|
|
||||||
<volumes>
|
|
||||||
{{- range $index, $volume := .Values.Pod.volumes }}
|
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.volumes.{{ $volume.type }}Volume>
|
|
||||||
{{- range $key, $value := $volume }}{{- if not (eq $key "type") }}
|
|
||||||
<{{ $key }}>{{ $value }}</{{ $key }}>
|
|
||||||
{{- end }}{{- end }}
|
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.volumes.{{ $volume.type }}Volume>
|
|
||||||
{{- end }}
|
|
||||||
</volumes>
|
|
||||||
<containers>
|
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
|
|
||||||
<name>{{ .Values.Pod.Label }}</name>
|
|
||||||
<image>{{ .Values.Pod.Image }}:{{ .Values.Pod.ImageTag }}</image>
|
|
||||||
{{- if .Values.Pod.Privileged }}
|
|
||||||
<privileged>true</privileged>
|
|
||||||
{{- else }}
|
|
||||||
<privileged>false</privileged>
|
|
||||||
{{- end }}
|
|
||||||
<alwaysPullImage>{{ .Values.Pod.AlwaysPullImage }}</alwaysPullImage>
|
|
||||||
<workingDir>/home/jenkins</workingDir>
|
|
||||||
<command>{{ .Values.Pod.Command }}</command>
|
|
||||||
<args>{{ .Values.Pod.Args }}</args>
|
|
||||||
{{- if .Values.Pod.TTY }}
|
|
||||||
<ttyEnabled>true</ttyEnabled>
|
|
||||||
{{- else }}
|
|
||||||
<ttyEnabled>false</ttyEnabled>
|
|
||||||
{{- end }}
|
|
||||||
<resourceRequestCpu>{{.Values.Pod.Cpu}}</resourceRequestCpu>
|
|
||||||
<resourceRequestMemory>{{.Values.Pod.Memory}}</resourceRequestMemory>
|
|
||||||
<resourceLimitCpu>{{.Values.Pod.Cpu}}</resourceLimitCpu>
|
|
||||||
<resourceLimitMemory>{{.Values.Pod.Memory}}</resourceLimitMemory>
|
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
|
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
|
|
||||||
<name>alpine</name>
|
|
||||||
<image>spotify/alpine</image>
|
|
||||||
<privileged>false</privileged>
|
|
||||||
<alwaysPullImage>false</alwaysPullImage>
|
<alwaysPullImage>false</alwaysPullImage>
|
||||||
|
{{- end }}
|
||||||
<workingDir>/home/jenkins</workingDir>
|
<workingDir>/home/jenkins</workingDir>
|
||||||
<command>/bin/sh -c</command>
|
<command>{{ $container.Command | default "cat" }}</command>
|
||||||
<args>cat</args>
|
<args>{{ $container.Args | default "" }}</args>
|
||||||
|
{{- if $container.TTY }}
|
||||||
<ttyEnabled>true</ttyEnabled>
|
<ttyEnabled>true</ttyEnabled>
|
||||||
<resourceRequestCpu></resourceRequestCpu>
|
{{- else }}
|
||||||
<resourceRequestMemory></resourceRequestMemory>
|
<ttyEnabled>false</ttyEnabled>
|
||||||
<resourceLimitCpu></resourceLimitCpu>
|
{{- end }}
|
||||||
<resourceLimitMemory></resourceLimitMemory>
|
{{- if $container.resources }}
|
||||||
<ports/>
|
{{- if $container.resources.requests }}
|
||||||
<livenessProbe>
|
<resourceRequestCpu>{{ $container.resources.requests.cpu | default "" }}</resourceRequestCpu>
|
||||||
<execArgs></execArgs>
|
<resourceRequestMemory>{{ $container.resources.requests.memory | default "" }}</resourceRequestMemory>
|
||||||
<timeoutSeconds>0</timeoutSeconds>
|
{{- end }}
|
||||||
<initialDelaySeconds>0</initialDelaySeconds>
|
{{- if $container.resources.limits }}
|
||||||
<failureThreshold>0</failureThreshold>
|
<resourceLimitCpu>{{ $container.resources.limits.cpu | default "" }}</resourceLimitCpu>
|
||||||
<periodSeconds>0</periodSeconds>
|
<resourceLimitMemory>{{ $container.resources.limits.memory | default "" }}</resourceLimitMemory>
|
||||||
<successThreshold>0</successThreshold>
|
{{- end }}
|
||||||
</livenessProbe>
|
{{- end }}
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
|
</org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
|
||||||
|
{{- end }}
|
||||||
</containers>
|
</containers>
|
||||||
<envVars>
|
<envVars>
|
||||||
<envVars>
|
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
|
<org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
|
||||||
<key>JENKINS_URL</key>
|
<key>JENKINS_URL</key>
|
||||||
<value>http://{{ template "jenkins.fullname" . }}:{{.Values.Master.ServicePort}}{{ default "" .Values.Master.JenkinsUriPrefix }}</value>
|
<value>http://{{ template "jenkins.fullname" $ }}:{{$.Values.Master.ServicePort}}{{ default "" $.Values.Master.JenkinsUriPrefix }}</value>
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
|
</org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
|
||||||
</envVars>
|
{{- range $index, $envVar := $pod.EnvVars }}
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.model.SecretEnvVar>
|
<org.csanchez.jenkins.plugins.kubernetes.model.{{ $envVar.type }}EnvVar>
|
||||||
<key>PGP_PASSPHRASE</key>
|
{{- range $key, $value := $envVar }}{{- if not (eq $key "type") }}
|
||||||
<secretName>molgenis-pipeline-env-secret</secretName>
|
<{{ $key }}>{{ $value }}</{{ $key }}>
|
||||||
<secretKey>pgpPassphrase</secretKey>
|
{{- end }}{{- end }}
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.model.SecretEnvVar>
|
</org.csanchez.jenkins.plugins.kubernetes.model.{{ $envVar.type }}EnvVar>
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
|
{{- end }}
|
||||||
<key>PGP_SECRETKEY</key>
|
|
||||||
<value>keyfile:/root/.m2/key.asc</value>
|
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
|
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.model.SecretEnvVar>
|
|
||||||
<key>SONAR_TOKEN</key>
|
|
||||||
<secretName>molgenis-pipeline-env-secret</secretName>
|
|
||||||
<secretKey>sonarToken</secretKey>
|
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.model.SecretEnvVar>
|
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.model.SecretEnvVar>
|
|
||||||
<key>CODECOV_TOKEN</key>
|
|
||||||
<secretName>molgenis-pipeline-env-secret</secretName>
|
|
||||||
<secretKey>codecovToken</secretKey>
|
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.model.SecretEnvVar>
|
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.model.SecretEnvVar>
|
|
||||||
<key>GITHUB_TOKEN</key>
|
|
||||||
<secretName>molgenis-pipeline-env-secret</secretName>
|
|
||||||
<secretKey>githubToken</secretKey>
|
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.model.SecretEnvVar>
|
|
||||||
</envVars>
|
</envVars>
|
||||||
<annotations/>
|
<annotations/>
|
||||||
{{- if .Values.Pod.ImagePullSecret }}
|
{{- if $pod.ImagePullSecret }}
|
||||||
<imagePullSecrets>
|
<imagePullSecrets>
|
||||||
<org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret>
|
<org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret>
|
||||||
<name>{{ .Values.Pod.ImagePullSecret }}</name>
|
<name>{{ $pod.ImagePullSecret }}</name>
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret>
|
</org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret>
|
||||||
</imagePullSecrets>
|
</imagePullSecrets>
|
||||||
{{- else }}
|
{{- else }}
|
||||||
@ -207,7 +113,7 @@ data:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
<nodeProperties/>
|
<nodeProperties/>
|
||||||
</org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
|
</org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
|
||||||
{{- end -}}
|
{{- end }}
|
||||||
</templates>
|
</templates>
|
||||||
<serverUrl>https://kubernetes.default</serverUrl>
|
<serverUrl>https://kubernetes.default</serverUrl>
|
||||||
<skipTlsVerify>false</skipTlsVerify>
|
<skipTlsVerify>false</skipTlsVerify>
|
||||||
|
@ -82,35 +82,50 @@ jenkins:
|
|||||||
CustomConfigMap: true
|
CustomConfigMap: true
|
||||||
rbac:
|
rbac:
|
||||||
install: true
|
install: true
|
||||||
# A second pod template for maven builds
|
Pods:
|
||||||
Pod:
|
default:
|
||||||
Enabled: true
|
Label: "default"
|
||||||
Image: "webhost12.service.rug.nl/molgenis/molgenis-maven"
|
NodeUsageMode: NORMAL
|
||||||
ImageTag: latest
|
volumes:
|
||||||
# ImagePullSecret: jenkins
|
- type: HostPath
|
||||||
Label: "molgenis-maven"
|
hostPath: "/var/run/docker.sock"
|
||||||
Privileged: false
|
mountPath: "/var/run/docker.sock"
|
||||||
Cpu: ""
|
- type: Secret
|
||||||
Memory: ""
|
secretName: molgenis-pipeline-file-secret
|
||||||
# You may want to change this to true while testing a new image
|
mountPath: "/root/.m2"
|
||||||
AlwaysPullImage: false
|
Containers:
|
||||||
Command: "/bin/sh -c"
|
maven:
|
||||||
Args: "cat"
|
Image: "webhost12.service.rug.nl/molgenis/molgenis-maven"
|
||||||
TTY: true
|
resources:
|
||||||
# You can define the volumes that you want to mount for this container
|
requests:
|
||||||
# Allowed types are: ConfigMap, EmptyDir, HostPath, Nfs, Pod, Secret
|
cpu: "1000m"
|
||||||
# Configure the attributes as they appear in the corresponding Java class for that type
|
limits:
|
||||||
# https://github.com/jenkinsci/kubernetes-plugin/tree/master/src/main/java/org/csanchez/jenkins/plugins/kubernetes/volumes
|
memory: "1Gi"
|
||||||
volumes:
|
alpine:
|
||||||
- type: HostPath
|
Image: "spotify/alpine"
|
||||||
hostPath: "/var/run/docker.sock"
|
EnvVars:
|
||||||
mountPath: "/var/run/docker.sock"
|
- type: Secret
|
||||||
- type: Secret
|
key: PGP_PASSPHRASE
|
||||||
secretName: molgenis-pipeline-file-secret
|
secretName: molgenis-pipeline-env-secret
|
||||||
mountPath: "/root/.m2"
|
secretKey: pgpPassphrase
|
||||||
|
- type: KeyValue
|
||||||
|
key: PGP_SECRETKEY
|
||||||
|
value: "keyfile:/root/.m2/key.asc"
|
||||||
|
- type: Secret
|
||||||
|
key: SONAR_TOKEN
|
||||||
|
secretName: molgenis-pipeline-env-secret
|
||||||
|
secretKey: sonarToken
|
||||||
|
- type: Secret
|
||||||
|
key: CODECOV_TOKEN
|
||||||
|
secretName: molgenis-pipeline-env-secret
|
||||||
|
secretKey: codecovToken
|
||||||
|
- type: Secret
|
||||||
|
key: GITHUB_TOKEN
|
||||||
|
secretName: molgenis-pipeline-env-secret
|
||||||
|
secretKey: githubToken
|
||||||
|
# If needed
|
||||||
|
# ImagePullSecret: jenkins
|
||||||
NodeSelector: {}
|
NodeSelector: {}
|
||||||
# Key Value selectors. Ex:
|
|
||||||
# jenkins-agent: v1
|
|
||||||
PipelineSecrets:
|
PipelineSecrets:
|
||||||
Env:
|
Env:
|
||||||
# Set to false to keep existing secret
|
# Set to false to keep existing secret
|
||||||
|
Loading…
Reference in New Issue
Block a user