Bug 2034839

Summary: Jenkins sync plugin does not synchronize ConfigMap having label role=jenkins-agent
Product: OpenShift Container Platform Reporter: Priti Kumari <pkumari>
Component: JenkinsAssignee: Akram Ben Aissi <abenaiss>
Status: CLOSED ERRATA QA Contact: Priti Kumari <pkumari>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.10CC: abenaiss, aos-bugs, gmontero, pbhattac, spandura
Target Milestone: ---   
Target Release: 4.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
* Before this update, performance improvements in version 1.0.48 of the OpenShift Sync Jenkins plug-in incorrectly specified the labels accepted for `ConfigMap` and `ImageStream` objects intended to map into the Jenkins Kubernetes plug-in pod templates. As a result, the plug-in no longer imported pod templates from `ConfigMap` and `ImageStream` objects with the 'jenkins-agent' label. + This update corrects accepted label specification so that the plug-in imports pod templates from `ConfigMap` and `ImageStream` objects that have the 'jenkins-agent' label. (link:https://bugzilla.redhat.com/show_bug.cgi?id=2034839[2034839])
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-12 04:39:45 UTC Type: Bug
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: 2038961    

Description Priti Kumari 2021-12-22 10:20:54 UTC
Description of problem:

Jenkins sync plugin does not synchronize ConfigMap having label role=jenkins-agent but only role=jenkins-slave on 4.x 

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


How reproducible: Always


Steps to Reproduce:

1. create a project. Just say testing
2. Create ConfigMap as suggested in https://docs.openshift.com/container-platform/4.9/openshift_images/using_images/images-other-jenkins.html#images-other-jenkins-config-kubernetes_images-other-jenkins with PodTemplate

e.g.

```
kind: ConfigMap
apiVersion: v1
metadata:
  name: my-pod-template
  labels:
    role: jenkins-agent
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>
```

3. Restart Jenkins (ex - delete the Jenkins pod)
4. 

Actual results:

Can not find the configmap in the logs. However once changed the configmap label to `role=jenkins-slave` sync works properly.

Logs with role=jenkins-agent

```
2021-12-22 07:56:21 INFO    io.fabric8.jenkins.openshiftsync.ConfigMapInformer start Starting configMap informer for {} !!testing
2021-12-22 07:56:21 INFO    io.fabric8.jenkins.openshiftsync.ConfigMapInformer start ConfigMap informer started for namespace: {}testing
2021-12-22 07:56:21 INFO    io.fabric8.jenkins.openshiftsync.ImageStreamInformer start Starting ImageStream informer for {} !!testing
2021-12-22 07:56:21 INFO    io.fabric8.jenkins.openshiftsync.ImageStreamInformer start ImageStream informer started for namespace: {}testing
2021-12-22 07:56:21 INFO    io.fabric8.jenkins.openshiftsync.SecretInformer start Starting secret informer {} !!testing
```

Logs with role=jenkins-slave

```
2021-12-22 10:14:09 INFO    org.openshift.jenkins.plugins.openshiftlogin.OpenShiftOAuth2SecurityRealm initializeHttpsProxyAuthenticator Checking if HTTPS proxy initialization is required ... 
2021-12-22 10:14:09 INFO    io.fabric8.jenkins.openshiftsync.ConfigMapInformer onAdd ConfigMap informer received add event for: {}my-pod-template
2021-12-22 10:14:09 INFO    io.fabric8.jenkins.openshiftsync.BuildInformer onAdd Build informer received add event for: {}openshift-jee-sample-1
2021-12-22 10:14:09 INFO    io.fabric8.jenkins.openshiftsync.PodTemplateUtils addAgents Adding PodTemplate(s) for testing
```


Expected results:

configmap wit label role=jenkins-agent should sync with jenkins plugin.

Additional info:

Comment 2 Gabe Montero 2022-01-10 16:08:46 UTC
Need to do Jenkins image plugin bump ... moving back to Post

Comment 11 errata-xmlrpc 2022-03-12 04:39:45 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 (Moderate: OpenShift Container Platform 4.10.3 security update), 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/RHSA-2022:0056

Comment 12 Red Hat Bugzilla 2023-09-15 01:18:22 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days