-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add basic aga controller e2e tests #4485
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
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wweiwei-li The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| } | ||
|
|
||
| func (m *defaultInstallationManager) UpgradeController(controllerImage string, enableEndPointSlices bool, enableALBTargetControlAgent bool) error { | ||
| func (m *defaultInstallationManager) UpgradeController(controllerImage string, enableEndPointSlices bool, enableALBTargetControlAgent bool, enableGlobalAcceleratorController bool) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to set EnableRGTAPI feature for GlobalAcceleratorController.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we decided not to have it run in CI, I removed this logic. Right now, these tests require the --enable-aga-tests flag to run local testing, same as gateway tests. Local testers will need to set all required feature flags. For future CI tests, we can update the controller with the required EnableRGTAPI and AGA flags
| tf, err = framework.InitFramework() | ||
| Expect(err).NotTo(HaveOccurred()) | ||
|
|
||
| if !isCommercialPartition(tf.Options.AWSRegion) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we can reuse this IsGlobalAcceleratorControllerEnabled in utility function instead of just checking the partition? Or you can create this in utils and we could avoid duplication partition check done here in IsGlobalAcceleratorControllerEnabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it to util.go. We can't just reuse IsGlobalAcceleratorControllerEnabled to decide if we run tests. It only checks if AGA is enabled, not if it's supported. but this will only be needed for future CI or pipeline tests actually.
| ctx = context.Background() | ||
| if tf.Options.ControllerImage != "" { | ||
| By("upgrade controller with GlobalAccelerator enabled", func() { | ||
| err := tf.CTRLInstallationManager.UpgradeController(tf.Options.ControllerImage, false, false, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to set AGA flag to true if we are using custom image for these tests? tf.CTRLInstallationManager.UpgradeController(tf.Options.ControllerImage, false, false, true) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we decided not to have it run in CI. I remove this logic. Right now, these tests require --enable-aga-tests flag to run local testing. Same as gateway tests.
| }) | ||
|
|
||
| By("verifying GlobalAccelerator status fields", func() { | ||
| gaARN := agaStack.GetGlobalAcceleratorARN() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can create a function for this verification as we are repeating this in all tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, added a helper
ab72dbe to
3808a8d
Compare
| if len(listener.PortRanges) != len(expectedListener.PortRanges) { | ||
| return fmt.Errorf("listener[%d] port range count mismatch: expected %d, got %d", i, len(expectedListener.PortRanges), len(listener.PortRanges)) | ||
| } | ||
| for j, expectedPortRange := range expectedListener.PortRanges { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to sort these before we validate these so that we validate these irrespective of order in both ranges?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, added it
| {FromPort: 80, ToPort: 80}, | ||
| {FromPort: 443, ToPort: 443}, | ||
| }, | ||
| ClientAffinity: string(types.ClientAffinityNone), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing EndpointGroupExpectation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added it
| }, | ||
| Spec: agav1beta1.GlobalAcceleratorSpec{ | ||
| Name: &acceleratorName, | ||
| IPAddressType: agav1beta1.IPAddressTypeIPV4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For auto-discovery case, you can also skip IPAddressType, ClientAffinity and TrafficDialPercentage. These should all be defaulted through CRD if unspsecified. We could check that as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, skipped it
| PortRanges: []PortRangeExpectation{ | ||
| {FromPort: 80, ToPort: 80}, | ||
| }, | ||
| ClientAffinity: string(types.ClientAffinityNone), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same EndpointGroupExpectation is missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added it
| }, | ||
| } | ||
|
|
||
| ingStack = ingress.NewResourceStack([]*appsv1.Deployment{deployment}, []*corev1.Service{nlbSvc, nodeSvc}, []*networkingv1.Ingress{ing}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of making deploying NLB through ingress stack, shall we deploy it standalone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, deploying standalone would be cleaner. Updated it
|
|
||
| // ResourceStack orchestrates the deployment of endpoint resources with GlobalAccelerator | ||
| type ResourceStack struct { | ||
| endpointStack EndpointStack // Endpoint resources (Service/Ingress/Gateway) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this an array for multi-endpoint stacks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When adding gateway endpoint support, I decided not to use aga/resource_stack.go to manage all endpoint stacks (service, ingress, gateway). Instead, each endpoint type is managed by directly importing and using its own ResourceStack. I think this is clear, simpler than trying to unify different resource types under a common Interface. What do you think ?
|
@wweiwei-li: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
Test Files:
Helper Files:
Tests coverred:
Note: These tests require
--enable-aga-testsflag to run (local testing only, not in CI). Make sure set up your local controller with https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/docs/guide/globalaccelerator/installation.mdService Endpoint Tests (service_endpoint_test.go):
✅ IP target type lifecycle - Create, verify, update , verify traffic
✅ Instance target type scheme change - Deploy with internet-facing, change to internal, verify endpoint replacement
✅ Direct endpoint ID - Create GlobalAccelerator with direct load balancer ARN reference
Ingress Endpoint Tests (ingress_endpoint_test.go):
✅ Basic Ingress lifecycle - Create, verify configuration, traffic flow
✅ Auto-discovery - Automatically discover protocol and ports from Ingress
✅ IPV4 to DUAL_STACK migration - Migrate address type and verify dual-stack DNS
✅ Port overrides- Configure port overrides for listeners
Multi-Endpoint Tests (multi_endpoint_test.go):
✅ Service + Ingress endpoints - Multiple endpoint types in same namespace
Gateway Endpoint Tests (gateway_endpoint_test.go):
✅ ALB Gateway endpoint - Create GlobalAccelerator with ALB Gateway, verify configuration and traffic
✅ NLB Gateway endpoint - Create GlobalAccelerator with NLB Gateway, verify configuration and traffic
Checklist
README.md, or thedocsdirectory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯