apiVersion: v2.edp.epam.com/v1
kind: JenkinsAgent
metadata:
  name: {{ .Values.agentName }}
spec:
  name: {{ .Values.agentName }}
  template: |-
    <org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
      <inheritFrom></inheritFrom>
      <name>{{ .Values.agentName }}</name>
      <namespace></namespace>
      <privileged>false</privileged>
      <alwaysPullImage>false</alwaysPullImage>
      <instanceCap>2147483647</instanceCap>
      <slaveConnectTimeout>100</slaveConnectTimeout>
      <idleMinutes>5</idleMinutes>
      <activeDeadlineSeconds>0</activeDeadlineSeconds>
      <label>{{ .Values.agentName }}</label>
      <serviceAccount>jenkins</serviceAccount>
      <nodeSelector>beta.kubernetes.io/os=linux</nodeSelector>
      <nodeUsageMode>NORMAL</nodeUsageMode>
      <workspaceVolume class="org.csanchez.jenkins.plugins.kubernetes.volumes.workspace.EmptyDirWorkspaceVolume">
        <memory>false</memory>
      </workspaceVolume>
      <volumes>
        <org.csanchez.jenkins.plugins.kubernetes.volumes.EmptyDirVolume>
          <mountPath>/opt/caches/maven</mountPath>
          <memory>false</memory>
        </org.csanchez.jenkins.plugins.kubernetes.volumes.EmptyDirVolume>
        <org.csanchez.jenkins.plugins.kubernetes.volumes.ConfigMapVolume>
          <mountPath>/var/lib/business-process-modeller-extensions</mountPath>
          <configMapName>business-process-modeler-element-templates</configMapName>
        </org.csanchez.jenkins.plugins.kubernetes.volumes.ConfigMapVolume>
      </volumes>
      <containers>
        <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
          <name>jnlp</name>
          <image>{{ template "jenkins.agent.image" . }}</image>
          <privileged>false</privileged>
          <alwaysPullImage>false</alwaysPullImage>
          <workingDir>/tmp</workingDir>
          <command></command>
          <args>${computer.jnlpmac} ${computer.name}</args>
          <ttyEnabled>false</ttyEnabled>
          <resourceRequestCpu></resourceRequestCpu>
          <resourceRequestMemory></resourceRequestMemory>
          <resourceLimitCpu></resourceLimitCpu>
          <resourceLimitMemory></resourceLimitMemory>
          <envVars>
            <org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
              <key>JAVA_TOOL_OPTIONS</key>
              <value>-XX:+UnlockExperimentalVMOptions -Dsun.zip.disableMemoryMapping=true</value>
            </org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
            <org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
              <key>AGENT_IMAGE_VERSION</key>
              <value>{{ .Values.image.version }}</value>
            </org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
          </envVars>
          <ports/>
        </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
      </containers>
      <envVars/>
      <annotations>
        <org.csanchez.jenkins.plugins.kubernetes.PodAnnotation>
          <key>sidecar.istio.io/inject</key>
          <value>false</value>
        </org.csanchez.jenkins.plugins.kubernetes.PodAnnotation>
      </annotations>
      <imagePullSecrets/>
      <podRetention class="org.csanchez.jenkins.plugins.kubernetes.pod.retention.Default"/>
    </org.csanchez.jenkins.plugins.kubernetes.PodTemplate>