-
Notifications
You must be signed in to change notification settings - Fork 591
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
Include details
in the Konnect sync error
#5274
Comments
https:/Kong/go-database-reconciler/blob/deb74352abb17010b1fb8524dd6c0a3519055cb7/pkg/konnect/error.go#L11-L39 appears to be the culprit. It unmarshals into a struct with only a |
Not sure what exactly we can expect in details. Upstream that's apparently from Koko GRPC details, which is effectively a gRPC status. Those details can contain arbitrary data with a type indicator, but looking at the preceding code it looks like they should always be a collection of this ErrorDetail structs. Dunno how exactly that translates into the HTTP response body though--naively I'd assume you do get JSON array of those structs, but I don't have a ready actual HTTP response in front of me to say for sure. While the private koko repo is the actual source of truth about those types, the types currently in the public repo don't appear to have diverged at present, so I've linked to them. |
Asked koko team and got the feedback from them that
After checking the code of So we need to add parsing of |
Is there an existing issue for this?
Problem Statement
When performing
deck sync
to Konnect, in the event of a resource failing validation on the Konnect end, the log message fromkubernetes-ingress-controller/internal/dataplane/kong_client.go
Line 563 in c193da2
kong-controller-fefefefe-abcde time="2023-12-04T08:10:30Z" level=warning msg="Failed pushing configuration to Konnect" error="performing update for https://us.kic.api.konghq.com/kic/api/runtime_groups/fefefefe-fefe-fefe-fefe-fefefefefefe failed: 1 errors occurred:\n\twhile processing event: {Create} jwt-auth my_jwt_secret for consumer example-user failed: HTTP status 400 (message: \"validation error\")\n"
where
validation error
is not a useful message to the user.The Admin API side (at least in Konnect's implementation) provides more meaningful detail in the
details
field of the response:{"code":3,"message":"validation error","details":[{"@type":"type.googleapis.com/kong.admin.model.v1.ErrorDetail","type":"ERROR_TYPE_FIELD","field":"value.rsa_public_key","messages":["'-----BEGIN RSA PUBLIC KEY-----\\nMIIREDACTED...\\n-----END RSA PUBLIC KEY-----' is not valid 'pem-pkix-encoded-public-key'"]}]}
Proposed Solution
Include the
details
field in the log entry.Additional information
I haven't verified if the Lua implementation populates
details
as well (but I believe it should) - the implementation should treat thedetails
field as optional and not crash if it's not present :)Acceptance Criteria
details
field from the error response is included in the message to the userThe text was updated successfully, but these errors were encountered: