Skip to content

feat: convert IR APIKeyAuth Credentials Map into a Slice of Struct#7584

Merged
arkodg merged 4 commits intoenvoyproxy:mainfrom
lalet:fix/api-key-auth-credentials-slice
Nov 26, 2025
Merged

feat: convert IR APIKeyAuth Credentials Map into a Slice of Struct#7584
arkodg merged 4 commits intoenvoyproxy:mainfrom
lalet:fix/api-key-auth-credentials-slice

Conversation

@lalet
Copy link
Copy Markdown
Contributor

@lalet lalet commented Nov 22, 2025

This PR converts the APIKeyAuth.Credentials field in the internal IR from a map[string]PrivateBytes to a slice of Credential structs ([]Credential). This change ensures that the order of credentials is preserved, which is important for deterministic behavior and testing.

Fixes #7568

Signed-off-by: Lalet Scaria <laletscaria@gmail.com>
@lalet lalet requested a review from a team as a code owner November 22, 2025 02:00
}

credentials := make(map[string]ir.PrivateBytes)
credentials := make([]ir.Credential, 0)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we prealloc the size of slice?

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@lalet I think this is what @zirain meant 👉#7584 (comment)

// Credential defines a single API key credential.
//
// +k8s:deepcopy-gen=true
type Credential struct {
Copy link
Copy Markdown
Member

@zhaohuabing zhaohuabing Nov 24, 2025

Choose a reason for hiding this comment

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

The name Credential is a bit too broad. Would APICredential be a better fit?

lalet and others added 2 commits November 24, 2025 19:06
Signed-off-by: Lalet Scaria <lscaria@ripple.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 25, 2025

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.34%. Comparing base (3052ea4) to head (7635823).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
internal/gatewayapi/securitypolicy.go 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7584   +/-   ##
=======================================
  Coverage   72.33%   72.34%           
=======================================
  Files         232      232           
  Lines       34114    34120    +6     
=======================================
+ Hits        24678    24685    +7     
- Misses       7661     7663    +2     
+ Partials     1775     1772    -3     

☔ View full report in Codecov by Sentry.
📢 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.

Signed-off-by: Lalet Scaria <lscaria@ripple.com>
@arkodg arkodg added this to the v1.7.0-rc.1 Release milestone Nov 25, 2025
Copy link
Copy Markdown
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@arkodg arkodg requested review from zhaohuabing and zirain November 25, 2025 18:59
@kkk777-7
Copy link
Copy Markdown
Member

LGTM, thanks!

@arkodg arkodg merged commit 4784e5a into envoyproxy:main Nov 26, 2025
29 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert IR APIKeyAuth Credentials Map into a Slice of Struct

5 participants