Skip to content

fix sorting when comparing listener rule differences - #4382

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
zac-nixon:main
Oct 8, 2025
Merged

fix sorting when comparing listener rule differences#4382
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
zac-nixon:main

Conversation

@zac-nixon

Copy link
Copy Markdown
Collaborator

Description

Anytime the Ingress reconcilation process runs, it can potentially modify all ALB rules. This is because in v2.12.0 we broke the listener rule conditions sorting, which prevented semantically similar configurations to be detected as drifted. As listener rule conditions can be returned in any order, the reconcilation process could potentially say a configuration like:

				{
					Field: awssdk.String("host-header"),
					HostHeaderConfig: &types.HostHeaderConditionConfig{
						Values: []string{"h1"},
					},
				},
				{
					Field: awssdk.String("path-pattern"),
					PathPatternConfig: &types.PathPatternConditionConfig{
						Values: []string{"path-pattern"},
					},
				},

is not equal to

				{
					Field: awssdk.String("path-pattern"),
					PathPatternConfig: &types.PathPatternConditionConfig{
						Values: []string{"path-pattern"},
					},
				},
				{
					Field: awssdk.String("host-header"),
					HostHeaderConfig: &types.HostHeaderConditionConfig{
						Values: []string{"h1"},
					},
				},

The root cause that broke the sorting is that we started using the actual condition / action objects in the array, rather than a pointer. e.g. originally the code was comparing arrays of []*elbv2types.RuleCondition, but it v2.12 this was refactored to compare arrays of []elbv2types.RuleCondition while the compartator was still expecting a *elbv2types.RuleCondition. I fixed the comparator to use the right type. Also, I added some compile time checks and warnings to ensure this doesn't happen again.

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 Oct 8, 2025
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 8, 2025
@shuqz

shuqz commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 8, 2025
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@shraddhabang shraddhabang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot
k8s-ci-robot merged commit 0eb4a91 into kubernetes-sigs:main Oct 8, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants