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

Support cross-namespace BackendRefs in HTTPRoutes #806

Merged
merged 9 commits into from
Jul 6, 2023

Conversation

kate-osborn
Copy link
Contributor

Proposed changes

Allow HTTPRoutes to reference Backends in different namespaces if a ReferenceGrant permits it.

Problem: NKG does not allow HTTPRoutes to reference Backends in different namespaces.

Solution: Allow HTTPRoutes to reference Backends in different namespaces if a ReferenceGrant permits it. Both SecretObjectReferences and BackendObjectReferences are resolved through the referenceGrantResolver. The referenceGrantResolver transforms the map of ReferenceGrants into a structure that allows for O(n) lookup of references.

Testing: Added & modified unit tests. Made sure all ReferenceGrant conformance tests passed, including the new HTTPRouteInvalidReferenceGrant test.

Closes #695

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

@kate-osborn kate-osborn requested a review from a team as a code owner June 30, 2023 20:23
@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 30, 2023
@kate-osborn kate-osborn requested review from sjberman and ciarams87 July 5, 2023 19:01
examples/cross-namespace-routing/README.md Show resolved Hide resolved
internal/state/graph/reference_grant.go Outdated Show resolved Hide resolved
internal/state/graph/reference_grant_test.go Outdated Show resolved Hide resolved
internal/state/graph/reference_grant_test.go Show resolved Hide resolved
@pleshakov
Copy link
Contributor

Suggestion: since the PR name will end up in the changelog, perhaps "Support ReferenceGrants for allowing cross-namespace BackendRefs in HTTPRoutes" or simply " Support cross-namespace BackendRefs in HTTPRoutes" can better reflect the PR from the user perspective?

@kate-osborn kate-osborn changed the title ReferenceGrant from HTTPRoute to BackendObjectReference Support cross-namespace BackendRefs in HTTPRoutes Jul 5, 2023
@kate-osborn kate-osborn requested a review from pleshakov July 5, 2023 20:39
@kate-osborn kate-osborn force-pushed the feat/ref-grant-backends branch from 83f5354 to 7d20e2c Compare July 6, 2023 18:24
@kate-osborn kate-osborn merged commit 219c973 into nginxinc:main Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

ReferenceGrant from Route to BackendObjectReference
4 participants