Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1755812

Summary: oc apply does not update configmap with role jenkins-slave
Product: OpenShift Container Platform Reporter: Vibhav Bobade <vbobade>
Component: JenkinsAssignee: Akram Ben Aissi <abenaiss>
Status: CLOSED ERRATA QA Contact: Walid A. <wabouham>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.3.0CC: abenaiss, calfonso, travi, vbobade, wabouham, xiuwang
Target Milestone: ---   
Target Release: 4.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1754468
: 1773434 (view as bug list) Environment:
Last Closed: 2020-05-13 21:25:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1773434    

Description Vibhav Bobade 2019-09-26 09:24:54 UTC
+++ This bug was initially created as a clone of Bug #1754468 +++

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 XiuJuan Wang 2019-10-17 10:55:13 UTC
If openshift-sync-plugin need to update to 1.0.43 to include the fix?
openshift-sync-plugin in latest 4.3 jenkins version is 1.0.41.
 
Payload version: 4.3.0-0.nightly-2019-10-16-194525

Comment 4 XiuJuan Wang 2019-10-18 08:27:13 UTC
Still could reproduce this issue, updating configmap via 'oc apply -f' don't reflect in jenkins configures.

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 

Test with 4.3.0-0.nightly-2019-10-17-202206,
openshift-sync-plugin is 1.0.41.

Comment 6 XiuJuan Wang 2019-10-18 09:51:21 UTC
@Ravi Thank you, updated openshift-sync-plugin to 1.0.42 could resove the bug issue.
Let's wait the 4.3 jenkins to include openshift-sync-plugin 1.0.42

Comment 8 XiuJuan Wang 2019-11-04 06:06:25 UTC
Payload 4.3.0-0.nightly-2019-11-02-092336
The default installed openshift-sync-plugin is still 1.0.41.

sh-4.2$ cat /var/lib/jenkins/plugins/openshift-sync/META-INF/maven/io.fabric8.jenkins.plugins/openshift-sync/pom.properties 
#Generated by Maven
#Mon Aug 12 23:53:56 CEST 2019
version=1.0.41
groupId=io.fabric8.jenkins.plugins
artifactId=openshift-sync

Wait for new build bump out

Comment 9 XiuJuan Wang 2019-11-08 03:38:34 UTC
Wait for https://jira.coreos.com/browse/ART-1239 processing

Comment 10 Walid A. 2019-11-15 22:24:41 UTC
Verified that the second pod template2 is showing up after `oc apply -f` on the modified v2.yaml (where we added pod template2). Shows up also in last-applied-configuration section.

OCP version:
4.3.0-0.nightly-2019-11-13-233341

# oc get -oyaml cm jenkins-slave
apiVersion: v1
data:
  template1: |-
    <org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
      <inheritFrom>maven</inheritFrom>
      <name>profile1</name>
      <instanceCap>2147483647</instanceCap>
      <idleMinutes>0</idleMinutes>
      <label>profile1</label>
      <serviceAccount>jenkins</serviceAccount>
      <nodeSelector></nodeSelector>
      <volumes>
        <org.csanchez.jenkins.plugins.kubernetes.volumes.PersistentVolumeClaim>
          <mountPath>/home/jenkins/.m2/repository</mountPath>
          <claimName>jenkins-maven</claimName>
          <readOnly>false</readOnly>
        </org.csanchez.jenkins.plugins.kubernetes.volumes.PersistentVolumeClaim>
      </volumes>
      <containers>
        <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
          <name>jnlp</name>
          <image>repo/image:3.11-2</image>
          <privileged>false</privileged>
          <alwaysPullImage>true</alwaysPullImage>
          <workingDir>/tmp</workingDir>
          <command></command>
          <args>${computer.jnlpmac} ${computer.name}</args>
          <ttyEnabled>false</ttyEnabled>
          <resourceRequestCpu>1</resourceRequestCpu>
          <resourceRequestMemory>2Gi</resourceRequestMemory>
          <resourceLimitCpu>1</resourceLimitCpu>
          <resourceLimitMemory>2Gi</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>
      <name>profile2</name>
      <inheritFrom></inheritFrom>
      <instanceCap>2147483647</instanceCap>
      <idleMinutes>0</idleMinutes>
      <label>test-1</label>
      <serviceAccount>jenkins</serviceAccount>
      <nodeSelector></nodeSelector>
      <volumes>
        <org.csanchez.jenkins.plugins.kubernetes.volumes.PersistentVolumeClaim>
          <mountPath>/home/jenkins/.m2</mountPath>
          <claimName>jenkins-openjdk-11</claimName>
          <readOnly>false</readOnly>
        </org.csanchez.jenkins.plugins.kubernetes.volumes.PersistentVolumeClaim>
        <emptyDirVolume>
          <memory>true</memory>
          <mountPath>/tmp</mountPath>
        </emptyDirVolume>
      </volumes>
      <containers>
        <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
          <name>jnlp</name>
          <image>repo/image-openjdk-11:3.11-1</image>
          <privileged>false</privileged>
          <alwaysPullImage>true</alwaysPullImage>
          <workingDir>/tmp</workingDir>
          <command></command>
          <args>${computer.jnlpmac} ${computer.name}</args>
          <ttyEnabled>false</ttyEnabled>
          <resourceRequestCpu>1</resourceRequestCpu>
          <resourceRequestMemory>2Gi</resourceRequestMemory>
          <resourceLimitCpu>2</resourceLimitCpu>
          <resourceLimitMemory>4Gi</resourceLimitMemory>
          <envVars/>
        </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
      </containers>
      <envVars/>
      <annotations/>
      <imagePullSecrets/>
      <nodeProperties/>
    </org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
kind: ConfigMap
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","data":{"template1":"\u003corg.csanchez.jenkins.plugins.kubernetes.PodTemplate\u003e\n  \u003cinheritFrom\u003emaven\u003c/inheritFrom\u003e\n  \u003cname\u003eprofile1\u003c/name\u003e\n  \u003cinstanceCap\u003e2147483647\u003c/instanceCap\u003e\n  \u003cidleMinutes\u003e0\u003c/idleMinutes\u003e\n  \u003clabel\u003eprofile1\u003c/label\u003e\n  \u003cserviceAccount\u003ejenkins\u003c/serviceAccount\u003e\n  \u003cnodeSelector\u003e\u003c/nodeSelector\u003e\n  \u003cvolumes\u003e\n    \u003corg.csanchez.jenkins.plugins.kubernetes.volumes.PersistentVolumeClaim\u003e\n      \u003cmountPath\u003e/home/jenkins/.m2/repository\u003c/mountPath\u003e\n      \u003cclaimName\u003ejenkins-maven\u003c/claimName\u003e\n      \u003creadOnly\u003efalse\u003c/readOnly\u003e\n    \u003c/org.csanchez.jenkins.plugins.kubernetes.volumes.PersistentVolumeClaim\u003e\n  \u003c/volumes\u003e\n  \u003ccontainers\u003e\n    \u003corg.csanchez.jenkins.plugins.kubernetes.ContainerTemplate\u003e\n      \u003cname\u003ejnlp\u003c/name\u003e\n      \u003cimage\u003erepo/image:3.11-2\u003c/image\u003e\n      \u003cprivileged\u003efalse\u003c/privileged\u003e\n      \u003calwaysPullImage\u003etrue\u003c/alwaysPullImage\u003e\n      \u003cworkingDir\u003e/tmp\u003c/workingDir\u003e\n      \u003ccommand\u003e\u003c/command\u003e\n      \u003cargs\u003e${computer.jnlpmac} ${computer.name}\u003c/args\u003e\n      \u003cttyEnabled\u003efalse\u003c/ttyEnabled\u003e\n      \u003cresourceRequestCpu\u003e1\u003c/resourceRequestCpu\u003e\n      \u003cresourceRequestMemory\u003e2Gi\u003c/resourceRequestMemory\u003e\n      \u003cresourceLimitCpu\u003e1\u003c/resourceLimitCpu\u003e\n      \u003cresourceLimitMemory\u003e2Gi\u003c/resourceLimitMemory\u003e\n      \u003cenvVars/\u003e\n    \u003c/org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate\u003e\n  \u003c/containers\u003e\n  \u003cenvVars/\u003e\n  \u003cannotations/\u003e\n  \u003cimagePullSecrets/\u003e\n  \u003cnodeProperties/\u003e\n\u003c/org.csanchez.jenkins.plugins.kubernetes.PodTemplate\u003e","template2":"\u003corg.csanchez.jenkins.plugins.kubernetes.PodTemplate\u003e\n  \u003cname\u003eprofile2\u003c/name\u003e\n  \u003cinheritFrom\u003e\u003c/inheritFrom\u003e\n  \u003cinstanceCap\u003e2147483647\u003c/instanceCap\u003e\n  \u003cidleMinutes\u003e0\u003c/idleMinutes\u003e\n  \u003clabel\u003etest-1\u003c/label\u003e\n  \u003cserviceAccount\u003ejenkins\u003c/serviceAccount\u003e\n  \u003cnodeSelector\u003e\u003c/nodeSelector\u003e\n  \u003cvolumes\u003e\n    \u003corg.csanchez.jenkins.plugins.kubernetes.volumes.PersistentVolumeClaim\u003e\n      \u003cmountPath\u003e/home/jenkins/.m2\u003c/mountPath\u003e\n      \u003cclaimName\u003ejenkins-openjdk-11\u003c/claimName\u003e\n      \u003creadOnly\u003efalse\u003c/readOnly\u003e\n    \u003c/org.csanchez.jenkins.plugins.kubernetes.volumes.PersistentVolumeClaim\u003e\n    \u003cemptyDirVolume\u003e\n      \u003cmemory\u003etrue\u003c/memory\u003e\n      \u003cmountPath\u003e/tmp\u003c/mountPath\u003e\n    \u003c/emptyDirVolume\u003e\n  \u003c/volumes\u003e\n  \u003ccontainers\u003e\n    \u003corg.csanchez.jenkins.plugins.kubernetes.ContainerTemplate\u003e\n      \u003cname\u003ejnlp\u003c/name\u003e\n      \u003cimage\u003erepo/image-openjdk-11:3.11-1\u003c/image\u003e\n      \u003cprivileged\u003efalse\u003c/privileged\u003e\n      \u003calwaysPullImage\u003etrue\u003c/alwaysPullImage\u003e\n      \u003cworkingDir\u003e/tmp\u003c/workingDir\u003e\n      \u003ccommand\u003e\u003c/command\u003e\n      \u003cargs\u003e${computer.jnlpmac} ${computer.name}\u003c/args\u003e\n      \u003cttyEnabled\u003efalse\u003c/ttyEnabled\u003e\n      \u003cresourceRequestCpu\u003e1\u003c/resourceRequestCpu\u003e\n      \u003cresourceRequestMemory\u003e2Gi\u003c/resourceRequestMemory\u003e\n      \u003cresourceLimitCpu\u003e2\u003c/resourceLimitCpu\u003e\n      \u003cresourceLimitMemory\u003e4Gi\u003c/resourceLimitMemory\u003e\n      \u003cenvVars/\u003e\n    \u003c/org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate\u003e\n  \u003c/containers\u003e\n  \u003cenvVars/\u003e\n  \u003cannotations/\u003e\n  \u003cimagePullSecrets/\u003e\n  \u003cnodeProperties/\u003e\n\u003c/org.csanchez.jenkins.plugins.kubernetes.PodTemplate\u003e"},"kind":"ConfigMap","metadata":{"annotations":{},"creationTimestamp":"2019-11-15T22:06:01Z","labels":{"role":"jenkins-slave"},"name":"jenkins-slave","namespace":"default","resourceVersion":"518106","selfLink":"/api/v1/namespaces/default/configmaps/jenkins-slave","uid":"3ec9fb01-c7ec-44c5-b4b4-3f9a3351a9ab"}}
  creationTimestamp: "2019-11-15T22:06:01Z"
  labels:
    role: jenkins-slave
  name: jenkins-slave
  namespace: default
  resourceVersion: "519409"
  selfLink: /api/v1/namespaces/default/configmaps/jenkins-slave
  uid: 3ec9fb01-c7ec-44c5-b4b4-3f9a3351a9ab

Comment 12 errata-xmlrpc 2020-05-13 21:25:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0062

Comment 13 Red Hat Bugzilla 2023-09-14 05:43:48 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days