BSI Jenkins Helm Chart EnvVar Bug
search cancel

BSI Jenkins Helm Chart EnvVar Bug

book

Article ID: 427824

calendar_today

Updated On:

Products

VMware Tanzu Platform - Kubernetes

Issue/Introduction

When upgrading to Jenkins Helm Chart v13.9.2 with a base os of Photon 5 you'll run into the error below.

 

Error: java.lang.IllegalArgumentException: Single entry map expected to configure a org.csanchez.jenkins.plugins.kubernetes.model.TemplateEnvVar

 

It relates to the Pod Template that is generated in the CasC configmap for the kubernetes plugin. This is generated due to having agent.enabled set to true in our values.yaml in the helm chart. The envVars that are generated are in an incorrect format in templates/casc-cm.yaml.

It's generating a pod template similar to:   

            templates:
              - name: jenkins-agent
                label: "kubernetes-agent"
                namespace: default
                id: "agent-template"
                containers:
                  - name: jnlp
                    alwaysPullImage: false
                    envVars:
                      - name: OPENSSL_FIPS
                        value: "no"
                      - name: JAVA_TOOL_OPTIONS
                        value: "-Djava.security.properties==/opt/bitnami/java/conf/security/java.security.relaxed"
                    image: us-#####-####.###.###/vmw-app-catalog/hosted-registry-#########/containers/photon-5/jenkins-agent:0.3355.0-photon-5-r3

 

The template should look similar to this instead:

      templates:
      - containers:
        - alwaysPullImage: false
          envVars:
          - envVar:
              key: OPENSSL_FIPS
              value: "no"
          - envVar:
              key: JAVA_TOOL_OPTIONS
              value: -Djava.security.properties==/opt/bitnami/java/conf/security/java.security.relaxed
          image: us-#####-####.###.###/vmw-app-catalog/hosted-registry-#########/containers/photon-5/jenkins-agent:0.3355.0-photon-5-r3                 name: jnlp
          resourceLimitCpu: 750m
          resourceLimitMemory: 768Mi
          resourceRequestCpu: 500m
          resourceRequestMemory: 512Mi
        id: agent-template
        label: kubernetes-agent
        name: jenkins-agent
        namespace: jenkins-bsi

Environment

Jenkins Helm Chart 13.9.2 

This is using the latest version (4423.vb_59f230b_ce53) and the latest CasC plugin (2037.v8e5349845172).

Cause

This seems to be caused by a schema mismatch between the Jenkins Helm Chart's casc-cm.yaml template and the latest version of the Jenkins Kubernetes plugin (v4423.vb_59f230b_ce53).

CasC is looking for the wrapper key (envVar) but is finding a direct list of properties instead.

Error: java.lang.IllegalArgumentException: Single entry map expected to configure a org.csanchez.jenkins.plugins.kubernetes.model.TemplateEnvVar 

Resolution

Upgrade to Jenkins Helm Chart Version 13.11.0.