Skip to content

Conversation

shraddhabang
Copy link
Collaborator

Description

This commit implements complete support for AWS Cognito authentication actions in ALB listener rules through Gateway API ListenerRuleConfiguration resources, enabling users to configure authentication at the load balancer level.

Complete Cognito Configuration Support

apiVersion: gateway.k8s.aws/v1beta1
kind: ListenerRuleConfiguration
spec:
  actions:
  - type: authenticate-cognito
    authenticateCognitoConfig:
      userPoolArn: "arn:aws:cognito-idp:us-west-2:123456789012:userpool/us-west-2_EXAMPLE"
      userPoolClientId: "1example23456789"  
      userPoolDomain: "my-cognito-domain"
      onUnauthenticatedRequest: authenticate
      scope: "openid profile email"
      sessionCookieName: "AWSELBAuthSessionCookie"
      sessionTimeout: 604800
      authenticationRequestExtraParams:
        display: "page"
        prompt: "login"

Enhanced Testing Framework

  • HTTP Verifier: Added FollowRedirects support in test/framework/http/verifier.go to handle 302 authentication redirects
  • E2E Test Support: Fixed redirect handling for authenticate-cognito flow testing
  • Unit Tests: Comprehensive test coverage across all components

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 19, 2025
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 19, 2025
@@ -166,7 +166,7 @@ type AuthenticateCognitoActionConfig struct {
// +kubebuilder:default=604800
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=604800
SessionTimeout *int32 `json:"sessionTimeout,omitempty"`
SessionTimeout *int64 `json:"sessionTimeout,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why the change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To match the elbv2 model.

@@ -476,6 +476,8 @@ _Appears in:_
| `enableICMP` _boolean_ | EnableICMP [Network LoadBalancer]<br />enables the creation of security group rules to the managed security group<br />to allow explicit ICMP traffic for Path MTU discovery for IPv4 and dual-stack VPCs | | |
| `manageBackendSecurityGroupRules` _boolean_ | ManageBackendSecurityGroupRules [Application / Network LoadBalancer]<br />specifies whether you want the controller to configure security group rules on Node/Pod for traffic access<br />when you specify securityGroups | | |
| `minimumLoadBalancerCapacity` _[MinimumLoadBalancerCapacity](#minimumloadbalancercapacity)_ | MinimumLoadBalancerCapacity define the capacity reservation for LoadBalancers | | |
| `wafV2` _[WAFv2Configuration](#wafv2configuration)_ | WAFv2 define the AWS WAFv2 settings for a Gateway [Application Load Balancer] | | |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this in!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah no worries. Next time if you change anything in CRDs make sure you also run make gw-api-ref-docs to update our Spec docs.

@shuqz
Copy link
Collaborator

shuqz commented Aug 19, 2025

/approved

@shuqz
Copy link
Collaborator

shuqz commented Aug 19, 2025

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 19, 2025
if len(tf.Options.CertificateARNs) == 0 {
Skip("Skipping tests, certificates not specified")
}
// Skip test if Cognito options not provided (similar to certificate check)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for writing this E2E test, it is super helpful! Can you (in a separate PR) please include some instructions for setting up your testing environment?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: shraddhabang, zac-nixon

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:
  • OWNERS [shraddhabang,zac-nixon]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@shraddhabang
Copy link
Collaborator Author

/retest pull-aws-load-balancer-controller-e2e-test

@k8s-ci-robot
Copy link
Contributor

@shraddhabang: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:

/test pull-aws-load-balancer-controller-e2e-test
/test pull-aws-load-balancer-controller-lint
/test pull-aws-load-balancer-controller-unit-2
/test pull-aws-load-balancer-controller-unit-3
/test pull-aws-load-balancer-controller-unit-4
/test pull-aws-load-balancer-controller-unit-test

Use /test all to run the following jobs that were automatically triggered:

pull-aws-load-balancer-controller-e2e-test
pull-aws-load-balancer-controller-lint
pull-aws-load-balancer-controller-unit-test

In response to this:

/retest pull-aws-load-balancer-controller-e2e-test

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.

@shraddhabang
Copy link
Collaborator Author

/test pull-aws-load-balancer-controller-e2e-test

@k8s-ci-robot k8s-ci-robot merged commit 1655f71 into kubernetes-sigs:main Aug 20, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants