redhat-cop / cert-utils-operator

Set of functionalities around certificates packaged in a Kubernetes operator
Apache License 2.0
95 stars 35 forks source link

no matches for kind CustomResourceDefinition #51

Closed devopstales closed 4 years ago

devopstales commented 4 years ago

The operator is faling after deploy:

{"level":"info","ts":1592146919.6765954,"logger":"cmd","msg":"Go Version: go1.13"}
{"level":"info","ts":1592146919.6768084,"logger":"cmd","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":1592146919.6768417,"logger":"cmd","msg":"Version of operator-sdk: v0.16.0"}
{"level":"info","ts":1592146919.6770298,"logger":"leader","msg":"Trying to become the leader."}
{"level":"info","ts":1592146920.3141868,"logger":"leader","msg":"Found existing lock with my name. I was likely restarted."}
{"level":"info","ts":1592146920.3143566,"logger":"leader","msg":"Continuing as the leader."}
{"level":"info","ts":1592146920.9364574,"logger":"controller-runtime.metrics","msg":"metrics server is starting to listen","addr":"0.0.0.0:8383"}
{"level":"info","ts":1592146920.938475,"logger":"cmd","msg":"Registering Components."}
{"level":"info","ts":1592146920.9487975,"logger":"cmd","msg":"Starting the Cmd."}
{"level":"info","ts":1592146920.9498603,"logger":"controller-runtime.manager","msg":"starting metrics server","path":"/metrics"}
{"level":"info","ts":1592146920.9500117,"logger":"controller-runtime.controller","msg":"Starting EventSource","controller":"secretinfo_controller","source":"kind source: /, Kind=Secret"}
{"level":"info","ts":1592146920.9501426,"logger":"controller-runtime.controller","msg":"Starting EventSource","controller":"mutatingwebhookconfiguration-controller","source":"kind source: /, Kind=MutatingWebhookConfiguration"}
{"level":"info","ts":1592146920.9507418,"logger":"controller-runtime.controller","msg":"Starting EventSource","controller":"certexpiryalert_controller","source":"kind source: /, Kind=Secret"}
{"level":"info","ts":1592146920.95138,"logger":"controller-runtime.controller","msg":"Starting EventSource","controller":"secret_ca_injection_controller","source":"kind source: /, Kind=Secret"}
{"level":"info","ts":1592146920.9515507,"logger":"controller-runtime.controller","msg":"Starting EventSource","controller":"configmap-ca-injection-controller","source":"kind source: /, Kind=ConfigMap"}
{"level":"info","ts":1592146920.9517112,"logger":"controller-runtime.controller","msg":"Starting EventSource","controller":"webhook_ca_injection_controller","source":"kind source: /, Kind=ValidatingWebhookConfiguration"}
{"level":"info","ts":1592146920.951926,"logger":"controller-runtime.controller","msg":"Starting EventSource","controller":"secret_to_keystore_controller","source":"kind source: /, Kind=Secret"}
{"level":"info","ts":1592146920.9520652,"logger":"controller-runtime.controller","msg":"Starting EventSource","controller":"route_controller","source":"kind source: /, Kind=Route"}
{"level":"info","ts":1592146920.9521673,"logger":"controller-runtime.controller","msg":"Starting EventSource","controller":"crd_controller","source":"kind source: /, Kind=CustomResourceDefinition"}
{"level":"info","ts":1592146920.9527025,"logger":"controller-runtime.controller","msg":"Starting Controller","controller":"secretinfo_controller"}
{"level":"info","ts":1592146920.9527133,"logger":"controller-runtime.controller","msg":"Starting Controller","controller":"certexpiryalert_controller"}
{"level":"info","ts":1592146920.9527533,"logger":"controller-runtime.controller","msg":"Starting Controller","controller":"secret_to_keystore_controller"}
{"level":"info","ts":1592146920.9529667,"logger":"controller-runtime.controller","msg":"Starting EventSource","controller":"configmap-ca-injection-controller","source":"kind source: /, Kind=secret"}
{"level":"info","ts":1592146920.952994,"logger":"controller-runtime.controller","msg":"Starting EventSource","controller":"secret_ca_injection_controller","source":"kind source: /, Kind=Secret"}
{"level":"error","ts":1592146923.021014,"logger":"controller-runtime.source","msg":"if kind is a CRD, it should be installed before calling Start","kind":"CustomResourceDefinition.apiextensions.k8s.io","error":"no matches for kind \"CustomResourceDefinition\" in version \"apiextensions.k8s.io/v1\"","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/home/travis/gopath/pkg/mod/github.com/go-logr/zapr@v0.1.1/zapr.go:128\nsigs.k8s.io/controller-runtime/pkg/source.(*Kind).Start\n\t/home/travis/gopath/pkg/mod/sigs.k8s.io/controller-runtime@v0.4.0/pkg/source/source.go:88\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1\n\t/home/travis/gopath/pkg/mod/sigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:165\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start\n\t/home/travis/gopath/pkg/mod/sigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:198\nsigs.k8s.io/controller-runtime/pkg/manager.(*controllerManager).startLeaderElectionRunnables.func1\n\t/home/travis/gopath/pkg/mod/sigs.k8s.io/controller-runtime@v0.4.0/pkg/manager/internal.go:477"}
{"level":"error","ts":1592146923.02135,"logger":"cmd","msg":"Manager exited non-zero","error":"no matches for kind \"CustomResourceDefinition\" in version \"apiextensions.k8s.io/v1\"","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/home/travis/gopath/pkg/mod/github.com/go-logr/zapr@v0.1.1/zapr.go:128\nmain.main\n\t/home/travis/gopath/src/github.com/redhat-cop/cert-utils-operator/cmd/manager/main.go:135\nruntime.main\n\t/home/travis/.gimme/versions/go1.13.linux.amd64/src/runtime/proc.go:203"}
raffaelespazzoli commented 4 years ago

CustomResourceDefinition are typically defined in each kube environment. In which environment are you running?

devopstales commented 4 years ago

openshift OKD 3.11 If I try by command line it can be found:

oc get CustomResourceDefinition.apiextensions.k8s.io
NAME                                  CREATED AT
certificaterequests.cert-manager.io   2020-06-14T09:09:47Z
certificates.cert-manager.io          2020-06-14T09:09:47Z
challenges.acme.cert-manager.io       2020-06-14T09:09:46Z
clusterissuers.cert-manager.io        2020-06-14T09:09:46Z
issuers.cert-manager.io               2020-06-14T09:09:47Z
orders.acme.cert-manager.io           2020-06-14T09:09:47Z
raffaelespazzoli commented 4 years ago

can you look at the version of the crd object? oc get CustomResourceDefinition.apiextensions.k8s.io certificaterequests.cert-manager.io

slaterx commented 4 years ago

@raffaelespazzoli I can reproduce the error above. I'm also running OKD 3.11.

Running your command gives me:

oc get CustomResourceDefinition.apiextensions.k8s.io certificaterequests.cert-manager.io
NAME                                  CREATED AT
certificaterequests.cert-manager.io   2020-06-14T20:45:53Z
slaterx commented 4 years ago

Further to this, v0.1.0 instead of v0.1.1 works fine after deploying.

raffaelespazzoli commented 4 years ago

sorry I should have been clearer. can you run this command:oc get CustomResourceDefinition.apiextensions.k8s.io certificaterequests.cert-manager.io -o yaml and look at the apiversion of the CustomResourceDefinition type. I'm going to guess it's not v1 in OKD 3.11.

slaterx commented 4 years ago

Correct, it is v1alpha2:


oc get CustomResourceDefinition.apiextensions.k8s.io certificaterequests.cert-manager.io -o yaml
(...)
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
(...)
  name: certificaterequests.cert-manager.io
  selfLink: /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/certificaterequests.cert-manager.io
(...)
  version: v1alpha2
  versions:
  - name: v1alpha2
    served: true
    storage: true
status:
(...)
  storedVersions:
  - v1alpha2
raffaelespazzoli commented 4 years ago

ok, I have no plan to maintain backward compatibility with the 3.x line of OpenShift. So, I think you have three options:

  1. run the v0.1.0 version of the operator
  2. upgrade to OpenShift 4.x
  3. fork the operator and backport it to OpenShift 3.x
slaterx commented 4 years ago

Will you consider our PR if we find a way to backport it?

raffaelespazzoli commented 4 years ago

@slaterx sure. I assume the CRD injection is not something that makes much sense anyway on OpenShift 3.11, so perhaps the best approach for this patch would be to simple disable that controller when running on OpenShift 3.x

raffaelespazzoli commented 4 years ago

@slaterx may I close this issue?

slaterx commented 4 years ago

Yes, you can close it @raffaelespazzoli!