Feature/ram shared network discovery #843
Open
+399
−25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
feature
Which issue does this PR fix:
Fixes #842 & #697
What does this PR do / Why do we need it:
This PR enables automatic discovery of VPC Lattice Service Networks that have been shared via AWS Resource Access Manager (RAM) from other AWS accounts. This is critical for enterprise multi-account architectures where a central networking account owns and shares Service Networks to spoke accounts.
Problem:
Solution:
FindServiceNetwork()to use two-step discovery process:findServiceNetworkViaVPCAssociation()to discover networks via VPC associationsbuildServiceNetworkInfo()helper for consistent tag fetchingisLocalServiceNetwork()to detect local vs RAM-shared networks by parsing ARNUpsertVpcAssociation()to skip ownership checks for RAM-shared networksListServiceNetworkVpcAssociationsAPI)Changes:
pkg/aws/services/vpclattice.go(~75 lines added)pkg/deploy/lattice/service_network_manager.go(~30 lines modified)pkg/deploy/lattice/service_network_manager_test.go(4 tests updated with valid ARN formats)pkg/deploy/lattice/service_network_manager_ram_shared_test.go(7 new tests added)If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:
Repro Steps (Before this PR):
After this PR:
Same steps result in Gateway successfully discovering and using the RAM-shared Service Network through VPC association lookup.
Testing done on this change:
Unit Tests: ✅ COMPLETE
Updated Existing Tests:
service_network_manager_test.goto use valid ARN formatsNew RAM-Shared Network Tests (
service_network_manager_ram_shared_test.go):Test_isLocalServiceNetwork_LocalNetwork- Verifies local network detectionTest_isLocalServiceNetwork_RAMSharedNetwork- Verifies RAM-shared detectionTest_isLocalServiceNetwork_InvalidARN- Tests graceful error handlingTest_isLocalServiceNetwork_NilARN- Tests nil pointer handlingTest_UpsertVpcAssociation_RAMSharedNetwork_ExistingAssociation- Verifies ownership checks are skippedTest_UpsertVpcAssociation_RAMSharedNetwork_ReadOnly- Confirms no modifications to RAM-shared networksTest_UpsertVpcAssociation_LocalNetwork_WithUpdates- Ensures local networks still updatableTest Results:
All package tests passing:
go test ./pkg/deploy/lattice- 100% success rateMulti-Account Integration Testing: ✅ COMPLETE
Validated in real AWS multi-account environment:
Test Environment:
Test Scenario:
Test Results:
Gateway Status:
Service Association (cross-account):
{ "id": "snsa-abcdef1234567890", "arn": "arn:aws:vpc-lattice:us-west-2:222222222222:servicenetworkserviceassociation/snsa-abcdef1234567890", "serviceId": "svc-05adf70023b306447", "serviceName": "k8s-default-test-route-abc123", "serviceNetworkArn": "arn:aws:vpc-lattice:us-west-2:111111111111:servicenetwork/sn-04f8437d5c6e026b0", "status": "ACTIVE" }Backward Compatibility Testing: ✅ VERIFIED
Automation added to e2e:
The repository already contains comprehensive e2e tests for RAM sharing in
test/suites/integration/ram_share_test.go(added in #578). These tests validate the existing explicit naming behavior and will continue to pass with this PR.Our feature adds a new auto-discovery capability via VPC associations that complements (rather than replaces) the existing explicit naming approach. Both methods now work:
Will this PR introduce any new dependencies?:
No new dependencies. Uses existing AWS VPC Lattice APIs:
ListServiceNetworkVpcAssociations(existing IAM permission)ListTagsForResource(existing IAM permission)Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No breaking changes. Tested with live upgrade:
Does this PR introduce any user-facing change?:
Do all end-to-end tests successfully pass when running
make e2e-test?:Unit tests are comprehensive and all passing. E2E tests were not run in this PR validation due to test infrastructure setup requirements, but:
✅ Unit test coverage is complete:
✅ Production validation complete:
✅ Backward compatibility confirmed:
The repository's existing e2e tests in
test/suites/integration/ram_share_test.goprovide coverage for RAM sharing scenarios and will continue to pass with these changes.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.