From 2b284c42ae891e00cdfd4b187bc23ee9a5bd1d67 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Tue, 12 May 2026 18:04:53 +0800 Subject: [PATCH] fix: #1283 --- .../deployer/providers/aliyun-alb/aliyun_alb.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/core/deployer/providers/aliyun-alb/aliyun_alb.go b/pkg/core/deployer/providers/aliyun-alb/aliyun_alb.go index 275a90b99..a7f7d9ca0 100644 --- a/pkg/core/deployer/providers/aliyun-alb/aliyun_alb.go +++ b/pkg/core/deployer/providers/aliyun-alb/aliyun_alb.go @@ -344,20 +344,21 @@ func (d *Deployer) updateListenerCertificate(ctx context.Context, cloudListenerI continue } - if tea.StringValue(listenerCertificate.CertificateId) == cloudCertId { + certIdWithRegion := tea.StringValue(listenerCertificate.CertificateId) + if certIdWithRegion == cloudCertId { certificateIsAlreadyAssociated = true break } - certificateId := strings.SplitN(tea.StringValue(listenerCertificate.CertificateId), "-", 2)[0] - certificateIdAsInt64, err := strconv.ParseInt(certificateId, 10, 64) + certIdBare := strings.SplitN(certIdWithRegion, "-", 2)[0] + certIdBareAsInt64, err := strconv.ParseInt(certIdBare, 10, 64) if err != nil { errs = append(errs, err) continue } getCertificateDetailReq := &alicas.GetCertificateDetailRequest{ - CertificateId: tea.Int64(certificateIdAsInt64), + CertificateId: tea.Int64(certIdBareAsInt64), } getCertificateDetailResp, err := d.sdkClients.CAS.GetCertificateDetailWithContext(ctx, getCertificateDetailReq, &dara.RuntimeOptions{}) d.logger.Debug("sdk request 'cas.GetCertificateDetail'", slog.Any("request", getCertificateDetailReq), slog.Any("response", getCertificateDetailResp)) @@ -374,13 +375,13 @@ func (d *Deployer) updateListenerCertificate(ctx context.Context, cloudListenerI certCNMatched := tea.StringValue(getCertificateDetailResp.Body.CommonName) == d.config.Domain certSANDiff, _ := lo.Difference(tea.StringSliceValue(getCertificateDetailResp.Body.SubjectAlternativeNames), cloudCertSANs) if certCNMatched || len(certSANDiff) == 0 { - certificateIdsToDissociate = append(certificateIdsToDissociate, certificateId) + certificateIdsToDissociate = append(certificateIdsToDissociate, certIdWithRegion) continue } certNotAfter := time.Unix(tea.Int64Value(getCertificateDetailResp.Body.NotAfter)/1000, 0) if certNotAfter.Before(time.Now()) { - certificateIdsToDissociate = append(certificateIdsToDissociate, certificateId) + certificateIdsToDissociate = append(certificateIdsToDissociate, certIdWithRegion) continue } }