Skip to content

Commit 3331b27

Browse files
committed
cert renew
Signed-off-by: xhe <[email protected]>
1 parent 9f1c988 commit 3331b27

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pkg/cluster/manager/builder.go

+18
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,16 @@ func genTiProxySessionCerts(dir string) error {
867867
}), "")
868868
}
869869

870+
func delTiProxySessionCerts(dir string) error {
871+
if err := os.Remove(filepath.Join(dir, "tiproxy-session.crt")); err == nil {
872+
return err
873+
}
874+
if err := os.Remove(filepath.Join(dir, "tiproxy-session.key")); err == nil {
875+
return err
876+
}
877+
return nil
878+
}
879+
870880
// buildCertificateTasks generates certificate for instance and transfers it to the server
871881
func buildCertificateTasks(
872882
m *Manager,
@@ -936,5 +946,13 @@ func buildCertificateTasks(
936946
certificateTasks = append(certificateTasks, t)
937947
}
938948
})
949+
950+
if hasTiProxy {
951+
// delete it, so tiup will generate a new cert next time to renew
952+
if err := delTiProxySessionCerts(m.specManager.Path(name, spec.TempConfigPath)); err != nil {
953+
return certificateTasks, err
954+
}
955+
}
956+
939957
return certificateTasks, iterErr
940958
}

0 commit comments

Comments
 (0)