Skip to content

Commit 934d2e0

Browse files
committed
Merge ctlplane-tls-cert-rotation tests into ctlplane-tls-custom-issuers
Consolidate these two TLS-related kuttl tests into a single comprehensive test suite that covers: - TLS ingress-only to full pod-level TLS transitions - Custom and default certificate issuer switching - Certificate rotation triggered by secret deletion - Custom certificate duration configuration - Certificate fingerprint verification before/after rotation Key changes: - Remove ctlplane-tls-cert-rotation test suite (merged into custom-issuers) - Renumber test steps (00-16) for proper sequencing - Add certificate fingerprint comparison to rotation assertions - Replace symlink with actual assert file for custom issuer deployment - Increase timeout for certificate issuer assertions (60s → 900s) - Improve error messages with namespace context This reduces test execution time by eliminating redundant OpenStack deployments while maintaining full TLS functionality coverage. Co-authored-by: Claude Assistant assistant@cursor.sh
1 parent b7b08af commit 934d2e0

37 files changed

+404
-76
lines changed

test/kuttl/common/osp_check_noapi_service_certs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ for service in "${!services_secrets[@]}"; do
5656
pod_cert=$(oc rsh -n "$NAMESPACE" openstackclient openssl s_client -connect "$cluster_ip:$port" -servername "$cluster_ip" </dev/null 2>/dev/null | sed -ne '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p')
5757

5858
if [[ -z "$pod_cert" ]]; then
59-
echo "Error retrieving certificate from $service at $cluster_ip:$port."
59+
echo "Error retrieving certificate from $service at $cluster_ip:$port in namespace $NAMESPACE."
6060
continue
6161
fi
6262

test/kuttl/tests/ctlplane-tls-cert-rotation/02-assert-endpoint-proto.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/kuttl/tests/ctlplane-tls-cert-rotation/02-get-endpoints-certs.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/kuttl/tests/ctlplane-tls-cert-rotation/03-change-cert-duration.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/kuttl/tests/ctlplane-tls-cert-rotation/00-assert-deploy-openstack.yaml renamed to test/kuttl/tests/ctlplane-tls-custom-issuers/00-assert-deploy-openstack-tls-ingress-only.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,11 @@ commands:
300300
echo "Waiting for OpenStack control plane to be ready..."
301301
oc wait openstackcontrolplane -n $NAMESPACE --for=condition=Ready --timeout=400s -l core.openstack.org/openstackcontrolplane
302302
- script: |
303-
echo "Fail if internal https endpoints are registered"
303+
echo "Fail if internal https endpoints are registered (ingress-only mode)"
304304
oc exec -i openstackclient -n $NAMESPACE -- bash -c "openstack endpoint list --interface internal -f value -c URL" | grep 'https:' && exit 1
305305
exit 0
306306
- script: |
307-
echo "check ovn sb internalDbAddress use tcp"
307+
echo "check ovn sb internalDbAddress use tcp (not ssl)"
308308
oc get -n $NAMESPACE OVNDBCluster ovndbcluster-sb -o jsonpath={.status.internalDbAddress} | grep -q tcp
309309
- script: |
310310
echo "check ovn sb DB connection use tcp"
@@ -315,3 +315,4 @@ commands:
315315
- script: |
316316
echo "check neutron ovn_sb_connection url tcp address"
317317
oc exec -i deployment/neutron -n $NAMESPACE -- bash -c "grep ovn_sb_connection /etc/neutron/neutron.conf.d/01-neutron.conf | grep -q tcp"
318+

test/kuttl/tests/ctlplane-tls-cert-rotation/00-deploy-openstack-tls-ingress-only.yaml renamed to test/kuttl/tests/ctlplane-tls-custom-issuers/00-deploy-openstack-tls-ingress-only.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
# Deploy with TLS ingress-only (podLevel.enabled: false)
2+
# This tests the transition from ingress-only TLS to full TLS
13
apiVersion: kuttl.dev/v1beta1
24
kind: TestStep
35
commands:
46
- script: |
57
oc kustomize ../../../../config/samples/tls/tls_ingress | oc apply -n $NAMESPACE -f -
8+

test/kuttl/tests/ctlplane-tls-custom-issuers/09-assert-deploy-openstack.yaml renamed to test/kuttl/tests/ctlplane-tls-custom-issuers/01-assert-deploy-openstack-full-tls.yaml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,28 @@ spec:
174174
replicas: 1
175175
tls:
176176
ingress:
177-
enabled: true
178177
ca:
179-
customIssuer: rootca-ingress-custom
178+
duration: 87600h0m0s
179+
cert:
180+
duration: 43800h0m0s
181+
enabled: true
180182
podLevel:
181183
enabled: true
182184
internal:
183185
ca:
184-
customIssuer: rootca-internal-custom
186+
duration: 87600h0m0s
187+
cert:
188+
duration: 43800h0m0s
189+
libvirt:
190+
ca:
191+
duration: 87600h0m0s
192+
cert:
193+
duration: 43800h0m0s
194+
ovn:
195+
ca:
196+
duration: 87600h0m0s
197+
cert:
198+
duration: 43800h0m0s
185199
status:
186200
conditions:
187201
- message: Setup complete
@@ -292,3 +306,28 @@ status:
292306
reason: Ready
293307
status: "True"
294308
type: OpenStackControlPlaneTestCMReadyCondition
309+
---
310+
apiVersion: kuttl.dev/v1beta1
311+
kind: TestAssert
312+
timeout: 500
313+
commands:
314+
- script: |
315+
echo "Waiting for OpenStack control plane to be ready..."
316+
oc wait openstackcontrolplane -n $NAMESPACE --for=condition=Ready --timeout=400s -l core.openstack.org/openstackcontrolplane
317+
- script: |
318+
echo "Fail if internal http endpoints are registered (full TLS mode)"
319+
oc exec -i openstackclient -n $NAMESPACE -- bash -c "openstack endpoint list --interface internal -f value -c URL" | grep 'http:' && exit 1
320+
exit 0
321+
- script: |
322+
echo "check ovn sb internalDbAddress use ssl"
323+
oc get -n $NAMESPACE OVNDBCluster ovndbcluster-sb -o jsonpath={.status.internalDbAddress} | grep -q ssl
324+
- script: |
325+
echo "check ovn sb DB connection use ssl"
326+
oc exec -i statefulset/ovsdbserver-sb -n $NAMESPACE -- bash -c "ovn-sbctl --no-leader-only get-connection | grep -q pssl"
327+
- script: |
328+
echo "check nova transport_url use ssl"
329+
oc exec -i statefulset/nova-cell1-conductor -n $NAMESPACE -- bash -c "grep transport_url /etc/nova/nova.conf.d/01-nova.conf | grep -q 'ssl=1'"
330+
- script: |
331+
echo "check neutron ovn_sb_connection url ssl"
332+
oc exec -i deployment/neutron -n $NAMESPACE -- bash -c "grep ovn_sb_connection /etc/neutron/neutron.conf.d/01-neutron.conf| grep -q ssl"
333+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Deploy with full TLS (podLevel.enabled: true)
2+
# This tests the transition from ingress-only TLS to full pod-level TLS
3+
apiVersion: kuttl.dev/v1beta1
4+
kind: TestStep
5+
commands:
6+
- script: |
7+
oc kustomize ../../../../config/samples/base/openstackcontrolplane | oc apply -n $NAMESPACE -f -
8+

test/kuttl/tests/ctlplane-tls-custom-issuers/00-assert-custom-issuers.yaml renamed to test/kuttl/tests/ctlplane-tls-custom-issuers/02-assert-custom-issuers.yaml

File renamed without changes.

test/kuttl/tests/ctlplane-tls-custom-issuers/00-deploy-custom-issuers.yaml renamed to test/kuttl/tests/ctlplane-tls-custom-issuers/02-deploy-custom-issuers.yaml

File renamed without changes.

0 commit comments

Comments
 (0)