[JIRA] (JENKINS-59880) Kubernetes PlugIn is not spawning Pods as expected when using an external Podtemplate file

2 views
Skip to first unread message

alexagrosc@gmail.com (JIRA)

unread,
Oct 22, 2019, 5:57:03 AM10/22/19
to jenkinsc...@googlegroups.com
alex grosc created an issue
 
Jenkins / Bug JENKINS-59880
Kubernetes PlugIn is not spawning Pods as expected when using an external Podtemplate file
Issue Type: Bug Bug
Assignee: Unassigned
Components: kubernetes-plugin
Created: 2019-10-22 09:56
Environment: Jenkinsversion 2.190.1 (not running in Cluster)
Kubernetes Plugin Version 1.20.0 & 1.20.1
Kubernetes Version 1.16.1
Labels: plugin kubernetes kubernetes-plugin declarative-pipeline
Priority: Major Major
Reporter: alex grosc

 

Our Jenkins Instance (which is running outside of the Cluster) was configured through the UI to dynamically spawn Slaves inside the Cluster, which was working fine.

Now we wanted configure the PodTemplate as config-as-code in a declarative Pipeline. Using following configuration (as stated in the github description) is working and produces a Pod with 2 Containers (jnlp and maven):

 

 agent {
    kubernetes {
      defaultContainer 'jnlp'
      yaml """
apiVersion: v1
kind: Pod
metadata:
  labels:
    some-label: some-label-value
    namespace: jenkins
spec:
  containers:
  - name: maven
    image: maven:3.3.9-jdk-8-alpine
    command:
    - cat
    tty: true
"""
    }
  }

But when we wanted to pull out the Pod config in a seperate file as described in the documentation (https://github.com/jenkinsci/kubernetes-plugin#declarative-pipeline) like so (the file contains the exact same content as above):

agent {    
  kubernetes {
    defaultContainer 'jnlp'
    yamlFile 'KubernetesPod.yaml'
  }
}

... it didn't work as expected anymore.

There were created two seperate Pods, each containing a "jenkins/jnlp-slave:alpine" Container, but no maven container at all, which lead to following error in the build log:

java.io.IOException: container [maven] does not exist in pod [testpodfromyml-9-r72hx-m491z-pr022]

Maybe it is important to mention that the Cloud & Podconfiguration in the GUI was still active.

 

 

 

 

 

 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages