Kuadrant / kuadrant-operator

The Operator to install and manage the lifecycle of the Kuadrant components deployments.
Apache License 2.0
37 stars 33 forks source link

RateLimitPolicy Gateway needs to be created before Kuadrant resource #259

Closed azgabur closed 1 year ago

azgabur commented 1 year ago

While testing new images I encountered following bug: Error message in RateLimitPolicy status: 'Internal error occurred: object *v1beta1.Gateway is not Kuadrant managed'

I created the gateway and HttpRoute after Kuadrant deployment, it is possible that is the problem.

Tested image/catalog-source: https://github.com/Kuadrant/kuadrant-operator/actions/runs/6286740056/job/17070796884 Istio version: 1.16.1 Openshift version: 4.12.32 I attach used gateway, httproute and ratelimitpolicy yaml: gateway.yaml.txt httproute.yaml.txt ratelimit.yaml.txt

Kuadrant operator log:

{"level":"error","ts":"2023-09-25T14:32:55Z","logger":"kuadrant-operator","msg":"Reconciler error","controller":"ratelimitpolicy","controllerGroup":"kuadrant.io","controllerKind":"RateLimitPolicy","RateLimitPolicy":{"name":"limit-azgabur-testste-ibqm","namespace":"authorino"},"namespace":"authorino","name":"limit-azgabur-testste-ibqm","reconcileID":"4ce1ba01-ac4b-4878-a0fa-9f94cffa40d1","error":"Internal error occurred: object *v1beta1.Gateway is not Kuadrant managed","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:329\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:274\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:235"}
{"level":"info","ts":"2023-09-25T14:49:35Z","logger":"kuadrant-operator.ratelimitpolicy","msg":"Reconciling RateLimitPolicy","RateLimitPolicy":"authorino/limit-azgabur-testste-ibqm"}
{"level":"error","ts":"2023-09-25T14:49:35Z","logger":"kuadrant-operator.ratelimitpolicy.reconcileLimitador","msg":"failed to get kuadrant namespace","RateLimitPolicy":"authorino/limit-azgabur-testste-ibqm","rlp refs":["authorino/limit-azgabur-testste-ibqm"],"error":"Internal error occurred: object *v1beta1.Gateway is not Kuadrant managed","stacktrace":"github.com/kuadrant/kuadrant-operator/controllers.(*RateLimitPolicyReconciler).reconcileLimitador\n\t/workspace/controllers/ratelimitpolicy_limits.go:53\ngithub.com/kuadrant/kuadrant-operator/controllers.(*RateLimitPolicyReconciler).reconcileLimits\n\t/workspace/controllers/ratelimitpolicy_limits.go:20\ngithub.com/kuadrant/kuadrant-operator/controllers.(*RateLimitPolicyReconciler).reconcileResources\n\t/workspace/controllers/ratelimitpolicy_controller.go:171\ngithub.com/kuadrant/kuadrant-operator/controllers.(*RateLimitPolicyReconciler).Reconcile\n\t/workspace/controllers/ratelimitpolicy_controller.go:131\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:122\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:323\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:274\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:235"}

Steps to reproduce:

  1. Create kuadrant object via Kuadrant operator
  2. In authorino namespace create new gateway as in gateway.yaml attachment
  3. In same namespace create new HttpRoute as in httoroute.yaml attachment
  4. In same namespace create new RateLimitPolicy as in ratelimit.yaml attachment.
  5. See error in status of RateLimitPolicy object
eguzki commented 1 year ago

Add kuadrant.io/namespace: kuadrant-system annotation to the gateway. (or whatever namespace you deploy kuadrant)

azgabur commented 1 year ago

Adding this annotation fixed the problem, thanks!

pehala commented 1 year ago

While the annotation works, I would keep those open as it should not be required to add any annotation, or, at least, it should be clearly specified in the docs