[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Kubernetes Jenkins slaves in parallel



Hi

I have a pipeline with a podTemaplate definition from the Kubernetes plugin to create slaves on Openshift. 

Something like this.

podTemplate(name: 'jenkins-slave', label: 'kube-node',  instanceCap: 4,
containers: [
containerTemplate(
name: 'maven', 
image: "${registry}:5000/jenkins/slave-maven",
command: '/bin/bash',
args: '',
alwaysPullImage: true,
ttyEnabled: true)
])
{
                node('kube-node') {
    stage ('Compile') {
    container ('maven') {
     }
    }
        }
node('kube-node') {
stage ('Unit Tests') {
container('maven') {
}
}
}
node('kube-node') {
stage ('Integration Tests') {
container('maven') {
}
}
}
}

That works fine and 3 kube-node pods get created one after the other.  But I want to parallelise the Unit Tests and the Integration Tests stages. When I move those two nodes into a parallel step they still get created in sequence. 

 parallel (
    "Unit": {
                node('kube-node') {
                stage ('Unit Tests') {
            container('maven') {
            }
                }
                }
    },
    "Integration": {
                    node('kube-node') {
                    stage ('Integration Tests') {
                    container('maven') {
                    }
                    }
                    }
    }
)

The console shows both branches waiting for a new pod to be created.


[Pipeline] parallel
[Pipeline] [Unit] { (Branch: Unit)
[Pipeline] [Integration] { (Branch: Integration)
[Pipeline] [Unit] node
[Pipeline] [Integration] node
[Unit] Still waiting to schedule task
[Integration] All nodes of label ‘kube-node’ are offline
[Unit] Still waiting to schedule task
[Integration] All nodes of label ‘kube-node’ are offline

At this point one pod is created and one of the branches runs. The branch finishes, the pod is terminated, a new pod created and the other branch runs. 

I have set -Dhudson.slaves.NodeProvisioner.MARGIN=50 -Dhudson.slaves.NodeProvisioner.MARGIN0=0.85 in my jenkins startup options but made no difference. 

Any ideas how I can parallise these pods? 

Thanks

Lionel

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]