【问题标题】:jenkins kubernetes-plugin set idletimeout in pipelinejenkins kubernetes-plugin 在管道中设置 idletimeout
【发布时间】:2017-08-16 08:48:14
【问题描述】:

config podTemplate 时如何在管道中设置Time in minutes to retain slave when idleMax number of instances

我在 System->Could->kubernetes 中看到了这两个配置选项。但是我使用管道,我没有弄清楚如何设置它们。

现在我的管道如下所示。

podTemplate(label: 'docker-go',
  containers: [
        containerTemplate(
            name: 'jnlp',
            image: 'docker.mydomain.com/library/jnlp-slave:2.62',
            command: '',
            args: '${computer.jnlpmac} ${computer.name}',
        ),
        containerTemplate(name: 'docker', image: 'docker.mydomain.com/library/docker:1.12.6', ttyEnabled: true, command: 'cat'),
        containerTemplate(name: 'golang', image: 'docker.mydomain.com/library/golang:1.8.3', ttyEnabled: true, command: '')
  ],
  volumes: [hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')]
  ) {

  def image_tag = "docker.mydomain.com/deploy-demo/demo-go:v0.1"
  def workdir = "/go/src/demo-go"
  node('docker-go') {
    stage('setup') {

    }

    stage('clone') {
    }
    stage('compile') {

    }
    stage('build and push image') {
    }
  }
}

【问题讨论】:

    标签: jenkins kubernetes jenkins-plugins jenkins-pipeline


    【解决方案1】:

    好的,我知道了

    添加这两个。 idleMinutes: 10 instanceCap: 10

    podTemplate(label: 'docker-go',
      containers: [
            containerTemplate(
                name: 'jnlp',
                image: 'docker.mydomain.com/library/jnlp-slave:2.62',
                command: '',
                args: '${computer.jnlpmac} ${computer.name}',
            ),
            containerTemplate(name: 'docker', image: 'docker.mydomain.com/library/docker:1.12.6', ttyEnabled: true, command: 'cat'),
            containerTemplate(name: 'golang', image: 'docker.mydomain.com/library/golang:1.8.3', ttyEnabled: true, command: '')
      ],
      volumes: [hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')],
      idleMinutes: 10
      instanceCap: 10
      ) {
    
      def image_tag = "docker.mydomain.com/deploy-demo/demo-go:v0.1"
      def workdir = "/go/src/demo-go"
      node('docker-go') {
        stage('setup') {
    
        }
    
        stage('clone') {
        }
        stage('compile') {
    
        }
        stage('build and push image') {
        }
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-28
      • 1970-01-01
      • 2021-09-20
      • 2020-12-22
      • 2017-08-31
      • 1970-01-01
      相关资源
      最近更新 更多