Skip to content

Resolve listener TLS certificates through an extension server - #10142

Merged
zirain merged 24 commits into
envoyproxy:mainfrom
wweiwei-li:cert-extension-eg
Oct 30, 2026
Merged

zirain merged 24 commits into
envoyproxy:mainfrom
wweiwei-li:cert-extension-eg

Conversation

@wweiwei-li

@wweiwei-li wweiwei-li commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

feat: resolve listener TLS certificates through an extension server

What this PR does / why we need it:

Envoy Gateway can only source listener TLS certificates from Kubernetes Secrets today. This PR lets an extension server supply them, so certificates managed outside of Secrets (for example, issued and rotated by an external provider) can back a Gateway listener.

An extension registers one or more kinds via a new ExtensionManager.SecretResources field. A listener's tls.certificateRefs may then point at a resource of a registered kind. During xDS translation, Envoy Gateway calls a new ResolveSecret hook on the owning extension, which returns how Envoy should obtain the secret: an SdsSecretConfig, resolved by name or served over SDS. The resolved config is wired into the listener's TLS transport socket.

The change is layered so each concern is reviewable on its own:

  • api: add ExtensionManager.SecretResources and the Secret translator-hook enum value; validation requires the Secret hook when secretResources is set.
  • proto / extension: add the ResolveSecret RPC and the corresponding hook. The hook is non-chaining: a secret kind is owned by exactly one extension, selected by the referenced resource's group/kind.
  • ir: add TLSCertificate.ExtensionRef so an extension-resolved certificate can be represented without key material.
  • gatewayapi: validate the listener certificate ref against the registered kinds and a ReferenceGrant, check the referenced object exists, and thread it into the IR. Its status is not read; readiness is the extension's decision.
  • xds/translator: resolve each extension certificate through the hook and build the SDS config. A certificate the extension reports as unresolved (failure_reason) is left out. A listener whose certificates are all extension-provided and none resolve is skipped rather than emitting a certificate-less filter chain. Hook errors fail translation unless the extension sets failOpen, in which case the certificate is treated as unresolved.
  • provider/kubernetes: watch and list the registered kinds and add them to the resource tree. The watch intentionally omits the generation-change filter so a status-only update from the provider (for example, a certificate becoming ready) retriggers resolution. A kind whose CRD is not installed is skipped rather than failing startup.

Behavior for existing configurations is unchanged: listeners that use only Secret-backed certificates never touch the extension path.

Which issue(s) this PR fixes:

#10008


PR Checklist

  • Authorship & ownership: Coding agents / AI assistants are welcome, but I have reviewed every change, understand how and why it works, can explain and maintain it, and take full responsibility for this PR. I have not submitted generated output I do not understand.
  • DCO: All commits are signed off (git commit -s). See DCO: Sign your work.
  • API agreed first: If this PR contains API changes (changes under /api), the API was discussed and agreed before the implementation. The API change can be in a separate PR, or in the same PR, but the API must be agreed before implementation. N/A if this PR does not contain API changes.
  • [x ] Required checks pass: make generate gen-check, make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, but gen-check, lint, and coverage MUST pass.)
  • Tests added/updated: New/changed code is covered by appropriate tests. N/A if this PR does not contain code changes.
  • Docs: User-facing changes update the docs, either in this PR or a follow-up PR. N/A if this PR does not contain user-facing changes.
  • Release notes: For any non-trivial change, added a release-note fragment under release-notes/current/<section>/<pr-number>-<slug>.md (see release-notes/current/README.md for sections and naming). N/A if this PR does not contain non-trivial changes.
  • Generated files committed: Ran make gen-check and committed the result if API/helm charts/modules changed.
  • Scope & compatibility: The PR is reasonably scoped (no unrelated changes) and preserves backward compatibility, or any breaking change is called out above and documented in release-notes/current/breaking_changes/.
  • Codex review: Requested a Codex review and addressed all of its comments.
  • Copilot review: Requested a Copilot review and addressed all of its comments.

@wweiwei-li
wweiwei-li requested a review from a team as a code owner September 29, 2026 03:06
@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 615f3f0
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6ae343c7c519fbcccf5ba89a
😎 Deploy Preview https://deploy-preview-10142--cerulean-figolla-1f9435.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.

@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.74429% with 115 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.20%. Comparing base (5230879) to head (615f3f0).

Files with missing lines Patch % Lines
internal/provider/kubernetes/controller.go 47.87% 49 Missing ⚠️
internal/gatewayapi/validate.go 58.33% 25 Missing ⚠️
internal/xds/translator/translator.go 80.64% 12 Missing ⚠️
internal/xds/translator/listener.go 88.73% 8 Missing ⚠️
internal/gatewayapi/runner/runner.go 0.00% 6 Missing ⚠️
internal/extension/registry/xds_hook.go 84.61% 4 Missing ⚠️
internal/ir/xds.go 62.50% 3 Missing ⚠️
internal/provider/kubernetes/controller_offline.go 70.00% 3 Missing ⚠️
internal/gatewayapi/listener.go 60.00% 2 Missing ⚠️
internal/provider/file/store.go 33.33% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10142      +/-   ##
==========================================
- Coverage   82.29%   82.20%   -0.09%     
==========================================
  Files         277      277              
  Lines       43617    44005     +388     
==========================================
+ Hits        35894    36174     +280     
- Misses       7722     7830     +108     
  Partials        1        1              

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

@zhaohuabing

zhaohuabing commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Would it make sense to make this API generic for Envoy secrets instead of listener certificates? For example, we could rename CertificateResources and PostTLSCertificateResolve to SecretResources and ResolveSecret. This would let us support those other secret types(CA bundles, client Certs, etc.) later without adding parallel APIs.

@wweiwei-li

Copy link
Copy Markdown
Contributor Author

Would it make sense to make this API generic for Envoy secrets instead of listener certificates? For example, we could rename CertificateResources and PostTLSCertificateResolve to SecretResources and ResolveSecret. This would let us support those other secret types(CA bundles, client Certs, etc.) later without adding parallel APIs.

Hey @zhaohuabing , Thanks for reviewing it. Done, generalized the extension API to secrets (SecretResources, ResolveSecret, XDSSecret).

I kept the listener certificate IR and translator logic certificate-specific, since that's just one consumer of the generic hook, for future secret types (CA bundles, client certs) can reuse ResolveSecret

Add ExtensionManager.SecretResources and the Secret translator hook.
A listener's tls.certificateRefs may reference a registered kind in place
of a Kubernetes Secret. Validation requires the Secret hook when
secretResources is set.

Signed-off-by: Weiwei Li <[email protected]>
ResolveSecret asks the owning extension how Envoy should obtain a secret
referenced from a registered kind. The response is an SdsSecretConfig, or
a failure reason and message when the secret is not resolved.

Signed-off-by: Weiwei Li <[email protected]>
Add ResolveSecretHook to the hook client. The hook does not chain: with
multiple extension managers, each secret kind is owned by exactly one
extension, selected by the referenced resource's group and kind.

Signed-off-by: Weiwei Li <[email protected]>
…ificates

An extension-resolved certificate is carried as a reference to the
registered resource, without key material. It is exclusive with SDS and
inline certificate fields.

Signed-off-by: Weiwei Li <[email protected]>
Resolve each extension-provided listener certificate through ResolveSecret
and add the returned SDS config to the filter chain. A certificate the
extension reports as unresolved is left out, and a listener whose
extension certificates all fail to resolve is skipped rather than built
without a certificate. Hook errors fail translation unless the extension
fails open.

Signed-off-by: Weiwei Li <[email protected]>
A listener certificate ref to a registered secret kind is checked against
a ReferenceGrant and for existence, then passed into the IR as an
ExtensionRef. Its status is not read; readiness is the extension's
decision at xDS time.

Signed-off-by: Weiwei Li <[email protected]>
Watch and list the kinds registered in secretResources and add them to
the resource tree with their status. The watch omits the generation-change
filter so a status-only update from the provider retriggers resolution,
and a kind whose CRD is missing is skipped. The offline controller
registers and lists these kinds as well.

Signed-off-by: Weiwei Li <[email protected]>
@wweiwei-li

Copy link
Copy Markdown
Contributor Author

Following the API rename, I just renamed the internal plumbing that serves SecretResources (provider watch/loader, resource tree field, lookup helpers, composite hook router) from certificate to secret. The listener-specific parts (IR, listener ref validation, xDS) keep certificate naming.

The rename touched every layer and it's the only feedback so far, so I force pushed to regroup the commmit history into one commit per layer.

Hope this could make it easier for other maintainers to review.

@arkodg arkodg added this to the v1.10.0-rc.1 Release milestone Oct 15, 2026
@zirain

zirain commented Oct 22, 2026

Copy link
Copy Markdown
Member

@wweiwei-li can you fix the conflict?

@zhaohuabing
zhaohuabing requested a review from guydc October 23, 2026 05:40
@guydc

guydc commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Hook errors fail translation unless the extension sets failOpen, in which case the certificate is treated as unresolved.

Should a secret resolution failure always be treated as an error regardless of failOpen/failClose? For other hooks, some mutations were not applied, but it's still possible that the base EG-generated XDS is valid. If a listener TLS secret is missing, is it better to fail (and keep proxy config as-is)?

@guydc guydc left a comment

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.

Hi @wweiwei-li. Thanks for this work. Some initial thoughts.

Additionally, in general, there is a security aspect to this feature that we need to consider. If a local extension resource can reference any SDS config and gain access to that secret, integrity issues are possible.

We need to think about:

  1. How do we prevent users from referencing static/dynamic system-generated certs, like the EG client cert. That should be pretty easy with a post-resolution denylist.
  2. Is there any sort of reasonable validation that we can perform that will prevent unauthorized use of SDS secrets? If not, we need to very explicitly state this concern in our docs and threat model and document it as an extension-server implementor responsibility.

Comment thread proto/extension/context.pb.go Outdated
// The secret resource that was referenced.
SecretResource *ExtensionResource `protobuf:"bytes,1,opt,name=secret_resource,json=secretResource,proto3" json:"secret_resource,omitempty"`
// Namespace and name of the Gateway owning the listener.
GatewayNamespace string `protobuf:"bytes,2,opt,name=gateway_namespace,json=gatewayNamespace,proto3" json:"gateway_namespace,omitempty"`

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.

Passing GW-API context here (GW/Listener Name, Namespaces) is a bit unprecedented in the extension server API. So far, the API was really focused on XDS and user-provided context resources. Are these fields strictly required for every implemention, or can they be encoded into the user-provided context resource in cases where they are needed?

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.

Passing GW-API context here (GW/Listener Name, Namespaces) is a bit unprecedented in the extension server API. So far, the API was really focused on XDS and user-provided context resources. Are these fields strictly required for every implemention, or can they be encoded into the user-provided context resource in cases where they are needed?

removed listener_name in 7f9de03. but I had to keep GW namespace and name. For our usage, the secret separately for each Gateway'. so the same resource can be ready on one Gateway and not yet on another. the hook needs to know which gateway it is resolving for

@guydc guydc Oct 27, 2026 •

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.

Can you store this information in the custom resource? The secret CRD will define not only the secret name but also its scope of attachment? This might mean duplicating a CRD that was previously referenced by multiple GWs, but I'm not sure how common it is to share a server cert across GWs.

I'm just hesitant to tie GW-API metadata in the XDS-driven extension server interface...

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.

hey @guydc, Thanks. I understand your hesitation. Specifying the attachment in the secret CRD could work, but it has two drawbacks:

  1. Duplication: sharing a server cert across Gateways is common for our case
  2. We rely on users to keep the scope and the references consistent as the extension doesn't know which Gateway is asking, so it trusts the scope written in the CR. If Gateway B references a CR scoped to Gateway A, the extension answers for A, and B fails silently. Catching that would need every extension to add its own validation.

Having EG pass it avoids both: one CR can serve any number of Gateways, and the value always matches the listener being built, because it comes from EG.

If you'd rather keep Gateway API out of the interface, I can pass the proxy infra name/namespace instead (the same identity EG gives the infrastructure provider extension in ProxyInfra. It identifies the data plane, and it also works with mergeGateways.

Or, if you still think the secret CRD should cover this, Please let me know.

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.

Passing the id of the dataplane for which this xds is being built sounds reasonable to me, and creates consistency across extension servers that deal with both infra and xds.

Would appreciate input from @envoyproxy/gateway-maintainers.

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.

sounds good to me, it shouldn't be a common for all the contexts.

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.

Thank you both. Made this change in 3a7c555: the secret hook context now carries the proxy infra (proxy.name, proxy.namespace) instead of the Gateway namespace/name.

Comment thread internal/gatewayapi/helpers.go Resolved
Comment thread internal/xds/translator/listener.go Resolved
@guydc

guydc commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

@codex

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T13:10:17.520347Z 615f3f0 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Signed-off-by: Weiwei Li <[email protected]>

# Conflicts:
#	internal/extension/registry/composite_hook_client_test.go
#	internal/gatewayapi/resource/load_test.go
#	proto/extension/context.pb.go
Signed-off-by: Weiwei Li <[email protected]>

# Conflicts:
#	internal/provider/kubernetes/controller.go

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7eb2568d42

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


// Close the listeners none of whose extension certificates resolved. This runs after the other
// listeners are built, so it joins the xDS listener they share a port with. HTTP/3 is not
// closed this way, as a QUIC filter chain cannot be built without a certificate.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent unresolved QUIC SNIs from reaching wildcard listeners

When two HTTPS listeners share a port, HTTP/3 is enabled, and an extension-only listener's certificate is unresolved, this path adds a rejecting TCP chain but no QUIC chain for that listener's SNI. If a resolved peer has a wildcard/default QUIC filter chain covering that hostname, the QUIC ClientHello selects the peer and serves its certificate/routes instead of refusing the unresolved listener, which can misroute traffic across listeners or merged Gateways. Suppress the shared QUIC listener or install an equivalent rejecting QUIC chain for these SNIs.

Useful? React with 👍 / 👎.

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.

This is not introduced by this PR. On QUIC, an unresolved listener behaves the same as an invalid one does today. This PR adds a closed filter chain on TCP

namespace: secretNS,
name: string(secretRef.Name),
}
refGrant, err := r.findReferenceGrant(ctx, from, to)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Match ReferenceGrant groups before selecting one

When the target namespace contains grants for the same source namespace and target kind/name in different API groups, this call can load the wrong grant: findReferenceGrant compares only namespace/kind/name and returns the first match, ignoring both From.Group and To.Group. The Gateway API validator later performs exact group matching, so a valid extension certificate reference is rejected even when another correct grant exists; pass the source/target groups into the lookup or retain all candidate grants.

Useful? React with 👍 / 👎.

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.

findReferenceGrant is existing helper

BackendTLSPolicies []*gwapiv1.BackendTLSPolicy `json:"backendTLSPolicies,omitempty" yaml:"backendTLSPolicies,omitempty"`
EnvoyExtensionPolicies []*egv1a1.EnvoyExtensionPolicy `json:"envoyExtensionPolicies,omitempty" yaml:"envoyExtensionPolicies,omitempty"`
ExtensionServerPolicies []unstructured.Unstructured `json:"extensionServerPolicies,omitempty" yaml:"extensionServerPolicies,omitempty"`
ExtensionSecrets []unstructured.Unstructured `json:"extensionSecrets,omitempty" yaml:"extensionSecrets,omitempty"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Sort extension secrets before storing snapshots

When a registered secret kind has multiple objects, processExtensionSecrets preserves the cache's list order, but Resources.Sort never orders this new ExtensionSecrets slice. If the cache returns the same objects in a different order, ControllerResourcesContext.Equal's deep comparison treats the snapshot as changed and unnecessarily reruns translation and per-certificate extension hooks; add deterministic sorting for this slice like the other unstructured resource collections.

Useful? React with 👍 / 👎.

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.

Yeah, I can add this sort

@wweiwei-li wweiwei-li Oct 29, 2026 •

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.

Fixed in 8395d2a

@zhaohuabing zhaohuabing removed this from the v1.10.0-rc.1 Release milestone Oct 29, 2026
@wweiwei-li

Copy link
Copy Markdown
Contributor Author

Hey @zhaohuabing I saw you removed this from v1.10.0-rc.1 Release, Can we have it ? I addressed all the feedbacks. @guydc @zirain Can you take another look when you get a chance ?

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8395d2a2b8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/gatewayapi/resource/load.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae25238463

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

}
for _, gvk := range em.SecretResources {
key := fmt.Sprintf("%s/%s/%s", gvk.Group, gvk.Version, gvk.Kind)
extGVKMap[key] = extSecret

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retain all categories for an extension GVK

When standalone/file-provider configuration registers the same GVK in secretResources and any of resources, policyResources, or backendResources, this single-valued map lets one category overwrite the other, and the switch below appends the object to only one resource slice. This overlap is accepted by configuration validation and the Kubernetes provider collects the categories independently; for example, a backend registration is processed after this assignment, so the object never reaches ExtensionSecrets and a listener referencing it is reported as InvalidCertificateRef. Store all applicable categories rather than only the last one.

Useful? React with 👍 / 👎.

Comment on lines +606 to +608
for i := range config.extensionCertificates {
tlsListenerConfigs.Certificates = append(tlsListenerConfigs.Certificates,
t.getTLSCertificateFromExtensionRef(&config.extensionCertificates[i], gwIR, gatewayCtx))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve certificateRefs order across source types

When a listener places an extension-backed certificate before a Kubernetes or SDS Secret in certificateRefs, validation stores the two source types in separate slices and this loop appends every extension certificate after every Secret. The resulting IR and xDS order therefore differs from the configured order; for a wildcard listener with no SNI, or whenever multiple compatible certificates remain, Envoy's first compatible certificate can become the later Secret rather than the configured extension certificate. Preserve the original interleaving when constructing Certificates.

Useful? React with 👍 / 👎.

@wweiwei-li

Copy link
Copy Markdown
Contributor Author

Codex is leaving new comments on each push. I addressed findings that are specific to this PR changes, and leaving existing behavior outside its scope for followups if maintainers think they need to be fixed

@zhaohuabing zhaohuabing added this to the v1.10.0-rc.1 Release milestone Oct 29, 2026
@zhaohuabing
zhaohuabing requested review from guydc and zirain October 29, 2026 05:02
// Version is intentionally dropped so matching aligns with runner.ExtensionGroupKinds
// and Manager.HasExtension, which also compare by group+kind only.
func buildManagerGKSets(ext *egv1a1.ExtensionManager) (sets.Set[schema.GroupKind], sets.Set[schema.GroupKind]) {
func buildManagerGKSets(ext *egv1a1.ExtensionManager) (sets.Set[schema.GroupKind], sets.Set[schema.GroupKind], sets.Set[schema.GroupKind]) {

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.

nit (non-blocking, fine as a follow-up): with secretGKSet this now returns three values of the same type, so swapping them at a call site would compile and silently misroute matching. The sets also get copied field by field into namedManager and then into hookClientEntry, so each new category touches every call site.

Consider returning a struct that flows through unchanged:

type extensionGKSets struct {
	resource sets.Set[schema.GroupKind] // Resources + BackendResources
	policy   sets.Set[schema.GroupKind] // PolicyResources
	secret   sets.Set[schema.GroupKind] // SecretResources
}

func buildManagerGKSets(ext *egv1a1.ExtensionManager) extensionGKSets

with namedManager / hookClientEntry holding a single gkSets extensionGKSets field. Happy to do this in a separate PR.

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.

Good point, addressed it in 615f3f0

@wweiwei-li

Copy link
Copy Markdown
Contributor Author

Merged the latest main and resolved the conflict. The failing e2e test (TestE2E/ClientMTLS) timed out waiting was not related to my change. It looks like a flaky test.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 615f3f011c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

if t.ExtensionManager == nil {
return nil, fmt.Errorf("certificate %q requires an extension server but none is configured", cert.Name)
}
hookClient, err := (*t.ExtensionManager).GetPostXDSHookClient(egv1a1.XDSSecret)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Select only the owning Secret client

When multiple extension managers enable Secret, resolving a certificate for manager B calls GetPostXDSHookClient here before the referenced group/kind is considered. CompositeManager.collectHookClients eagerly initializes every manager and returns any non-fail-open setup error (internal/extension/registry/composite_manager.go:141-148); for example, GenerateGRPCOptions errors when unrelated manager A's TLS credential Secret is missing (internal/extension/grpc.go:79-91). This blocks B's otherwise healthy certificate and therefore the entire xDS update despite this hook being non-chaining, so select the owner by group/kind before constructing clients.

Useful? React with 👍 / 👎.

@zhaohuabing

Copy link
Copy Markdown
Member

/retest

2 similar comments
@wweiwei-li

Copy link
Copy Markdown
Contributor Author

/retest

@wweiwei-li

Copy link
Copy Markdown
Contributor Author

/retest

@guydc guydc left a comment

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.

LGTM. Remaining P2 findings can be completed in a follow-up.

@wweiwei-li

Copy link
Copy Markdown
Contributor Author

Hey @zhaohuabing , FileAccessLog in e2e-test (v1.37.0, dual, gateway-namespace-mode) is failing , retried it but no luck. The only code change since the last pass for it is the extensionGKSets refactor, it won't introduce issue to it. It looks like a flaky or test-side issue. Can you check whether we can override it?

@zirain zirain left a comment

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.

LGTM, please fix the remaining before 1.10.0(Nov 4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API-related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants