Skip to content

Commit d8de28a

Browse files
Kamil PrzybylKamil Przybyl
authored andcommitted
chore: clarify isCertValid
1 parent 4a8352c commit d8de28a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/alb/ingress/alb_spec.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,10 @@ func (r *IngressClassReconciler) cleanupCerts(ctx context.Context, ingressClass
351351
return nil
352352
}
353353

354-
// isCertValid checks if the certificate chain is complete. It is used for checking if
355-
// the cert-manager's ACME challenge is completed, or if it's sill ongoing.
354+
// isCertValid checks if the certificate chain is complete (contains both a leaf and intermediate CAs).
355+
// This is necessary because the Certificates API only validates the match between
356+
// the public and private key but it does not reject incomplete chains. Since the API lacks an update call,
357+
// we must wait for the full chain to avoid locking the ALB into an incomplete certificate.
356358
func isCertValid(secret *corev1.Secret) (bool, error) {
357359
tlsCert := secret.Data["tls.crt"]
358360
if tlsCert == nil {
@@ -380,7 +382,8 @@ func isCertValid(secret *corev1.Secret) (bool, error) {
380382
certs = append(certs, cert)
381383
}
382384

383-
// If there are multiple certificates, it means the chain is likely complete
385+
// A valid, trusted chain must contain at least 2 certificates:
386+
// the leaf (domain) and at least one intermediate CA.
384387
return len(certs) > 1, nil
385388
}
386389

0 commit comments

Comments
 (0)