operator-sdk: Failed with "the server could not find the requested resource"
Bug Report
What did we do? Trying to deploy custom resource via the operator: Facing the issue: the server could not find the requested resource
What we expect:
Below is the stdout log from the operator deployed on Openshift 3.11:
2019-02-21T13:55:19.173Z INFO logging_event_handler [playbook task] {"name": "example-full", "namespace": "redis-cluster", "gvk": "db.mysite.com/v1alpha1, Kind=RedisCluster", "event_type": "playbook_on_task_start", "job": "3033838985510594553", "EventData.Name": "Gathering Facts"}
What we see instead:
The same CRD, the same role, service account, permissions etc. on Openshift 3.10:
{"level":"error","ts":1550756524.2727947,"logger":"kubebuilder.controller","msg":"Reconciler error","controller":"rediscluster-controller","request":"redis-cluster/example-full","error":"the server could not find the requested resource","stacktrace":"github.com/operator-framework/operator-sdk/vendor/github.com/go-logr/zapr.(*zapLogger).Error\n\t/home/joe/go/src/github.com/operator-framework/operator-sdk/vendor/github.com/go-logr/zapr/zapr.go:128\ngithub.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/home/joe/go/src/github.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:215\ngithub.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1\n\t/home/joe/go/src/github.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:158\ngithub.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\t/home/joe/go/src/github.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133\ngithub.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/home/joe/go/src/github.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134\ngithub.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait.Until\n\t/home/joe/go/src/github.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88"}
Environment
- operator-sdk version: 0.3.0, 0.4.1, 0.5.0
- openshift v3.10.0+fd501dd-48 *
- kubernetes v1.10.0+b81c8f8 *
- operator code is written on: Ansible *
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (7 by maintainers)
Commits related to this issue
- fixing resources field in crd which makes kubernetes 3.11 to work https://github.com/operator-framework/operator-sdk/issues/1124 — committed to ochaloup/wildfly-operator by ochaloup 5 years ago
I saw the same error with kubebuilder version
2.0.0-alpha.1
:Adding the
// +kubebuilder:subresource:status
comment above the CronJob struct incronjob_types.go
, and then runningmake manifests
per https://book-v1.book.kubebuilder.io/basics/status_subresource.html resolved the error for me:status
subresource in CRD after runningmake manifests
:I am facing the same issue when I followed this link https://github.com/operator-framework/operator-sdk/blob/master/doc/ansible/user-guide.md
operator-sdk version: v0.7.0 Kubectl Client Version: v1.9.11 K8s Server Version: v1.9.11 ansible 2.7.9
I tried to run both inside and outside the cluster as per README.md and receiving the same errors:
{"level":"error","ts":1556555179.8817847,"logger":"reconciler","msg":"Unable to update the status to mark cr as running","job":"1730092421274156201","name":"example-foo","namespace":"default","error":"the server could not find the requested resource","stacktrace":"github.com/operator-framework/operator-sdk/vendor/github.com/go-logr/zapr.(*zapLogger).Error\n\tsrc/github.com/operator-framework/operator-sdk/vendor/github.com/go-logr/zapr/zapr.go:128\ngithub.com/operator-framework/operator-sdk/pkg/ansible/controller.(*AnsibleOperatorReconciler).Reconcile\n\tsrc/github.com/operator-framework/operator-sdk/pkg/ansible/controller/reconcile.go:126\ngithub.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsrc/github.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:215\ngithub.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1\n\tsrc/github.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:158\ngithub.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\tsrc/github.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133\ngithub.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil\n\tsrc/github.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134\ngithub.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait.Until\n\tsrc/github.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88"}