Skip to content

Commit

Permalink
fix(4.3): revert cert feature (#4053)
Browse files Browse the repository at this point in the history
Signed-off-by: cuisongliu <[email protected]>
  • Loading branch information
cuisongliu authored Oct 9, 2023
1 parent 715a648 commit 881c10c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
4 changes: 4 additions & 0 deletions pkg/runtime/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ func (k *KubeadmRuntime) GenerateCert() error {
return k.sendNewCertAndKey([]string{k.getMaster0IPAndPort()})
}

func (k *KubeadmRuntime) SendNewCertAndKeyToMasters() error {
return k.sendNewCertAndKey(k.getMasterIPAndPortList())
}

func (k *KubeadmRuntime) CreateKubeConfig() error {
logger.Info("start to create kubeconfig...")
hostName, err := k.execHostname(k.getMaster0IPAndPort())
Expand Down
19 changes: 1 addition & 18 deletions pkg/runtime/update_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (k *KubeadmRuntime) UpdateCertByInit() error {
func (k *KubeadmRuntime) initCert() error {
pipeline := []func() error{
k.GenerateCert,
k.syncCert,
k.SendNewCertAndKeyToMasters,
}
for _, f := range pipeline {
if err := f(); err != nil {
Expand All @@ -140,23 +140,6 @@ func (k *KubeadmRuntime) initCert() error {
return nil
}

func (k *KubeadmRuntime) syncCert() error {
for _, master := range k.getMasterIPAndPortList()[1:] {
logger.Debug("start to generate cert for master %s", master)
err := k.execCert(master)
if err != nil {
return fmt.Errorf("failed to create cert for master %s: %v", master, err)
}

err = k.copyMasterKubeConfig(master)
if err != nil {
return err
}
logger.Info("succeeded generate cert %s as master", master)
}
return nil
}

func (k *KubeadmRuntime) showKubeadmCert() error {
certCheck := "kubeadm certs check-expiration"
return k.sshCmdAsync(k.getMaster0IPAndPort(), fmt.Sprintf("%s%s", certCheck, vlogToStr(k.vlog)))
Expand Down

0 comments on commit 881c10c

Please sign in to comment.