Skip to content

Commit 1b1771f

Browse files
abaysclaude
andcommitted
Fix cert-manager CA rotation race in TLS cert rotation KUTTL test
The ctlplane-tls-cert-rotation KUTTL test fails intermittently because the custom_duration patch changes both CA and leaf cert durations simultaneously. cert-manager processes Certificate resources in parallel, so leaf certs can be re-issued before the CA itself is re-issued, resulting in some certs signed by the old CA and others by the new CA. This causes cross-service SSL verification failures (e.g. neutron cannot connect to OVN NB due to CA mismatch). Fix by removing CA duration changes from the patch so only leaf cert durations change, preventing the CA key from rotating. Also add cert-manager re-issuance waits and control plane stability checks in step 03, and add retry logic to the non-API service cert check in step 04. Ref: https://redhat.atlassian.net/browse/OSPRH-32142 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0c84958 commit 1b1771f

3 files changed

Lines changed: 41 additions & 16 deletions

File tree

config/samples/tls/custom_duration/patch.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,15 @@ metadata:
55
spec:
66
tls:
77
ingress:
8-
ca:
9-
duration: 1000h0m0s
108
cert:
119
duration: 500h0m0s
1210
podLevel:
1311
internal:
14-
ca:
15-
duration: 1000h0m0s
1612
cert:
1713
duration: 500h0m0s
1814
libvirt:
19-
ca:
20-
duration: 1000h0m0s
2115
cert:
2216
duration: 500h0m0s
2317
ovn:
24-
ca:
25-
duration: 1000h0m0s
2618
cert:
2719
duration: 500h0m0s

test/kuttl/tests/ctlplane-tls-cert-rotation/03-assert-new-certs.yaml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,34 @@ metadata:
1919
spec:
2020
duration: 500h0m0s
2121
---
22+
apiVersion: cert-manager.io/v1
23+
kind: Certificate
24+
metadata:
25+
name: neutron-internal-svc
26+
spec:
27+
duration: 500h0m0s
28+
---
29+
apiVersion: cert-manager.io/v1
30+
kind: Certificate
31+
metadata:
32+
name: glance-default-internal-svc
33+
spec:
34+
duration: 500h0m0s
35+
---
36+
apiVersion: cert-manager.io/v1
37+
kind: Certificate
38+
metadata:
39+
name: cinder-internal-svc
40+
spec:
41+
duration: 500h0m0s
42+
---
43+
apiVersion: cert-manager.io/v1
44+
kind: Certificate
45+
metadata:
46+
name: placement-internal-svc
47+
spec:
48+
duration: 500h0m0s
49+
---
2250
apiVersion: core.openstack.org/v1beta1
2351
kind: OpenStackControlPlane
2452
metadata:
@@ -196,25 +224,17 @@ spec:
196224
tls:
197225
ingress:
198226
enabled: true
199-
ca:
200-
duration: 1000h0m0s
201227
cert:
202228
duration: 500h0m0s
203229
podLevel:
204230
enabled: true
205231
internal:
206-
ca:
207-
duration: 1000h0m0s
208232
cert:
209233
duration: 500h0m0s
210234
libvirt:
211-
ca:
212-
duration: 1000h0m0s
213235
cert:
214236
duration: 500h0m0s
215237
ovn:
216-
ca:
217-
duration: 1000h0m0s
218238
cert:
219239
duration: 500h0m0s
220240
status:

test/kuttl/tests/ctlplane-tls-cert-rotation/04-assert-service-cert-rotation.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,21 @@ apiVersion: kuttl.dev/v1beta1
22
kind: TestAssert
33
timeout: 900
44
commands:
5+
- script: |
6+
echo "Waiting for OpenStack control plane to be ready after cert re-issuance..."
7+
oc wait openstackcontrolplane -n $NAMESPACE --for=condition=Ready --timeout=600s -l core.openstack.org/openstackcontrolplane
8+
59
- script: |
610
echo "Checking rotation of non API service certificates..."
11+
for i in $(seq 1 15); do
12+
if NAMESPACE=$NAMESPACE bash ../../common/osp_check_noapi_service_certs.sh 2>/dev/null; then
13+
echo "Non-API service certificates verified successfully."
14+
exit 0
15+
fi
16+
echo "Attempt $i/15: Non-API service certs not yet consistent, waiting 20s..."
17+
sleep 20
18+
done
19+
echo "Final non-API service cert check..."
720
NAMESPACE=$NAMESPACE bash ../../common/osp_check_noapi_service_certs.sh
821
922
- script: |

0 commit comments

Comments
 (0)