canonical / knative-operators

Charmed Knative Operators
Apache License 2.0
1 stars 2 forks source link

improve error messaging if required config options are not defined #48

Open ca-scribner opened 2 years ago

ca-scribner commented 2 years ago

For both serving and eventing, if the user does not specify the namespace they will get a nondescript lightkube error that makes it difficult to understand a config option has been missed. Improve this error message, or possibly validate the config values before starting the charm.

ca-scribner commented 1 year ago

This situation is worse when omitting the istio gateway name/namespace. If omitting those, knative-serving (/eventing) will create a knativeserving CR that is malformed but will not report an error. This results in a Serving instance that does not get created, and some non-descript errors in the knative-operator logs like:

        2023-03-06T20:41:03.736Z [/ko-app/operator] {"severity":"ERROR","timestamp":"2023-03-06T20:41:03.736718347Z","logger":"knative-operator","caller":"knativeserving/reconciler.go:294","message":"Returned an error","commit":"e0ef2a2-dirty","knative.dev/pod":"knative-operator","knative.dev/controller":"knative.dev.operator.pkg.reconciler.knativeserving.Reconciler","knative.dev/kind":"operator.knative.dev.KnativeServing","knative.dev/traceid":"cc1ff0e5-82d3-4620-885d-226ef52cc193","knative.dev/key":"knative-serving-ns3/knative-serving","targetMethod":"ReconcileKind","error":"failed to apply non rbac manifest: the server does not allow this method on the requested resource","stacktrace":"knative.dev/operator/pkg/client/injection/reconciler/operator/v1beta1/knativeserving.(*reconcilerImpl).Reconcile\n\tknative.dev/operator/pkg/client/injection/reconciler/operator/v1beta1/knativeserving/reconciler.go:294\nknative.dev/pkg/controller.(*Impl).processNextWorkItem\n\tknative.dev/pkg@v0.0.0-20221014164553-b812affa3893/controller/controller.go:542\nknative.dev/pkg/controller.(*Impl).RunContext.func3\n\tknative.dev/pkg@v0.0.0-20221014164553-b812affa3893/controller/controller.go:491"}
        2023-03-06T20:41:03.736Z [/ko-app/operator] {"severity":"ERROR","timestamp":"2023-03-06T20:41:03.736836431Z","logger":"knative-operator","caller":"controller/controller.go:566","message":"Reconcile error","commit":"e0ef2a2-dirty","knative.dev/pod":"knative-operator","knative.dev/controller":"knative.dev.operator.pkg.reconciler.knativeserving.Reconciler","knative.dev/kind":"operator.knative.dev.KnativeServing","knative.dev/traceid":"cc1ff0e5-82d3-4620-885d-226ef52cc193","knative.dev/key":"knative-serving-ns3/knative-serving","duration":"6.437674429s","error":"failed to apply non rbac manifest: the server does not allow this method on the requested resource","stacktrace":"knative.dev/pkg/controller.(*Impl).handleErr\n\tknative.dev/pkg@v0.0.0-20221014164553-b812affa3893/controller/controller.go:566\nknative.dev/pkg/controller.(*Impl).processNextWorkItem\n\tknative.dev/pkg@v0.0.0-20221014164553-b812affa3893/controller/controller.go:543\nknative.dev/pkg/controller.(*Impl).RunContext.func3\n\tknative.dev/pkg@v0.0.0-20221014164553-b812affa3893/controller/controller.go:491"}
        2023-03-06T20:41:03.737Z [/ko-app/operator] {"severity":"INFO","timestamp":"2023-03-06T20:41:03.737018738Z","logger":"knative-operator.event-broadcaster","caller":"record/event.go:285","message":"Event(v1.ObjectReference{Kind:\"KnativeServing\", Namespace:\"knative-serving-ns3\", Name:\"knative-serving\", UID:\"77a01463-cd24-47c6-a68a-bda46a9d394f\", APIVersion:\"operator.knative.dev/v1beta1\", ResourceVersion:\"78350\", FieldPath:\"\"}): type: 'Warning' reason: 'InternalError' failed to apply non rbac manifest: the server does not allow this method on the requested resource","commit":"e0ef2a2-dirty","knative.dev/pod":"knative-operator"}