Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-49313

Incorrect podTemplate deployed starting in 1.1.4

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • kubernetes-plugin
    • None
    • Jenkins 2.104
      kubernetes-plugin 1.1.4

      After upgrading to 1.1.4, my agents were getting deployed as what appeared to be a default template instead of my custom pod template.  My custom template includes a custom container, but the Pod being created only had the jnlp container in it.

      Here is my plugin configuration that works correctly in 1.1.3:

       

      <org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud plugin="kubernetes@1.1.3">
       <name>kubernetes</name>
       <defaultsProviderTemplate></defaultsProviderTemplate>
       <templates>
       <org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
       <inheritFrom></inheritFrom>
       <name>rok8sslave</name>
       <namespace>jenkins</namespace>
       <privileged>false</privileged>
       <alwaysPullImage>false</alwaysPullImage>
       <instanceCap>2</instanceCap>
       <slaveConnectTimeout>100</slaveConnectTimeout>
       <idleMinutes>1</idleMinutes>
       <activeDeadlineSeconds>1800</activeDeadlineSeconds>
       <label>rok8s</label>
       <nodeSelector></nodeSelector>
       <nodeUsageMode>EXCLUSIVE</nodeUsageMode>
       <customWorkspaceVolumeEnabled>false</customWorkspaceVolumeEnabled>
       <workspaceVolume class="org.csanchez.jenkins.plugins.kubernetes.volumes.workspace.EmptyDirWorkspaceVolume">
       <memory>false</memory>
       </workspaceVolume>
       <volumes>
       <org.csanchez.jenkins.plugins.kubernetes.volumes.HostPathVolume>
       <mountPath>/usr/bin/docker</mountPath>
       <hostPath>/usr/bin/docker</hostPath>
       </org.csanchez.jenkins.plugins.kubernetes.volumes.HostPathVolume>
       <org.csanchez.jenkins.plugins.kubernetes.volumes.HostPathVolume>
       <mountPath>/var/run/docker.sock</mountPath>
       <hostPath>/var/run/docker.sock</hostPath>
       </org.csanchez.jenkins.plugins.kubernetes.volumes.HostPathVolume>
       </volumes>
       <containers>
       <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
       <name>rok8s</name>
       <image>repository.internal/org/ciimage</image>
       <privileged>false</privileged>
       <alwaysPullImage>true</alwaysPullImage>
       <workingDir>/home/jenkins</workingDir>
       <command>/bin/sh -c</command>
       <args>cat</args>
       <ttyEnabled>true</ttyEnabled>
       <resourceRequestCpu></resourceRequestCpu>
       <resourceRequestMemory></resourceRequestMemory>
       <resourceLimitCpu></resourceLimitCpu>
       <resourceLimitMemory></resourceLimitMemory>
       <envVars/>
       <ports/>
       <livenessProbe>
       <execArgs></execArgs>
       <timeoutSeconds>0</timeoutSeconds>
       <initialDelaySeconds>0</initialDelaySeconds>
       <failureThreshold>0</failureThreshold>
       <periodSeconds>0</periodSeconds>
       <successThreshold>0</successThreshold>
       </livenessProbe>
       </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
       </containers>
       <envVars/>
       <annotations/>
       <imagePullSecrets/>
       </org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
       </templates>
       <serverUrl>https://kubernetes.default</serverUrl>
       <skipTlsVerify>false</skipTlsVerify>
       <namespace>jenkins</namespace>
       <jenkinsUrl>http://jenkins-ui.jenkins.svc.cluster.local:8080</jenkinsUrl>
       <jenkinsTunnel>jenkins-discovery.jenkins.svc.cluster.local:50000</jenkinsTunnel>
       <containerCap>10</containerCap>
       <retentionTimeout>5</retentionTimeout>
       <connectTimeout>0</connectTimeout>
       <readTimeout>0</readTimeout>
       <labels class="com.google.common.collect.ImmutableMap">
       <entry>
       <string>jenkins</string>
       <string>slave</string>
       </entry>
       </labels>
       <maxRequestsPerHost>32</maxRequestsPerHost>
       </org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud>
       
      

       

      And here is the basic format of the pipeline:

      podTemplate(label: 'rok8s') {
        node('rok8s') {
          stage('Name') {
            container('rok8s') {
              //do stuff
            }
          }
        }
      } 

            csanchez Carlos Sanchez
            coreypobrien Corey O'Brien
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: