Hi there,
It works for me with the CASC plugin like this:
jenkins:
clouds:
- kubernetes:
name: "Kubernetes"
skipTlsVerify: true
namespace: "jenkins"
jenkinsUrl: "http://localhost:8080"
connectTimeout: 0
readTimeout: 0
containerCapStr: 100
maxRequestsPerHostStr: 64
retentionTimeout: 5
templates:
- name: "jenkins-slave"
namespace: "jenkins"
nodeUsageMode: NORMAL
containers:
- name: "jnlp"
image: "jenkinsci/jnlp-slave"
alwaysPullImage: false
workingDir: "/home/jenkins"
ttyEnabled: true
resourceRequestCpu: "500m"
resourceLimitCpu: "1000m"
resourceRequestMemory: "1Gi"
resourceLimitMemory: "2Gi"
idleMinutes: "30"
activeDeadlineSeconds: "900"
slaveConnectTimeout: "120"
serviceAccount: "jenkins"
These are the plugins that i use:
configuration-as-code
configuration-as-code-support
kubernetes:1.13.3
kubernetes-cd
crowd2
workflow-aggregator
git
pipeline-utility-steps
Alex
On Thursday, 3 January 2019 15:07:26 UTC, unguiculus wrote:
>
> Did you manage to solve the issue? I'm actually having the same problem
> but I do use the CasC plugin as Carlos suggested. Everything looks ok in
> the UI but only starts working if I hit "Save".
>
> I copied away the whole JENKINS_HOME before and after hitting "Save". As
> expected, the diff doesn't show any changes. I tried triggering a reload of
> the config via CLI and via Groovy init script. Nothing helped but manually
> saving in the UI.
>
> Here's the relevant part from the jenkins.yaml:
>
> jenkins:
> clouds:
> - kubernetes:
> name: kubernetes
> serverUrl: https://kubernetes.default
> namespace: default
> jenkinsUrl: http://jenkins-master:8080
> jenkinsTunnel: jenkins-agent:50000
> templates:
> - name: k8s-agent
> idleMinutes: 30
> containers:
> - name: jnlp
> image: jenkinsci/jnlp-slave:3.27-1-alpine
> command: ""
> args: ""
>
>
> Jenkins version: 2.150.1 LTS
>
> Installed plugins:
>
> configuration-as-code:1.4
> workflow-aggregator:2.6
> kubernetes:1.14.2
> kubernetes-credentials-provider:0.10
> timestamper:1.8.10
> locale:1.4
>
> I'd appreciate any help.
>
> --Reinhard
>
>
> On Monday, August 20, 2018 at 4:39:57 PM UTC+2, Carlos Sanchez wrote:
>>
>> Have you tried configuration as code plugin?
>>
>> On Mon, Aug 20, 2018, 15:54 Alex <[email protected]> wrote:
>>
>>> I am trying to configure the kubernetes plugin by using groovy at
>>> startup.
>>>
>>> The problem that I have is that I can see the configuration in the
>>> "Configure System" menu, but it's not working unless i click on "Save"
>>>
>>> This is my groovy:
>>>
>>> import org.csanchez.jenkins.plugins.kubernetes.*
>>> import jenkins.model.*
>>>
>>> def jenkins_instance = Jenkins.instance
>>> def kubernetes = new KubernetesCloud('Kubernetes')
>>>
>>> // Configure Kubernetes Cloud
>>> kubernetes.setNamespace('jenkins')
>>> kubernetes.setJenkinsUrl(jenkins_instance.getRootUrl())
>>> kubernetes.setMaxRequestsPerHostStr('30')
>>> kubernetes.setConnectTimeout(30)
>>> kubernetes.setReadTimeout(30)
>>> kubernetes.setUsageRestricted(false)
>>>
>>> // Configure Jenkins Slave Container
>>> jenkins_slave_image = System.getenv('JENKINS_SLAVE_IMAGE').toString()
>>> def jenkins_container = new ContainerTemplate('jenkins-slave',
>>> jenkins_slave_image)
>>> jenkins_container.setTtyEnabled(true)
>>> jenkins_container.setName('jeknins-slave')
>>>
>>> // Configure Jenkins Slave Pods
>>> def jenkins_slave_pod = new PodTemplate()
>>> jenkins_slave_pod.setNamespace('jenkins')
>>> jenkins_slave_pod.setName('jenkins-slave')
>>> jenkins_slave_pod.setContainers([jenkins_container])
>>> jenkins_slave_pod.save()
>>>
>>> // Save Changes
>>> kubernetes.addTemplate(jenkins_slave_pod)
>>> jenkins_instance.clouds.removeAll(KubernetesCloud)
>>> jenkins_instance.clouds.addAll(kubernetes)
>>> jenkins_instance.save()
>>>
>>> Any thoughts on this?
>>>
>>>
>>> --
>>> 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/85bd4d52-5083-4536-ae26-61370ac984a4%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/jenkinsci-users/85bd4d52-5083-4536-ae26-61370ac984a4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
--
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/9b6dafc3-4b41-4ffd-812b-9296cc9f273e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.