Skip to content

Commit

Permalink
fix: uninstall certs file
Browse files Browse the repository at this point in the history
  • Loading branch information
aby913 committed Sep 10, 2024
1 parent 4821276 commit a3ad4c4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/certs/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,22 @@ func (u *UninstallAutoRenewCertsModule) Init() {
uninstall,
}
}

type UninstallCertsFilesModule struct {
common.KubeModule
}

func (m *UninstallCertsFilesModule) Init() {
m.Name = "UninstallCertsFilesModule"

uninstall := &task.RemoteTask{
Name: "UninstallCertsFiles",
Hosts: m.Runtime.GetHostsByRole(common.Master),
Action: new(UninstallCertsFiles),
Parallel: true,
}

m.Tasks = []task.Interface{
uninstall,
}
}
15 changes: 15 additions & 0 deletions pkg/certs/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ import (
"encoding/base64"
"fmt"
"os"
"path"
"path/filepath"
"strings"
"text/tabwriter"
"time"

"bytetrade.io/web3os/installer/pkg/certs/templates"
"bytetrade.io/web3os/installer/pkg/common"
cc "bytetrade.io/web3os/installer/pkg/core/common"
"bytetrade.io/web3os/installer/pkg/core/connector"
"bytetrade.io/web3os/installer/pkg/core/util"
"bytetrade.io/web3os/installer/pkg/utils"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -414,3 +417,15 @@ func (u *UninstallAutoRenewCerts) Execute(runtime connector.Runtime) error {

return nil
}

type UninstallCertsFiles struct {
common.KubeAction
}

func (t *UninstallCertsFiles) Execute(runtime connector.Runtime) error {
var p = path.Join(runtime.GetBaseDir(), cc.Cli)
if util.IsExist(p) {
return util.RemoveDir(p)
}
return nil
}
1 change: 1 addition & 0 deletions pkg/phase/cluster/delete_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func (p *phaseBuilder) phaseInstall() *phaseBuilder {
&os.ClearOSEnvironmentModule{},
&certs.UninstallAutoRenewCertsModule{},
&container.KillContainerdProcessModule{},
&certs.UninstallCertsFilesModule{},
&storage.DeleteUserDataModule{},
&storage.DeletePhaseFlagModule{
PhaseFile: ".installed",
Expand Down

0 comments on commit a3ad4c4

Please sign in to comment.