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
system_internal_tls_test.go:231: Deleting secret in ingress namespace
spoof.go:110: Spoofing tls-certificate-rotation-ehunlvfy.serving-tests.example.com -> 34.139.176.129
system_internal_tls_test.go:249: The endpoint http://tls-certificate-rotation-ehunlvfy.serving-tests.example.com/ didn't serve the expected text "Hello World! How about some tasty noodles?": response: status: 503, body: upstream connect error or disconnect/reset before headers. reset reason: remote connection failure, transport failure reason: TLS_error:|268435581:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED:TLS_error_end:TLS_error_end, headers: map[Content-Length:[230] Content-Type:[text/plain] Date:[Wed, 29 May 2024 10:00:49 GMT] Server:[istio-envoy] Zipkin_trace_id:[4c2c44ed909af014b2d3998de2de3693]] did not pass checks: status = 503 503 Service Unavailable, want one of: [200]
@ReToCode I am not sure if using cmctl renew cert-1 for re-newing certificates would actually help here. There might still be some little time gap when net-istio is loading the new certificate?
Another option would be simply to not delete the Secret in the ingress-namespace during the test (these lines). The test would be a little weaker but these lines are really testing something that is outside the Serving repository. Different ingress implementations might work a bit differently here.
Depends on what the tool does, IMHO, it could set the renewal periods on the cert to force cert-manager to refresh, like this. This would happen without deletion.
But I think waiting a bit longer is fine for that test-case (as we force renewal, which would not happen this way in reality).
What's config.ServingRoutingCertName again? And why do we need to test deleting them from the ingress & system namespace then following up with checking the endpoint is still valid?
This test verifies that the application is reachable at any time during certificate rotation so it shouldn't matter if this runs in parallel with other tests or not. Running it in parallel just speeds up the whole test suite. After taking another look, the other test TestSystemInternalTLS is quite similar as it checks logs, so maybe the new test could be slightly extended to check activator logs and the old test could be removed completely. But that's just a side note.
There's no existing ConfigMap with "trust-bundle" label at the time we're creating the new one. Until creating this ConfigMap, Serving is loading the certificate from the "serving-routing-certs" Secret (the one we're deleting later). So, this new ConfigMap basically adds another place where Serving can look for certificates.
We're creating duplicate bundles because ingress can run in a different namespace and it expects the ConfigMap to be in the same namespace (at least for net-kourier). But now that we don't remove the original Secret from ingress namespace, I think we don't need to create the bundle in the ingress namespace. I missed that with the recent PR.
Deleting the secret is a way to enforce the cert rotation at the given time. There are other ways - like using cmctl renew cert-XY but I'm not sure how exactly it works (if it immediately issues a new certificate or there's some delay).
The config.ServingRoutingCertName Secret is the place where Serving (and Ingress) is loading the certificates from. The cert-manager populates the Secret. Serving can also read the cert from a ConfigMap with "trust-bundle" label which we use in this test to ensure Serving always sees the right certificates, "old" ones and "new" ones.
I guess using a prober would be another way to test it, but it would be harder to know which steps causes issues.
We're creating duplicate bundles because ingress can run in a different namespace and it expects the ConfigMap to be in the same namespace (at least for net-kourier). But now that we don't remove the original Secret from ingress namespace, I think we don't need to create the bundle in the ingress namespace. I missed that with the recent PR.
I'd still keep it that way, as we should re-add this as soon as net-istio supports the trust-bundles. All components need to have the CA and I'd rather not do this cross-namespace. So it makes sense to deploy the bundle to each namespace where a component in the request-path is.
Regarding enforcing cert rotation. I was thinking about modifying the the cert-manager certificate such as the spec.duration field but it is managed by the certificates.networking.internal.knative.dev resource so any changes are reverted. See below.
So I think using cmctl would not work either because it changes status condition here
For the purpose of this test, I think deleting the Secret does the trick.
OK. It's a different failure now: system_internal_tls_test.go:231: Failed to delete secret routing-serving-certs in ingress namespacee
But the test doesn't log the actual error.
Activity
ReToCode commentedon May 30, 2024
Seems that istio is a bit picky when deleting resources that is uses/watches 😒 We can probably either wait a bit longer for it to catch up with the changes and get to a good state or we might need to look at a "cleaner" way of forcing certificate refresh, like https://cert-manager.io/docs/usage/certificate/#reissuance-triggered-by-user-actions. Not sure if we want to add another binary to prow (and call-out to shell) for this though. Thoughts? @dprotaso @skonto @mgencur
mgencur commentedon May 30, 2024
@ReToCode I am not sure if using
cmctl renew cert-1for re-newing certificates would actually help here. There might still be some little time gap when net-istio is loading the new certificate?Another option would be simply to not delete the Secret in the ingress-namespace during the test (these lines). The test would be a little weaker but these lines are really testing something that is outside the Serving repository. Different ingress implementations might work a bit differently here.
ReToCode commentedon May 30, 2024
Depends on what the tool does, IMHO, it could set the renewal periods on the cert to force cert-manager to refresh, like this. This would happen without deletion.
But I think waiting a bit longer is fine for that test-case (as we force renewal, which would not happen this way in reality).
mgencur commentedon May 30, 2024
Sent #15280 to reduce the scope of the test.
dprotaso commentedon May 30, 2024
Few questions about the test since i've lost context
Should the cert rotation be run in parallel with the other test
serving/test/e2e/systeminternaltls/system_internal_tls_test.go
Line 125 in 85d485a
Since we're testing rotation shouldn't we be updating an existing trust bundle? Instead of creating a new one?
serving/test/e2e/systeminternaltls/system_internal_tls_test.go
Line 171 in 85d485a
Why do we need to create duplicate bundles in two namespaces?
serving/test/e2e/systeminternaltls/system_internal_tls_test.go
Line 168 in 85d485a
Does rotation only work when deleting the secret?
serving/test/e2e/systeminternaltls/system_internal_tls_test.go
Lines 202 to 205 in 85d485a
What's config.ServingRoutingCertName again? And why do we need to test deleting them from the ingress & system namespace then following up with checking the endpoint is still valid?
serving/test/e2e/systeminternaltls/system_internal_tls_test.go
Line 226 in 85d485a
Is there no reason we don't use a prober during this test? That would ensure we don't drop any traffic during this process.
mgencur commentedon May 31, 2024
cmctl renew cert-XYbut I'm not sure how exactly it works (if it immediately issues a new certificate or there's some delay).ReToCode commentedon May 31, 2024
I'd still keep it that way, as we should re-add this as soon as net-istio supports the trust-bundles. All components need to have the CA and I'd rather not do this cross-namespace. So it makes sense to deploy the bundle to each namespace where a component in the request-path is.
mgencur commentedon May 31, 2024
Regarding enforcing cert rotation. I was thinking about modifying the the cert-manager certificate such as the
spec.durationfield but it is managed by the certificates.networking.internal.knative.dev resource so any changes are reverted. See below.So I think using
cmctlwould not work either because it changes status condition hereFor the purpose of this test, I think deleting the Secret does the trick.
mgencur commentedon May 31, 2024
Sent a test PR with Prober: #15285
Let me know if this looks ok. Thanks.
ReToCode commentedon Jun 4, 2024
I think that is fine. @dprotaso thoughts?
ReToCode commentedon Jun 12, 2024
@mgencur it seems this is still pretty flaky:
mgencur commentedon Jun 12, 2024
OK. It's a different failure now:
system_internal_tls_test.go:231: Failed to delete secret routing-serving-certs in ingress namespaceeBut the test doesn't log the actual error.
mgencur commentedon Jun 12, 2024
Sent #15325 to properly log errors