helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

Agent type "Kubernetes" creates jnlp container with wrong image

Open leandro-loos opened this issue 2 years ago • 0 comments

Describe the bug

When defining the kubernetes agent with extra containers running on a pipeline definition the default jnlp container uses the image jenkins/inbound-agent:4.11-1-jdk11 instead of whatever is defined on the values for agent image and I cannot find anywhere to modify this behavior.

This can be overridden on the agent definition by adding the desired image to the jnlp container, but this means that if there is a new agent image, every Jenkinsfile needs to be updated.

This is a particularly bothersome issue for our use-case because we use artifactory as a docker registry and agents run on subnets with no access to public repos. I feel like this should be configurable on the chart somehow

Version of Helm and Kubernetes

- Helm: v3.8.1
- Kubernetes: v1.21

Chart version

4.1.13

What happened?

1. Create a Jenkinsfile with a Kubernetes agent, for example:
pipeline {
    agent {
        kubernetes {
            yaml '''
apiVersion: v1
kind: Pod
spec:
  containers:
  - name: python
    image: python:latest
    command:
    - sleep
    args:
    - infinity
    '''
            defaultContainer 'python'
        }
    }

    stages {
        stage('Run'){
            steps {
                sh 'python --version'
            }
        }
    }
}

2. Run the pipeline
3. Verify that it ran with the agent using `jenkins/inbound-agent:4.11-1-jdk11`

What you expected to happen?

I would expect the jnlp container to run with the default image selected for the agent on the chart

How to reproduce it

No response

Anything else we need to know?

No response

leandro-loos avatar Jul 27 '22 19:07 leandro-loos