Skip to content

Commit f0ec0a9

Browse files
authored
wait for client cert to become ready before getting etcd client (#269)
The test of etcd cluster with TLS and auth config fails frequently, because the client certificate does not get created, before the etcd cluster is up and running. This PR adds a step to wait for the client cert to become ready, before executing the rest of the tests. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Reduced RSA private key sizes for various certificates to enhance security. - Added a new end-to-end test case to ensure readiness of TLS client certificates before proceeding with cluster operations. - **Bug Fixes** - Improved test reliability by ensuring TLS certificates are ready before stateful set readiness checks. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent e00e6cb commit f0ec0a9

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

examples/manifests/etcdcluster-with-external-certificates.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spec:
4444
secretName: ca-peer-secret
4545
privateKey:
4646
algorithm: RSA
47-
size: 4096
47+
size: 2048
4848
issuerRef:
4949
name: selfsigned-issuer
5050
kind: Issuer
@@ -70,7 +70,7 @@ spec:
7070
secretName: ca-server-secret
7171
privateKey:
7272
algorithm: RSA
73-
size: 4096
73+
size: 2048
7474
issuerRef:
7575
name: selfsigned-issuer
7676
kind: Issuer
@@ -96,7 +96,7 @@ spec:
9696
secretName: ca-client-secret
9797
privateKey:
9898
algorithm: RSA
99-
size: 4096
99+
size: 2048
100100
issuerRef:
101101
name: selfsigned-issuer
102102
kind: Issuer
@@ -162,7 +162,7 @@ spec:
162162
privateKey:
163163
rotationPolicy: Always
164164
algorithm: RSA
165-
size: 4096
165+
size: 2048
166166
issuerRef:
167167
name: ca-issuer-server
168168
---
@@ -197,7 +197,7 @@ spec:
197197
privateKey:
198198
rotationPolicy: Always
199199
algorithm: RSA
200-
size: 4096
200+
size: 2048
201201
issuerRef:
202202
name: ca-issuer-peer
203203
---
@@ -216,7 +216,7 @@ spec:
216216
privateKey:
217217
rotationPolicy: Always
218218
algorithm: RSA
219-
size: 4096
219+
size: 2048
220220
issuerRef:
221221
name: ca-issuer-client
222222
kind: Issuer

test/e2e/e2e_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,17 @@ allowVolumeExpansion: true
222222
ExpectWithOffset(1, err).NotTo(HaveOccurred())
223223
})
224224

225+
Eventually(func() error {
226+
cmd := exec.Command("kubectl", "wait",
227+
"certificate/client-certificate",
228+
"--for", "condition=Ready",
229+
"--namespace", namespace,
230+
"--timeout", "5m",
231+
)
232+
_, err = utils.Run(cmd)
233+
return err
234+
}, time.Second*20, time.Second*2).Should(Succeed(), "wait for client cert ready")
235+
225236
Eventually(func() error {
226237
cmd := exec.Command("kubectl", "wait",
227238
"statefulset/test",

0 commit comments

Comments
 (0)