Skip to content

Commit bfc103a

Browse files
committed
fix: enhance logging for TLS certificate management and security
- Update log messages to use `Infof` instead of `Debugf` for better visibility. - Add success confirmation logs after renewing TLS certificates. - Modify the warning message to include advice on handling security notices during cluster installation. Signed-off-by: ysicing <[email protected]>
1 parent de51f88 commit bfc103a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

internal/pkg/util/httptls/httptls.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func CheckReNewCertificate(force bool) (err error) {
3939
}
4040
}
4141
if needRenew {
42+
log.Infof("domain %s's certificate need renew now, start to renew", domain)
4243
return renewCertificate(domain)
4344
}
4445
log.Infof("domain %s's certificate has not expired ", domain)
@@ -50,7 +51,7 @@ func CheckReNewCertificate(force bool) (err error) {
5051

5152
func checkCertificate(domain string) (bool, error) {
5253
log := log.GetInstance()
53-
log.Debugf("start check domain %s certificate", domain)
54+
log.Infof("start check domain %s certificate", domain)
5455
tr := &http.Transport{
5556
TLSClientConfig: &tls.Config{InsecureSkipVerify: false}, // nolint:gosec
5657
}
@@ -88,13 +89,16 @@ func renewCertificate(domain string) error {
8889
mainDomain := fmt.Sprintf("%s.%s", ds[len(ds)-2], ds[len(ds)-1])
8990
coreDomain := fmt.Sprintf("%s.%s.%s", ds[len(ds)-3], ds[len(ds)-2], ds[len(ds)-1])
9091
tlsfile := fmt.Sprintf("https://pkg.qucheng.com/ssl/%s/%s/tls.yaml", mainDomain, coreDomain)
92+
log.Infof("renew %s tls certificate", domain)
9193
log.Debugf("renew default tls certificate use %s", tlsfile)
9294
if err := qcexec.Command(os.Args[0], "experimental", "kubectl", "apply", "-f", tlsfile, "-n", common.GetDefaultSystemNamespace(true), "--kubeconfig", common.GetKubeConfig()).Run(); err != nil {
9395
log.Warnf("load renew tls cert for %s failed, reason: %v", common.GetDefaultSystemNamespace(true), err)
96+
return nil
9497
}
95-
log.Debugf("renew ingress tls certificate")
9698
if err := qcexec.Command(os.Args[0], "experimental", "kubectl", "apply", "-f", tlsfile, "--kubeconfig", common.GetKubeConfig()).Run(); err != nil {
9799
log.Warnf("load renew tls cert for default failed, reason: %v", err)
100+
return nil
98101
}
102+
log.Donef("renew tls certificate success")
99103
return nil
100104
}

pkg/quickon/quickon.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ func (m *Meta) Init() error {
277277
// TODO timeout
278278
m.Log.Warnf("wait tls cert ready, timeout: %v", trywaitsc.Sub(waittls).Seconds())
279279
cmd := fmt.Sprintf("%s pt tls", os.Args[0])
280-
m.Log.Warnf("wait cluster install success, please use cmd check: %s", color.SGreen(cmd))
280+
m.Log.Warnf("wait cluster install success, visit %s notice 'Your connection to this site isn't secure', please use follow cmd check and fix: %s", color.SGreen(m.Domain), color.SGreen(cmd))
281281
break
282282
}
283283
}

0 commit comments

Comments
 (0)