You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d66825d
Browse filesBrowse the repository at this point in the historyBrowse files
Resolve Contour's delegated TLS secrets in their own namespace (#2073)
Contour lets an HTTPProxy terminate TLS with a certificate kept in
another namespace. That namespace grants access with a
`TLSCertificateDelegation`, and the proxy names the Secret as
`namespace/name` in `spec.virtualhost.tls.secretName`. Radar treated
that whole string as a Secret name in the proxy's namespace, which
caused three problems:
- **Topology** drew an edge to `secret/<proxy-ns>/<cert-ns>/<name>`, a
Secret that doesn't exist, and created a stub node for it in the proxy's
namespace.
- **The HTTPProxy drawer's** TLS link and Related Resources pointed to a
Secret named `<cert-ns>` in the proxy's namespace. The link opened
"Resource not found".
- **The audit** reported the delegated certificate as
`orphanConfigMapSecret`, even though Contour serves it.
The audit also missed Secrets that HTTPProxies reference in other
fields: client-validation CA and CRL Secrets, upstream-validation CA
Secrets, and the JWKS CA. It reported those Secrets as unused too.
## What changed
- **One parser, matching Contour.** `configrefs.ContourSecretRef` (Go)
and `getHTTPProxyTLSSecret` (k8s-ui) resolve a reference the way
Contour's `k8s.NamespacedNameFrom` does, with the proxy's namespace as
the default. A bare name, or an empty namespace part, stays in the
proxy's namespace; otherwise the part before the first `/` is the
namespace.
- **Topology:** the TLS edge, the stub node and the cert-manager
Certificate lookup now use the Secret's real namespace. In a
namespace-filtered view, a delegated Secret and its edge appear only
when its namespace is selected, like any other node.
- **Drawer:** the TLS link opens the right Secret, and a delegated one
shows as `namespace/name`.
- **Audit — references:** it now reads every Secret reference Contour
resolves this way:
- `virtualhost.tls.secretName`;
- `tls.clientValidation.caSecret` and `crlSecret`;
- `jwtProviders[].remoteJWKS.validation.caSecret`;
- `routes[].services[].validation.caSecret` and
`tcpproxy.services[].validation.caSecret`.
- **Audit — cross-namespace source:** HTTPProxies are now marked as a
cross-namespace reference source, like Gateways, so auditing only the
certificate's namespace still reads the proxies that use it.
- Side effect, the same one Gateways already have: under a
namespace-restricted read scope, Radar can't see every proxy that might
reference a Secret. On clusters with the HTTPProxy API, it therefore
stops claiming Secrets are unused rather than guess.
## Result on a live cluster
Contour 1.33.7 on an EKS test cluster. The proxy `shop` in
`radar-contour` uses `radar-contour-certs/wildcard`, and Envoy serves it
over TLS.
| | Before | After |
|---|---|---|
| Topology edge from `shop` |
`secret/radar-contour/radar-contour-certs/wildcard` (stub in
`radar-contour`) | `secret/radar-contour-certs/wildcard` |
| Drawer: Related Resources | `secret/radar-contour-certs` |
`secret/wildcard` |
| Drawer: TLS link | "Resource not found" | Secret `wildcard` with its
certificate details |
| Audit of `radar-contour-certs` | `wildcard`: `orphanConfigMapSecret` |
no finding |
To confirm the audit wasn't just silenced, I added a genuinely unused
Secret to the same namespace. It was still flagged.
| TLS link, before | TLS link, after |
|---|---|
| 
| 
|
## Testing
- **Parsers:** `TestContourSecretRef` and
`resource-utils-contour.test.ts` cover a bare name, `ns/name`, `/name`
and `a/b/c`.
- **Topology:** `TestHTTPProxyTLSSecretResolvesDelegatedNamespace`
checks the edges, the stub's namespace and the Certificate edge.
`TestHTTPProxyDelegatedSecretRespectsNamespaceFilter` checks the node
and edge in and out of the filter.
- **Audit:**
- `TestDynamicConfigObjectRefs` covers every reference path.
- `TestListDynamicConfigObjectRefsFindsDelegatedContourSecret` covers
the cross-namespace read.
- `TestDelegatedContourCertificateIsNotOrphan` covers the full audit:
unrestricted, the unused Secret is flagged and the delegated one isn't;
under restricted scope, neither is claimed.
- Each test fails with its fix reverted.
- `make tsc` and `make test` pass.
## Notes
The Related Resources panel files this Secret under "Used By" and
Services under "Pods". That's how relationships currently map HTTPProxy
edges, both before and after this PR; it's tracked with the
edge-direction work in RAD-695.
0 commit comments