Skip to content

Conversation

zac-nixon
Copy link
Collaborator

@zac-nixon zac-nixon commented Sep 19, 2025

Issue

#4319

Description

Adds a controller flag, that will remove mTLS configuration when the annotation is removed from the annotations. This flag could potentially be moved to other APIs, like Provisioned Capacity, but those require a bigger lift. This change preserves the initial LBC logic, so no breaking API changes. See the code for the various cases that I considered.

With Gateway API, we were handling removal of mTLS configuration much better. With this change, I am going ahead and enabling EnhancedDefault behavior for Gateway API as I believe this implementation is correct and better than ignoring missing annotations. Because the deployer is smarter now, we can remove the Local Zone / Outpost check from the Gateway API model builder.

Summary of additions:

  • Defaulting behavior for ALPN, ProvisionedCapacity, and mTLS in Gateway API.
  • Same defaulting behavior for ALPN and mTLS offered to Ingress API users, behind a feature flag.
  • Refactored Gateway API addons to support ProvisionedCapacity, that way we can use the same defaulting logic currently in-use by Shield and WAF

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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 19, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 19, 2025
@zac-nixon
Copy link
Collaborator Author

/retest

1 similar comment
@zac-nixon
Copy link
Collaborator Author

/retest

@k8s-ci-robot
Copy link
Contributor

@zac-nixon: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-aws-load-balancer-controller-e2e-test 48b11fd link true /test pull-aws-load-balancer-controller-e2e-test

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.

if isSubnetInLocalZoneOrOutpost {
// Skip mTLS configuration for Local Zone or Outpost subnets
l.logger.V(1).Info("skipping mutual authentication configuration as it is not supported in local zone or outpost")
if !isSecureProtocol(gwLsCfg.protocol) || lbLsCfg == nil || lbLsCfg.MutualAuthentication == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we removing the outpost/lz checks from here?
This will fail in creating listeners in outpost/lz as our CRD default is OFF (even if customer does not specify it). the drift logic in deployer only run for updates not for create. So for new listeners we will have desired mtls setting as non-nil with OFF setting, and we will fail in creating listener. we still need to check outpost/lz if we are building listener object from CRD for such cases. Correct me if I am wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's on the lines below:


	// Default to "off" mode when no explicit mTLS configuration exists
	if lbLsCfg == nil || lbLsCfg.MutualAuthentication == nil {
		return &elbv2model.MutualAuthenticationAttributes{
			Mode: string(elbv2gw.MutualAuthenticationOffMode),
		}, nil
	}

I removed this block, as the new defaulting checks within the deployer package make it so we don't need to inject the off mode.

})
prestack = append(prestack, shieldPrestack)
break
case addon.ProvisionedCapacity:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I really like this. Thanks for unifying these

// 8. desired = Other value, sdk = None. Result = drift
// 9. desired = Other value, sdk = Other value. Result = drift depending on equality.

desiredIsNilOrNone := lsSpec.ALPNPolicy == nil || len(lsSpec.ALPNPolicy) == 0 || lsSpec.ALPNPolicy[0] == string(elbv2model.ALPNPolicyNone)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we check nil here? is it possible lsSpec.ALPNPolicy=nil so lsSpec.ALPNPolicy[0] will panic. same for sdkLS.Listener, and then sdkLS.Listener.AlpnPolicy will panic

SubnetMappings: subnets.subnets,
SecurityGroups: securityGroupTokens,
LoadBalancerAttributes: lbModelBuilder.buildLoadBalancerAttributes(lbConf),
MinimumLoadBalancerCapacity: lbModelBuilder.buildLoadBalancerMinimumCapacity(lbConf),
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are we not taking MinimumLoadBalancerCapacity from load balancer spec anymore?

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. 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