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

Process "validation error" response from Konnect update API when field of entity is invalid #774

Open
1 task
randmonkey opened this issue Oct 22, 2024 · 3 comments
Assignees
Milestone

Comments

@randmonkey
Copy link
Contributor

Problem Statement

Currently when an error is returned from Konnect on updating an entity, controller will return error to trigger a requeue of the reconcile request. If the entity is invalid and "validation error" (HTTP status code is 400) is returned, controller will also try to retry to update it.

Proposed Solution

Parse the error returned from Konnect and stop endless requeueing if the error implies that the entity is invalid.
...

Additional Information

...

Acceptance Criteria

  • Can stop requeueing of entities that is rejected by Konnect because its field is invalid
@randmonkey randmonkey added this to the KGO v1.5.x milestone Oct 22, 2024
@pmalek pmalek self-assigned this Oct 24, 2024
@pmalek
Copy link
Member

pmalek commented Oct 24, 2024

Created https://github.com/Kong/platform-api/pull/768 to add missing error types.

@pmalek
Copy link
Member

pmalek commented Oct 25, 2024

This will be solved in KHCP via https://konghq.atlassian.net/browse/KHCP-13816

@pmalek
Copy link
Member

pmalek commented Nov 8, 2024

KHCP-13816 has been resolved but there is another issue here: the endless updates will persist since:

  • we update the status conditions on the entity in here
    setServerURLAndOrgID(ent, serverURL, apiAuth.Status.OrganizationID)
    if errUpd := r.Client.Status().Update(ctx, ent); errUpd != nil {
  • the irrecoverable API errors are ignored here
    return ctrl.Result{}, IgnoreUnrecoverableAPIErr(err, loggerForEntity(ctx, e, UpdateOp))
  • thus the generic reconciler will return no error and the status condition update will requeue endlessly

We have 2 solutions for this:

  • either we handle the error when the status condition already has the same error message set (apart from kong trace id)
        {
          "lastTransitionTime": "2024-11-08T10:57:12Z",
          "message": "failed to update KonnectGatewayControlPlane on Konnect: {\"status\":400,\"title\":\"Invalid Request\",\"instance\":\"kong:trace:13218026017158295363\",\"detail\":\"Invalid Parameters\",\"invalid_parameters\":[{\"field\":\"labels\",\"rule\":\"is_label\",\"source\":\"body\",\"reason\":\"Label value exceeds maximum of 63 characters\"}]}",
          "observedGeneration": 5,
          "reason": "FailedToUpdate",
          "status": "False",
          "type": "Programmed"
        }
    
  • we do not requeue on status update for objects, this might be desirable but might require a bit more refactoring to get right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants