Bug 1754468 - oc apply does not update configmap with role jenkins-slave
Summary: oc apply does not update configmap with role jenkins-slave
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Jenkins
Version: 3.11.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Vibhav Bobade
QA Contact: XiuJuan Wang
URL:
Whiteboard:
Depends On:
Blocks: 1773432
TreeView+ depends on / blocked
 
Reported: 2019-09-23 10:56 UTC by Ravi Trivedi
Modified: 2020-06-04 07:24 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1755812 1773432 (view as bug list)
Environment:
Last Closed: 2020-06-04 07:24:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 4509641 0 None None None 2019-10-17 09:35:44 UTC

Description Ravi Trivedi 2019-09-23 10:56:17 UTC
Description of problem:

With reference to doc[1], a user can define a configmap with label role: jenkins-slave with kubernetes plugin data.

Now, when the configmap is populated using `oc create -f <file>`, it works fine. however, if any update is done to the configmap using `oc apply -f <file>` then the updated part is not reflected in Jenkins configuration.

[1] - https://docs.openshift.com/container-platform/3.11/using_images/other_images/jenkins.html#configuring-the-jenkins-kubernetes-plug-in

Version-Release number of selected component (if applicable):

OCP 3.11 

How reproducible:

Always

Steps to Reproduce:
1. oc create -f v1.yaml --save-config=true
2. oc get -oyaml cm jenkins-slave > v2.yaml
3. vi v2.yaml (#Add new kubernetes pod template)
4. oc apply -f v2.yaml 

Actual results:

`oc apply` command does not update the configmap.

Expected results:

Updates are handled in Jenkins configuration using `oc apply` command too.

Additional info:

However, when I run the following steps in continuation, the new pod template is reflected as expected:

1. oc delete cm jenkins-slave
2. oc create -f v2.yaml --save-config=true

REMARKS:

1. The `oc apply` command correctly updates the configmap resource.
2. But the apply command does not reflect the actual value of configmap in Jenkins configuration.
3. The very same yaml file when used with `oc create` command, creates the right configuration as expected.

WORKAROUND:

1. To delete existing configmap and create the intended configmap from scratch to get it reflected as expected in Jenkins configuration.

Comment 3 Vibhav Bobade 2019-09-26 09:45:33 UTC
We are planning to release the new version of the plugin by cutting a new release of Jenkins in the coming few weeks.

Wrt Openshift 4.3 we ahve already resolved the issue and would be cutting a new release for the plugin this week.
https://bugzilla.redhat.com/show_bug.cgi?id=1755812 <- 4.3

@Ravi We must ask the customer to use the latest version of the plugin which will be i.e. 1.0.42
Will update it here as we are done with the release.

Regards,
Vibhav

Comment 6 Akram Ben Aissi 2020-06-03 13:01:56 UTC
Triage:
this is related to 3.11 , and will be fixed in 3.11.z

Comment 8 Vibhav Bobade 2020-06-04 02:14:07 UTC
Hello Team,

I am not able to reproduce this on a 3.11 cluster and seems that the config.xml is being properly populated on oc apply without and issues.
Following are the steps for reproduction I used.

1> Create ConfigMap no.1 with name testconfigmap1.yaml


```
kind: ConfigMap
apiVersion: v1
metadata:
  name: jenkins-agent
  labels:
    role: jenkins-slave
data:
  template1: |-
    <org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
      <inheritFrom></inheritFrom>
      <name>template1</name>
      <instanceCap>2147483647</instanceCap>
      <idleMinutes>0</idleMinutes>
      <label>template1</label>
      <serviceAccount>jenkins</serviceAccount>
      <nodeSelector></nodeSelector>
      <volumes/>
      <containers>
        <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
          <name>jnlp</name>
          <image>openshift/jenkins-agent-maven-35-centos7:v3.10</image>
          <privileged>false</privileged>
          <alwaysPullImage>true</alwaysPullImage>
          <workingDir>/tmp</workingDir>
          <command></command>
          <args>${computer.jnlpmac} ${computer.name}</args>
          <ttyEnabled>false</ttyEnabled>
          <resourceRequestCpu></resourceRequestCpu>
          <resourceRequestMemory></resourceRequestMemory>
          <resourceLimitCpu></resourceLimitCpu>
          <resourceLimitMemory></resourceLimitMemory>
          <envVars/>
        </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
      </containers>
      <envVars/>
      <annotations/>
      <imagePullSecrets/>
      <nodeProperties/>
    </org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
```


2> Duplicate testconfigmap1.yaml with the following which contains a duplicate of template1 which goes by the name template2.

```
kind: ConfigMap
metadata:
  labels:
    role: jenkins-slave
  name: jenkins-agent
apiVersion: v1
data:
  template1: |-
    <org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
      <inheritFrom></inheritFrom>
      <name>template1</name>
      <instanceCap>2147483647</instanceCap>
      <idleMinutes>0</idleMinutes>
      <label>template1</label>
      <serviceAccount>jenkins</serviceAccount>
      <nodeSelector></nodeSelector>
      <volumes/>
      <containers>
        <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
          <name>jnlp</name>
          <image>openshift/jenkins-agent-maven-35-centos7:v3.10</image>
          <privileged>false</privileged>
          <alwaysPullImage>true</alwaysPullImage>
          <workingDir>/tmp</workingDir>
          <command></command>
          <args>${computer.jnlpmac} ${computer.name}</args>
          <ttyEnabled>false</ttyEnabled>
          <resourceRequestCpu></resourceRequestCpu>
          <resourceRequestMemory></resourceRequestMemory>
          <resourceLimitCpu></resourceLimitCpu>
          <resourceLimitMemory></resourceLimitMemory>
          <envVars/>
        </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
      </containers>
      <envVars/>
      <annotations/>
      <imagePullSecrets/>
      <nodeProperties/>
    </org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
  template2: |-
    <org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
      <inheritFrom></inheritFrom>
      <name>template2</name>
      <instanceCap>2147483647</instanceCap>
      <idleMinutes>0</idleMinutes>
      <label>template2</label>
      <serviceAccount>jenkins</serviceAccount>
      <nodeSelector></nodeSelector>
      <volumes/>
      <containers>
        <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
          <name>jnlp</name>
          <image>openshift/jenkins-agent-maven-35-centos7:v3.10</image>
          <privileged>false</privileged>
          <alwaysPullImage>true</alwaysPullImage>
          <workingDir>/tmp</workingDir>
          <command></command>
          <args>${computer.jnlpmac} ${computer.name}</args>
          <ttyEnabled>false</ttyEnabled>
          <resourceRequestCpu></resourceRequestCpu>
          <resourceRequestMemory></resourceRequestMemory>
          <resourceLimitCpu></resourceLimitCpu>
          <resourceLimitMemory></resourceLimitMemory>
          <envVars/>
        </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
      </containers>
      <envVars>
      <envVars>
        <org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
            <key>SOME_CACHE_FOLDER</key>
            <value>/dev/shm/somw_cache</value>
        </org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
        <org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
            <key>http_proxy</key>
            <value>proxy.proxy.proxy</value>
        </org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
      </envVars>
      <annotations/>
      <imagePullSecrets/>
      <nodeProperties/>
    </org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
```


3> oc create -f testconfigmap1.yaml

Check config.xml, template1 added to templates


4> oc apply -f testconfigmap2.yaml

Check config.xml, template2 added to templates

`oc get configmap jenkins-agent -o yaml` returns the correct configmap data


5> oc apply -f testconfigmap1.yaml

Check config.xml, template2 removed from templates

`oc get configmap jenkins-agent -o yaml` returns the correct configmap data


This bug can be closed as it as already fixed as I see based on this. 
Let me know if I am missing anything.

Regards,

Comment 10 Akram Ben Aissi 2020-06-04 07:24:16 UTC
closing it then
it has been fixed here: https://github.com/openshift/jenkins/commit/fc180707410e3e1f5b0636dc20b3ef3f18d741a5


Note You need to log in before you can comment on or make changes to this bug.