Skip to content

Move mutual auth helpers to shared utils - #4918

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
bobert-2:refactor-mtls
Oct 9, 2026
Merged

kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
bobert-2:refactor-mtls

Conversation

@bobert-2

@bobert-2 bobert-2 commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Description

Code refactoring. Moving mutual authentication helpers to shared_utils. Tests are updated.

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 🌟

@kubernetes-prow kubernetes-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 2, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @bobert-2. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 2, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from oliviassss and shuqz October 2, 2026 18:25
@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 6, 2026
@shraddhabang shraddhabang added this to the v3.7.0 milestone Oct 6, 2026
@wweiwei-li
wweiwei-li requested a balanced review from Copilot October 6, 2026 03:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Protocol-specific validation needs non-HTTPS coverage, and the dependency and documentation inconsistencies should be corrected.

Review effort: Balanced
Findings: 2 Medium severity · 2 Low severity

Open (4)
What changed in this PR

Centralizes mutual-authentication parsing, validation, and trust-store resolution in shared utilities.

Changes:

  • Adds shared mutual-authentication helpers and tests.
  • Updates ingress listener construction to use shared helpers.
  • Removes obsolete context parameters and duplicated validation code.
File Description
pkg/​shared_utils/​mutual_auth_utils.go Adds shared mTLS utilities.
pkg/​shared_utils/​mutual_auth_utils_test.go Adds validation tests.
pkg/​ingress/​model_build_listener.go Adopts shared utilities and removes duplication.
pkg/​ingress/​model_build_listener_test.go Updates tests for revised signatures.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/shared_utils/mutual_auth_utils.go Resolved
}{
{
name: "happy path no validation error off mode",
protocol: elbv2model.ProtocolHTTPS,
Comment thread pkg/ingress/model_build_listener.go Outdated
func (t *defaultModelBuildTask) computeIngressListenPortConfigByPort(ctx context.Context, ing *ClassifiedIngress, cert *acmModel.Certificate) (map[int32]listenPortConfig, error) {
explicitTLSCertARNs := t.computeIngressExplicitTLSCertARNs(ctx, ing)
// explicitly set ARNs on the IngressClass or Ingress take predecende over newly created certificates, avoid creating unneeded certs then
// ARNs set on the IngressClass or Ingress take precedent over newly created certificates, avoid creating unneeded certs

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

Comment thread pkg/shared_utils/mutual_auth_utils.go Outdated
AdvertiseTrustStoreCaNames *string `json:"advertiseTrustStoreCaNames,omitempty"`
}

// ParseMtlsConfigEntries returns an array mapping listener port to MutualAuthenticationAttributes

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: bobert-2 / name: Kelly Yan (3b94210)

@kubernetes-prow kubernetes-prow Bot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 6, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bobert-2, shraddhabang, wweiwei-li

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:
  • OWNERS [shraddhabang,wweiwei-li]

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

@wweiwei-li

Copy link
Copy Markdown
Collaborator

/lgtm

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 7, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.26866% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.66%. Comparing base (2fcd20d) to head (67c67f8).
⚠️ Report is 58 commits behind head on main.

Files with missing lines Patch % Lines
pkg/shared_utils/mutual_auth_utils.go 37.93% 36 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4918      +/-   ##
==========================================
+ Coverage   57.44%   57.66%   +0.22%     
==========================================
  Files         396      400       +4     
  Lines       31619    31922     +303     
==========================================
+ Hits        18164    18409     +245     
- Misses      12398    12444      +46     
- Partials     1057     1069      +12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Oct 8, 2026
@shraddhabang

Copy link
Copy Markdown
Collaborator

/lgtm
/ok-to-test

@kubernetes-prow kubernetes-prow Bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Oct 9, 2026
@kubernetes-prow kubernetes-prow Bot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 9, 2026
@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 9, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit 0e7eefa into kubernetes-sigs:main Oct 9, 2026
5 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants