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

Update validateBackendRef invalid group error conditions #800

Merged

Conversation

ciarams87
Copy link
Member

@ciarams87 ciarams87 commented Jun 28, 2023

Proposed changes

Problem: The HTTPRouteInvalidBackendRefUnknownKind conformance test expects ResolvedRefs/False/InvalidKind condition to be set on the HTTPRoute if a BackendRef specifies an unknown kind.

Solution: We actually do set the correct condition in this case where just Kind is invalid but Group is valid, but when Group is invalid, we set a different condition. Solution is to update the condition reason to InvalidKind when either Kind or Group is invalid. Comment for context from @pleshakov:

because Kind depends on the group (for example, the fact that the kind is Service (valid) is meaningless if the group is not core), I think the current logic is correct. Perhaps we can just report conditions.NewRouteBackendRefInvalidKind for the group error as well, without changing the order, since the group is kind of related to the kind anyway and there is nothing in the spec written about the group validation.

Testing: The failing conformance test now passes successfully:

    --- PASS: TestConformance/HTTPRouteInvalidBackendRefUnknownKind (3.04s)
        --- PASS: TestConformance/HTTPRouteInvalidBackendRefUnknownKind/HTTPRoute_with_Invalid_Kind_has_a_ResolvedRefs_Condition_with_status_False_and_Reason_InvalidKind (0.01s)
        --- PASS: TestConformance/HTTPRouteInvalidBackendRefUnknownKind/HTTP_Request_to_invalid_backend_with_invalid_Kind_receives_a_500 (0.00s)

Closes #776

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@ciarams87 ciarams87 requested a review from a team as a code owner June 28, 2023 12:04
@github-actions github-actions bot added the bug Something isn't working label Jun 28, 2023
@ciarams87 ciarams87 changed the title Reverse order for validateBackendRef error conditions Update validateBackendRef invalid group error conditions Jun 28, 2023
@sjberman
Copy link
Contributor

@ciarams87 Would you be able to update the commit/PR description after your changes? I was a bit confused as to what was happening

@ciarams87 ciarams87 merged commit 1f8a416 into nginxinc:main Jun 28, 2023
@ciarams87 ciarams87 deleted the fix/update-invalid-backend-kind-condition branch June 28, 2023 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Set ResolvedRefs/False/InvalidKind for BackendRefs with unknown kind
4 participants