Bug 1836032 - unable to recognize no matches for kind "servicemonitor.monitoring.coreos.com" in version "monitoring.coreos.com/v1"
Summary: unable to recognize no matches for kind "servicemonitor.monitoring.coreos.com...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Jenkins
Version: 4.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.6.0
Assignee: Vibhav Bobade
QA Contact: Jitendar Singh
URL:
Whiteboard:
: 1852997 (view as bug list)
Depends On:
Blocks: 1845495 1846145 1849729
TreeView+ depends on / blocked
 
Reported: 2020-05-15 01:02 UTC by Michael Greenberg
Modified: 2023-12-15 17:55 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1849729 (view as bug list)
Environment:
Last Closed: 2020-10-27 15:59:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift cluster-samples-operator pull 289 0 None closed Bug 1836032: Fix Jenkins Monitored templates typo and other updates 2021-02-19 08:31:51 UTC
Github openshift jenkins pull 1055 0 None closed Bug 1836032: Fix kind in ServiceMonitor for persistent template 2021-02-19 08:31:51 UTC
Red Hat Product Errata RHBA-2020:4196 0 None None None 2020-10-27 15:59:58 UTC

Description Michael Greenberg 2020-05-15 01:02:33 UTC
Description of problem:

On OCP 4.4 creation of a template jenkins-persistent-monitored fails with the message:
unable to recognize no matches for kind "servicemonitor.monitoring.coreos.com" in version "monitoring.coreos.com/v1"

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


How reproducible:


Steps to Reproduce:
1. oc process jenkins-persistent-monitored -n openshift | oc create -f -

Actual results:
unable to recognize no matches for kind "servicemonitor.monitoring.coreos.com" in version "monitoring.coreos.com/v1"


Expected results:
servicemonitor.monitoring.coreos.com/jenkins-persistent-monitored created


Additional info:
There appears to be a bug in the template:
$ oc get template/jenkins-persistent-monitored -n openshift -o yaml | grep coreos
- apiVersion: monitoring.coreos.com/v1
  kind: ' servicemonitor.monitoring.coreos.com'

Perhaps "kind:" should be of type "ServiceMonitor"?

Comment 6 Fernando Lozano 2020-05-20 15:23:43 UTC
I am afraid there's more to fix on that template than the service monitor resource name and api. Jenkins fail to start with the proposed workaround:

[flozano@flozano ~]$ oc process jenkins-persistent-monitored -n openshift | sed 's/" servicemonitor.monitoring.coreos.com"/"ServiceMonitor"/' |  oc create -f -
route.route.openshift.io/jenkins created
persistentvolumeclaim/jenkins created
deploymentconfig.apps.openshift.io/jenkins created
serviceaccount/jenkins created
rolebinding.authorization.openshift.io/jenkins_edit created
service/jenkins-jnlp created
service/jenkins created
servicemonitor.monitoring.coreos.com/jenkins-persistent-monitored created
[flozano@flozano ~]$ 
[flozano@flozano ~]$ oc status
In project test-jenkins on server https://api.ocp-flozano3.do280.dev.nextcle.com:6443

svc/jenkins-jnlp - 172.30.36.4:50000
https://jenkins-test-jenkins.apps.ocp-flozano3.do280.dev.nextcle.com (redirects) (svc/jenkins)
  dc/jenkins deploys openshift/jenkins:2 
    deployment #1 running for about a minute - 0/1 pods (warning: 2 restarts)

1 warning identified, use 'oc status --suggest' to see details.

[flozano@flozano ~]$ oc status
In project test-jenkins on server https://api.ocp-flozano3.do280.dev.nextcle.com:6443

svc/jenkins-jnlp - 172.30.36.4:50000
https://jenkins-test-jenkins.apps.ocp-flozano3.do280.dev.nextcle.com (redirects) (svc/jenkins)
  dc/jenkins deploys openshift/jenkins:2 
    deployment #1 running for about a minute - 0/1 pods (warning: 2 restarts)

1 warning identified, use 'oc status --suggest' to see details.
[flozano@flozano ~]$ oc status
In project test-jenkins on server https://api.ocp-flozano3.do280.dev.nextcle.com:6443

svc/jenkins-jnlp - 172.30.36.4:50000
https://jenkins-test-jenkins.apps.ocp-flozano3.do280.dev.nextcle.com (redirects) (svc/jenkins)
  dc/jenkins deploys openshift/jenkins:2 
    deployment #1 running for 3 minutes - 0/1 pods (warning: 3 restarts)

Errors:
  * pod/jenkins-1-z5c95 is crash-looping

1 error identified, use 'oc status --suggest' to see details.

[flozano@flozano ~]$ oc logs jenkins-1-z5c95
2020/05/20 15:03:47 [go-init] No pre-start command defined, skip
2020/05/20 15:03:47 [go-init] Main command launched : /usr/libexec/s2i/run

[flozano@flozano ~]$ oc logs jenkins-1-z5c95
2020/05/20 15:03:47 [go-init] No pre-start command defined, skip
2020/05/20 15:03:47 [go-init] Main command launched : /usr/libexec/s2i/run

[flozano@flozano ~]$ oc logs jenkins-1-deploy
--> Scaling jenkins-1 to 1

[flozano@flozano ~]$ oc get pvc
NAME      STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
jenkins   Bound    pvc-8767d1a3-658b-4dae-98ed-d36c60c6411d   1Gi        RWO            gp2            8m42s

After a few minutes:

[flozano@flozano ~]$ oc status
In project test-jenkins on server https://api.ocp-flozano3.do280.dev.nextcle.com:6443

svc/jenkins-jnlp - 172.30.36.4:50000
https://jenkins-test-jenkins.apps.ocp-flozano3.do280.dev.nextcle.com (redirects) (svc/jenkins)
  dc/jenkins deploys openshift/jenkins:2 
    deployment #1 failed 19 minutes ago: config change

View details with 'oc describe <resource>/<name>' or list everything with 'oc get all'.

[flozano@flozano ~]$ oc get pod
NAME               READY   STATUS   RESTARTS   AGE
jenkins-1-deploy   0/1     Error    0          19m

[flozano@flozano ~]$ oc logs jenkins-1-deploy
--> Scaling jenkins-1 to 1
error: update acceptor rejected jenkins-1: pods for rc 'test-jenkins/jenkins-1' took longer than 600 seconds to become available

Comment 7 Jitendar Singh 2020-05-20 16:01:53 UTC
Re-assigning it

Comment 8 Akram Ben Aissi 2020-05-20 16:09:01 UTC
Hi flozano,

do you have anything else after:

```
[flozano@flozano ~]$ oc logs jenkins-1-z5c95
2020/05/20 15:03:47 [go-init] No pre-start command defined, skip
2020/05/20 15:03:47 [go-init] Main command launched : /usr/libexec/s2i/run
```

the pod doesn't go further?

Comment 10 Vibhav Bobade 2020-06-09 12:54:04 UTC
Hi flozano,

I wasn't able to reproduce this on a Openshift cluster. Is the image that you are building provided by redhat ? Or are you using one that is locally built ?

Knowing what came after the following logs would help.

```
[flozano@flozano ~]$ oc logs jenkins-1-z5c95
2020/05/20 15:03:47 [go-init] No pre-start command defined, skip
2020/05/20 15:03:47 [go-init] Main command launched : /usr/libexec/s2i/run
```

After the deployment fails, do capture the logs using the following command and send it to us for checking. Would be helpful for debugging the issue. 

```
$ oc logs jenkins-1-z5c95 > bug-1836032-jenkins.log
```

Regards,
Vibhav

Comment 12 Gabe Montero 2020-06-09 14:02:07 UTC
Note the short term workaround until the OCP samples pull in this fix is for an admin to manually update the template in the openshift namespace by using the contents from https://github.com/openshift/library/blob/master/official/jenkins/templates/jenkins-persistent-monitored.json
or
https://github.com/openshift/jenkins/blob/master/openshift/templates/jenkins-persistent-monitored.json

Comment 14 Jitendar Singh 2020-06-22 10:36:36 UTC
VERIFIED
====================================================================================================================== 
jsingh@localhost  ~/go/src/github.com/redhat-developer/jenkins  ➦ 1c19ede  cd openshift/templates 
 jsingh@localhost  ~/go/src/github.com/redhat-developer/jenkins/openshift/templates  ➦ 1c19ede  ls
jenkins-ephemeral.json  jenkins-ephemeral-monitored.json  jenkins-persistent.json  jenkins-persistent-monitored.json
 jsingh@localhost  ~/go/src/github.com/redhat-developer/jenkins/openshift/templates  ➦ 1c19ede  oc create -f jenkins-persistent-monitored.json 
template.template.openshift.io/jenkins-persistent-monitored created
 jsingh@localhost  ~/go/src/github.com/redhat-developer/jenkins/openshift/templates  ➦ 1c19ede  oc get pods
No resources found.
 jsingh@localhost  ~/go/src/github.com/redhat-developer/jenkins/openshift/templates  ➦ 1c19ede  oc process jenkins-persistent-monitored -n jenkins-test | oc create -f -

route.route.openshift.io/jenkins created
persistentvolumeclaim/jenkins created
configmap/jenkins-trusted-ca-bundle created
deploymentconfig.apps.openshift.io/jenkins created
serviceaccount/jenkins created
rolebinding.authorization.openshift.io/jenkins_edit created
service/jenkins-jnlp created
service/jenkins created
servicemonitor.monitoring.coreos.com/jenkins-persistent-monitored created
 jsingh@localhost  ~/go/src/github.com/redhat-developer/jenkins/openshift/templates  ➦ 1c19ede  oc get pods
NAME               READY   STATUS              RESTARTS   AGE
jenkins-1-6zzf6    0/1     ContainerCreating   0          10s
jenkins-1-deploy   1/1     Running             0          14s
====================================================================='
jsingh@localhost  ~/go/src/github.com/redhat-developer/jenkins/openshift/templates  ➦ 1c19ede  oc new-app -f https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/pipeline/samplepipeline.yaml
--> Deploying template "jenkins-test/jenkins-pipeline-example" for "https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/pipeline/samplepipeline.yaml" to project jenkins-test

     Pipeline Build Example
     ---------
     This example showcases the new Jenkins Pipeline integration in OpenShift,
     which performs continuous integration and deployment right on the platform.
     The template contains a Jenkinsfile - a definition of a multi-stage CI/CD process - that
     leverages the underlying OpenShift platform for dynamic and scalable
     builds. OpenShift integrates the status of your pipeline builds into the web
     console allowing you to see your entire application lifecycle in a single view.

     A Jenkins server must be instantiated in this project to manage
     the Pipeline BuildConfig created by this template.  You will be able to log in to
     it using your OpenShift user credentials.

     * With parameters:
        * Name=nodejs-mongodb-example
        * Application Hostname=
        * Git Repository URL=https://github.com/openshift/nodejs-ex.git
        * Database Name=sampledb
        * MongoDB Username=user14G # generated
        * MongoDB Password=cKOgekT7we1jsdUm # generated
        * Memory Limit=512Mi
        * Memory Limit (MongoDB)=512Mi
        * Database Service Name=mongodb
        * Database Administrator Password=8h4aBqSTDWco34FL # generated
        * Git Reference=
        * Context Directory=
        * GitHub Webhook Secret=QRmhNxB3QmGGwUUjtTwBSRxWRtjkRJoCXKNicGiE # generated
        * Generic Webhook Secret=mUVYkhserfWXLYETB7un2K8EVJSW5JGCIgQUKVSS # generated
        * Custom NPM Mirror URL=
        * Namespace=openshift

--> Creating resources ...
    buildconfig.build.openshift.io "sample-pipeline" created
    service "nodejs-mongodb-example" created
    route.route.openshift.io "nodejs-mongodb-example" created
    imagestream.image.openshift.io "nodejs-mongodb-example" created
    buildconfig.build.openshift.io "nodejs-mongodb-example" created
    deploymentconfig.apps.openshift.io "nodejs-mongodb-example" created
    service "mongodb" created
    deploymentconfig.apps.openshift.io "mongodb" created
--> Success
    Use 'oc start-build sample-pipeline' to start a build.
    Access your application via route 'nodejs-mongodb-example-jenkins-test.apps.dev-svc-4.4-062204.devcluster.openshift.com' 
    Use 'oc start-build nodejs-mongodb-example' to start a build.
    Run 'oc status' to view your app.
 jsingh@localhost  ~/go/src/github.com/redhat-developer/jenkins/openshift/templates  ➦ 1c19ede  oc  get pods -w
NAME               READY   STATUS              RESTARTS   AGE
jenkins-1-6zzf6    1/1     Running             0          12m
jenkins-1-deploy   0/1     Completed           0          12m
mongodb-1-64mth    1/1     Running             0          45s
mongodb-1-deploy   0/1     Completed           0          47s
nodejs-bsv0q       0/1     ContainerCreating   0          18s
nodejs-bsv0q       1/1     Running             0          19s
nodejs-mongodb-example-1-build   0/1     Pending             0          0s
nodejs-mongodb-example-1-build   0/1     Pending             0          0s
nodejs-mongodb-example-1-build   0/1     Init:0/2            0          0s
nodejs-mongodb-example-1-build   0/1     Init:0/2            0          3s
nodejs-mongodb-example-1-build   0/1     Init:0/2            0          8s
nodejs-mongodb-example-1-build   0/1     Init:1/2            0          14s
nodejs-mongodb-example-1-build   0/1     PodInitializing     0          15s
nodejs-mongodb-example-1-build   1/1     Running             0          16s
nodejs-mongodb-example-1-build   0/1     Completed           0          70s
nodejs-mongodb-example-1-build   0/1     Completed           0          70s
nodejs-bsv0q                     1/1     Terminating         0          102s
nodejs-bsv0q                     1/1     Terminating         0          102s
nodejs-mongodb-example-1-build   0/1     Completed           0          72s
nodejs-mongodb-example-1-deploy   0/1     Pending             0          0s
nodejs-mongodb-example-1-deploy   0/1     Pending             0          0s
nodejs-mongodb-example-1-deploy   0/1     ContainerCreating   0          0s
nodejs-mongodb-example-1-deploy   0/1     ContainerCreating   0          5s
nodejs-mongodb-example-1-8fj7r    0/1     Pending             0          0s
nodejs-mongodb-example-1-8fj7r    0/1     Pending             0          0s
nodejs-mongodb-example-1-8fj7r    0/1     ContainerCreating   0          0s
nodejs-mongodb-example-1-deploy   1/1     Running             0          6s
nodejs-mongodb-example-1-8fj7r    0/1     ContainerCreating   0          2s
nodejs-mongodb-example-1-8fj7r    0/1     ContainerCreating   0          5s
nodejs-mongodb-example-1-8fj7r    0/1     Running             0          13s
nodejs-mongodb-example-1-8fj7r    1/1     Running             0          18s
nodejs-mongodb-example-1-deploy   0/1     Completed           0          23s
nodejs-mongodb-example-1-deploy   0/1     Completed           0          23s
nodejs-mongodb-example-1-deploy   0/1     Completed           0          29s
===============================================================================

Comment 17 Akram Ben Aissi 2020-08-18 10:11:32 UTC
*** Bug 1852997 has been marked as a duplicate of this bug. ***

Comment 19 errata-xmlrpc 2020-10-27 15:59:52 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 (OpenShift Container Platform 4.6 GA Images), 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:4196


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