Skip to content

Commit 402c61f

Browse files
committed
fix default cert member index
1 parent 9f8ee1a commit 402c61f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/ingress/model_builder.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,11 @@ func (t *defaultModelBuildTask) mergeListenPortConfigs(_ context.Context, listen
316316

317317
// Set the default cert as the first cert
318318
// This process allows the same certificate to be specified for both the default certificate and the SNI certificate.
319-
for _, cfg := range listenPortConfigs {
319+
var defaultCertMemberIndex int
320+
for i, cfg := range listenPortConfigs {
320321
if len(cfg.listenPortConfig.tlsCerts) > 0 {
321322
mergedTLSCerts = append(mergedTLSCerts, cfg.listenPortConfig.tlsCerts[0])
323+
defaultCertMemberIndex = i
322324
break
323325
}
324326
}
@@ -372,9 +374,8 @@ func (t *defaultModelBuildTask) mergeListenPortConfigs(_ context.Context, listen
372374
}
373375

374376
for j, cert := range cfg.listenPortConfig.tlsCerts {
375-
// Ignore the first cert as it is the default cert
376-
// Default cert is already added to the mergedTLSCerts
377-
if i == 0 && j == 0 {
377+
// The first certificate is ignored as it is the default certificate, which has already been added to the mergedTLSCerts.
378+
if i == defaultCertMemberIndex && j == 0 {
378379
continue
379380
}
380381
if mergedTLSCertsSet.Has(cert) {

0 commit comments

Comments
 (0)