Hi,
I configured a declarative pipeline with the kubernetes-plugin to start a
jenkins job's in a k8s cluster. This is working great but now I want to use
volumes for secrets and need to specify a podTemplate. I'm not sure how to
configure a podTemplate for a declarative pipeline. The pipeline that is
working:
pipeline {
agent {
kubernetes {
label 'jenkins-demo'
containerTemplate {
name 'dind-jdk8-maven3'
image 'eu.gcr.io/jenkins-demo/dind-jdk8-maven3:v4'
ttyEnabled true
command 'cat'
}
}
}
stages {
}
}
The above I would like to extend with a podTemplate containing volumes and
a secretVolume. The issue is that I don't know the correct syntax for
specifying a podTemplate in the declarative pipeline. So I came up with
this:
pipeline {
agent {
kubernetes {
label 'jenkins-demo'
podTemplate {
volumes {
secretVolume(secretName: 'some-secret', mountPath:
'/some-secret')
}
containerTemplate {
name 'dind-jdk8-maven3'
image 'eu.gcr.io/jenkins-demo/dind-jdk8-maven3:v4'
ttyEnabled true
command 'cat'
}
}
}
}
stages {
}
}
Ofcourse this doesn't work an throws an error. Can anyone help me out with
specifying a podTemplate so I can use k8s secrets?
Thanks,
Vincent
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/a69efdfc-7c1c-4e4f-a909-0b43ad95868b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.