Jenkins on the Kubernetes spawn 2 контейнера в агенте Pod - PullRequest
0 голосов
/ 24 февраля 2020

Я хотел реализовать docker -in- docker на кластере GKE с Дженкинсом на нем. Любые мысли о том, как изменить файл jenkins/templates/config.yaml, который я получил от helm fetch stable/jenkins, чтобы начать создавать для каждого модуля агента / подчиненного модуля - два контейнера? Я попытался использовать этот конфиг.

              <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>

РЕДАКТИРОВАТЬ:

Я думаю, что нашел что-то, что я пропустил, у рулевой диаграммы уже был yamlTemplate для Агента, так что тестируем сейчас

  # 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
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...