Skip to content

fix: wait for TLS certificates before enabling WAF#107

Merged
scotwells merged 1 commit intomainfrom
fix/tpp-certificate-readiness
Feb 5, 2026
Merged

fix: wait for TLS certificates before enabling WAF#107
scotwells merged 1 commit intomainfrom
fix/tpp-certificate-readiness

Conversation

@scotwells
Copy link
Contributor

When a TrafficProtectionPolicy targets a Gateway with HTTPS listeners, the EnvoyPatchPolicy uses JSONPath selectors to patch the route configuration. However, if the TLS certificate isn't ready yet, Envoy Gateway won't materialize the filter_chains for the HTTPS listener, causing the JSONPath selectors to fail with "ResourceNotFound" errors.

This resulted in EnvoyPatchPolicies stuck in a non-programmed state with errors like:

Unable to find xds resources: type.googleapis.com/envoy.config.route.v3.RouteConfiguration/ns-.../gateway/https

The fix adds certificate readiness verification before creating EnvoyPatchPolicies. When certificates are pending, the reconciler:

  • Sets Accepted=False with reason WaitingForCertificates
  • Lists the pending certificate names in the status message

A watch on downstream Certificate resources triggers immediate reconciliation when certificates become ready, ensuring minimal delay once TLS is provisioned.

Note

This is a mitigation.

Ideally, WAF should be enabled on HTTP listeners independently of HTTPS certificate provisioning status. Future work should decouple HTTP and HTTPS listener patching so traffic protection can be applied to HTTP listeners immediately while waiting for certificates.

When a TrafficProtectionPolicy targets a Gateway with HTTPS listeners,
the EnvoyPatchPolicy uses JSONPath selectors to patch the route
configuration. However, if the TLS certificate isn't ready yet, Envoy
Gateway won't materialize the filter_chains for the HTTPS listener,
causing the JSONPath selectors to fail with "ResourceNotFound" errors.

This resulted in EnvoyPatchPolicies stuck in a non-programmed state with
errors like:
  "Unable to find xds resources: type.googleapis.com/envoy.config.route.v3.RouteConfiguration/ns-.../gateway/https"

The fix adds certificate readiness verification before creating
EnvoyPatchPolicies. When certificates are pending, the reconciler:
- Sets Accepted=False with reason "WaitingForCertificates"
- Lists the pending certificate names in the status message

A watch on downstream Certificate resources triggers reconciliation
when certificates become ready.

Note: This is a mitigation. Ideally, WAF should be enabled on HTTP
listeners independently of HTTPS certificate provisioning status. Future
work should decouple HTTP and HTTPS listener patching so traffic
protection can be applied to HTTP listeners immediately while waiting
for certificates.
@scotwells scotwells force-pushed the fix/tpp-certificate-readiness branch from e3d1382 to cb946ff Compare February 5, 2026 22:00
@ecv
Copy link

ecv commented Feb 5, 2026

Hell yeah!

Copy link

@ecv ecv left a comment

Choose a reason for hiding this comment

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

Way to use label states as semaphores.

@scotwells scotwells merged commit 37a552e into main Feb 5, 2026
10 checks passed
@scotwells scotwells deleted the fix/tpp-certificate-readiness branch February 5, 2026 22:11
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.

3 participants