Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion webhook contains a lot of errors #430

Closed
pehala opened this issue Sep 25, 2023 · 1 comment · Fixed by #431
Closed

Conversion webhook contains a lot of errors #430

pehala opened this issue Sep 25, 2023 · 1 comment · Fixed by #431
Assignees
Labels
kind/bug Something isn't working size/small

Comments

@pehala
Copy link

pehala commented Sep 25, 2023

Describe the bug
Conversion Webhook contains an incredible amount of these errors

{"level":"error","ts":1695653163.7558553,"logger":"authorino.conversion-webhook","msg":"failed to write response","error":"json: error calling MarshalJSON for type runtime.RawExtension: json: error calling MarshalJSON for type runtime.RawExtension: invalid character '\\n' in string literal","stacktrace":"sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*Webhook).ServeHTTP\n\t/opt/app-root/src/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/webhook/conversion/conversion.go:86\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1\n\t/opt/app-root/src/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:40\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/lib/golang/src/net/http/server.go:2109\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1\n\t/opt/app-root/src/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:127\nnet/http.HandlerFunc.ServeHTTP\...

Help us Reproduce it

I encountered #429 and the logs was spammed with those errors every second

@pehala
Copy link
Author

pehala commented Sep 26, 2023

{"level":"error","ts":1695713229.735419,"logger":"authorino.conversion-webhook","msg":"failed to write response","error":"json: error calling MarshalJSON for type runtime.RawExtension: json: error calling MarshalJSON for type runtime.RawExtension: invalid character '\\n' in string literal","stacktrace":"sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*Webhook).ServeHTTP\n\t/opt/app-root/src/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/webhook/conversion/conversion.go:86\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1\n\t/opt/app-root/src/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:40\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/lib/golang/src/net/http/server.go:2109\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1\n\t/opt/app-root/src/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:127\nnet/http.HandlerFunc.ServeHTTP\n...

These are all the AuthConfigs currently present in the project

authconfigs.yaml.txt
authconfigs_old.yaml.txt

guicassolato added a commit that referenced this issue Sep 26, 2023
Fix back and forth conversion of [`runtime.RawExtension`)(https://pkg.go.dev/k8s.io/[email protected]/pkg/runtime#RawExtension) fields.

Example of fields and values affected:
- Extended properties of identity objects (new `defaults` and `overrides` of the authentication config)
- Custom `headers` of the former `denyWith` spec (new `response.(unauthenticated|unauthorized).headers`)
- Custom `message` and `body` of the former `denyWith` spec, as well as all other fields typed in v1beta1 as [`StaticOrDynamicValue`](https://pkg.go.dev/github.com/kuadrant/authorino/api/v1beta1#StaticOrDynamicValue), when the field was set to a static string value containing line breaks or any other character that require escaping when marshalled

Closes #430.
@guicassolato guicassolato self-assigned this Sep 26, 2023
@github-project-automation github-project-automation bot moved this from Review to To test in Kuadrant Service Protection Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working size/small
Projects
No open projects
Status: To test
Development

Successfully merging a pull request may close this issue.

2 participants