I wanted to implement docker-in-docker on GKE cluster with Jenkins on it. Any thoughts as to how modify the jenkins/templates/config.yaml
file that I got from helm fetch stable/jenkins
to start creating for each agent/slave pod - two containers ? I tried going with this config.
<containers>
<org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
<name>{{ .Values.agent.sideContainerName }}</name>
{{- if .Values.agent.imageTag }}
<image>{{ .Values.agent.image }}:{{ .Values.agent.imageTag }}</image>
{{- else }}
<image>{{ .Values.agent.image }}:{{ .Values.agent.tag }}</image>
{{- end }}
{{- if .Values.agent.privileged }}
<privileged>true</privileged>
{{- else }}
<privileged>false</privileged>
{{- end }}
<alwaysPullImage>{{ .Values.agent.alwaysPullImage }}</alwaysPullImage>
<workingDir>/home/jenkins</workingDir>
<command>{{ .Values.agent.command }}</command>
{{- if .Values.agent.args }}
<args>{{ .Values.agent.args }}</args>
{{- else }}
<args>${computer.jnlpmac} ${computer.name}</args>
{{- end }}
<ttyEnabled>{{ .Values.agent.TTYEnabled }}</ttyEnabled>
# Resources configuration is a little hacky. This was to prevent breaking
# changes, and should be cleanned up in the future once everybody had
# enough time to migrate.
<resourceRequestCpu>{{.Values.agent.resources.requests.cpu}}</resourceRequestCpu>
<resourceRequestMemory>{{.Values.agent.resources.requests.memory}}</resourceRequestMemory>
<resourceLimitCpu>{{.Values.agent.resources.limits.cpu}}</resourceLimitCpu>
<resourceLimitMemory>{{.Values.agent.resources.limits.memory}}</resourceLimitMemory>
<envVars>
<org.csanchez.jenkins.plugins.kubernetes.ContainerEnvVar>
<key>JENKINS_URL</key>
<value>http://{{ template "jenkins.fullname" . }}.{{ template "jenkins.namespace" . }}.svc.{{.Values.clusterZone}}:{{.Values.master.servicePort}}{{ default "" .Values.master.jenkinsUriPrefix }}</value>
</org.csanchez.jenkins.plugins.kubernetes.ContainerEnvVar>
</envVars>
</org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
### MY EDITS BELOW
<org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
<name>{{ .Values.dind.name}}</name>
<image>{{ .Values.dind.image }}:{{ .Values.dind.tag }}</image>
<imagePullPolicy>{{ .Values.dind.imagePullPolicy }}</imagePullPolicy>
<privileged>true</privileged>
<resourceRequestCpu>{{.Values.dind.resources.requests.cpu}}</resourceRequestCpu>
<resourceRequestMemory>{{.Values.dind.resources.requests.memory}}</resourceRequestMemory>
<resourceLimitCpu>{{.Values.dind.resources.limits.cpu}}</resourceLimitCpu>
<resourceLimitMemory>{{.Values.dind.resources.limits.memory}}</resourceLimitMemory>
</org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
</containers>
EDIT:
I think I've found smth I missed, the helm chart had yamlTemplate for Agent already, so testing that now
# Raw yaml template for the Pod. For example this allows usage of toleration for agent pods.
# https://github.com/jenkinsci/kubernetes-plugin#using-yaml-to-define-pod-templates
# https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
yamlTemplate: ""
# yamlTemplate: |-
# apiVersion: v1
# kind: Pod
# spec:
# tolerations:
# - key: "key"
# operator: "Equal"
# value: "value"
# Timeout in seconds for an agent to be online