Skip to content

new: Added Gateway API lab#1852

Open
desaiajayhnr wants to merge 6 commits into
aws-samples:mainfrom
desaiajayhnr:lbc-gatewayapi-1840
Open

new: Added Gateway API lab#1852
desaiajayhnr wants to merge 6 commits into
aws-samples:mainfrom
desaiajayhnr:lbc-gatewayapi-1840

Conversation

@desaiajayhnr
Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Summary
Adds a new Gateway API workshop module under fundamentals/exposing/gateway-api that teaches learners how to expose and route traffic using the Kubernetes Gateway API with the AWS Load Balancer Controller (v3.3.0). This module serves as the Gateway API equivalent of the existing Ingress module, demonstrating the successor API with its role-oriented design.

What's included
Workshop documentation (4 pages):

Deploy the Controller — Learner installs LBC v3.3.0 via Helm with --defaultTargetType=ip
Exposing the UI — Create GatewayClass, LoadBalancerConfiguration, Gateway, and HTTPRoute to provision an internet-facing ALB
Path-Based Routing — Cross-namespace HTTPRoute for the catalog service with TargetGroupConfiguration for health checks
Canary Deployment — Progressive traffic shifting using weighted backendRefs (90/10 → 50/50 → 0/100)
Manifests:

exposing-ui/: GatewayClass, LoadBalancerConfiguration (scheme: internet-facing, sourceRanges), Gateway (with infrastructure.parametersRef), HTTPRoute
path-based-routing/: Catalog HTTPRoute (/catalog prefix) + TargetGroupConfiguration (healthCheckPath: /health)
canary/: ui-v2 Deployment (orange theme), Service, and weighted HTTPRoute variants
Terraform (prepare-environment):

Installs standard Gateway API CRDs via kubectl apply from GitHub releases
Installs AWS LBC Gateway-specific CRDs (TargetGroupConfiguration, LoadBalancerConfiguration, ListenerRuleConfiguration)
Creates IAM role for the AWS Load Balancer Controller
Exports LBC_CHART_VERSION and LBC_ROLE_ARN as environment variables
Cleanup script:

Deletes HTTPRoutes, Gateways, GatewayClasses, TargetGroupConfigurations, LoadBalancerConfigurations
Waits for ALB deprovisioning before uninstalling Helm charts
Force-removes finalizers if Gateway deletion is stuck
Removes CRDs at the end
Test hooks:

hook-exposing-ui.sh — Polls ALB until HTTP 200
hook-path-routing.sh — Validates /catalog/products returns 200
hook-canary.sh — Verifies ui-v2 pods and HTTPRoute acceptance
Bug fixes (unrelated to Gateway API content)
Makefile: Added ECR Public authentication (aws ecr-public get-login-password) to create-infrastructure and destroy-infrastructure targets to fix 403 Forbidden errors on Docker pulls
hack/create-infrastructure.sh: Fixed pids[@]: unbound variable error when clusters already exist by guarding the array iteration with a length check
Key design decisions
Uses LBC v3.3.0 (Gateway API GA) instead of v2.x which required feature gates
Uses LoadBalancerConfiguration CRD for ALB settings (scheme, sourceRanges) instead of annotations — the v3.x recommended approach
Uses --defaultTargetType=ip Helm flag so ClusterIP services work without per-service TargetGroupConfigurations
Gateway listener uses allowedRoutes.namespaces.from: All to enable cross-namespace routing for the catalog HTTPRoute
Follows the same learner-installs-controller pattern as the existing Ingress module
Testing
Verified end-to-end: prepare-environment → deploy controller → expose UI → path-based routing → canary deployment
ALB provisions as internet-facing with correct security group source ranges
Catalog health checks pass on /health
Weighted traffic splitting confirmed with theme-based visual verification

Which issue(s) this PR fixes:

Fixes # #1840

Quality checks

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

desaiajayhnr and others added 4 commits May 19, 2026 16:28
- New workshop module: fundamentals/exposing/gateway-api
- Covers GatewayClass, Gateway, HTTPRoute, LoadBalancerConfiguration CRDs
- Includes three lab sections: Exposing UI, Path-Based Routing, Canary Deployment
- Uses LBC v3.3.0 with --defaultTargetType=ip for ClusterIP service compatibility
- Terraform installs Gateway API CRDs and AWS LBC Gateway CRDs via kubectl apply
- TargetGroupConfiguration for catalog health check (/health)
- Cross-namespace routing with allowedRoutes.namespaces.from: All
- Canary deployment with weighted traffic splitting (90/10, 50/50, 0/100)
- Fix ECR Public auth in Makefile for create/destroy-infrastructure targets
- Fix pids array unbound variable in create-infrastructure.sh
- Add kubectl wait for Gateway Programmed condition (600s timeout)
- Fix sourceRanges fallback when INBOUND_CIDRS is empty
- Update path-based-routing to use /catalog/products endpoint
- Add sample curl output for catalog and UI verification
- Remove ExternalDNS from introduction (not used in this module)
- Remove step numbers from exposing-ui and canary pages
- Consolidate verify commands into single code block
- Add orange theme screenshot for canary completion
- Update test-durations.json for ~30 min estimated time
@netlify
Copy link
Copy Markdown

netlify Bot commented May 27, 2026

Deploy Preview for eks-workshop ready!

Name Link
🔨 Latest commit 4f129a8
🔍 Latest deploy log https://app.netlify.com/projects/eks-workshop/deploys/6a18b6475aecf10008f64c95
😎 Deploy Preview https://deploy-preview-1852--eks-workshop.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@niallthomson niallthomson changed the title Lbc gatewayapi 1840 new: Added Gateway API lab May 28, 2026
Copy link
Copy Markdown
Contributor

@niallthomson niallthomson left a comment

Choose a reason for hiding this comment

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

Thanks @desaiajayhnr ! Few changes requested, main thing is to remove external DNS stuff we aren't using.

Can we also remove the .kiro directory

ui-route 2m
```

<!--
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I assume we probably need this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes we need this, as we created the httproute above.

cluster_version = var.eks_cluster_version
oidc_provider_arn = var.addon_context.eks_oidc_provider_arn

enable_external_dns = true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not using external DNS any more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deleted the logic for external dns as we are not using it

value = {
LBC_CHART_VERSION = var.load_balancer_controller_chart_version
LBC_ROLE_ARN = module.eks_blueprints_addons.aws_load_balancer_controller.iam_role_arn
DNS_CHART_VERSION = var.external_dns_chart_version
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not used any more

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deleted as we are not suing external dns

Apply the LoadBalancerConfiguration:

```bash
$ export SOURCE_RANGES=$(echo $INBOUND_CIDRS | tr ',' '\n' | sed 's/^/ - "/;s/$/"/')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It might be easier to use this notation:

sourceRanges: ["a", "b"]

instead of:

sourceRanges:
- "a"
- "b"

I think you can do that with jq like this:

export SOURCE_RANGES=$(echo $INBOUND_CIDRS | jq -R 'split(",")')

But will need verified.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Implemented the above recommendation

- Remove ExternalDNS from Terraform main.tf, vars.tf, outputs.tf, cleanup.sh
- Remove Route 53 private hosted zone (not needed without ExternalDNS)
- Simplify sourceRanges using jq JSON array notation instead of sed
- Remove commented-out code blocks from exposing-ui.md
- Fix GATEWAY_URL export in the verify section
- Remove .kiro directory from git tracking
- Remove ExternalDNS from Terraform main.tf, vars.tf, outputs.tf, cleanup.sh
- Remove Route 53 private hosted zone (not needed without ExternalDNS)
- Simplify sourceRanges using jq JSON array notation instead of sed
- Remove commented-out code blocks from exposing-ui.md
- Fix GATEWAY_URL export in the verify section
- Remove .kiro directory from git tracking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants