Skip to content

Commit

Permalink
Overwrite instead of delete the token-file after joining a cluster (#257
Browse files Browse the repository at this point in the history
)

* Do not remove the token file after join

The actual commit

* Modify message
  • Loading branch information
kke committed Oct 27, 2021
1 parent 08752e4 commit 3b2e58b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions phase/install_controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func (p *InstallControllers) Run() error {
}

defer func() {
if err := h.Configurer.DeleteFile(h, h.K0sJoinTokenPath()); err != nil {
log.Warnf("%s: failed to clean up the join token file at %s", h, h.K0sJoinTokenPath())
if err := h.Configurer.WriteFile(h, h.K0sJoinTokenPath(), "# overwritten by k0sctl after join\n", "0600"); err != nil {
log.Warnf("%s: failed to overwrite the join token file at %s", h, h.K0sJoinTokenPath())
}
}()

Expand Down
4 changes: 2 additions & 2 deletions phase/install_workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ func (p *InstallWorkers) Run() error {

if !NoWait {
defer func() {
if err := h.Configurer.DeleteFile(h, h.K0sJoinTokenPath()); err != nil {
log.Warnf("%s: failed to clean up the join token file at %s", h, h.K0sJoinTokenPath())
if err := h.Configurer.WriteFile(h, h.K0sJoinTokenPath(), "# overwritten by k0sctl after join\n", "0600"); err != nil {
log.Warnf("%s: failed to overwrite the join token file at %s", h, h.K0sJoinTokenPath())
}
}()
}
Expand Down

0 comments on commit 3b2e58b

Please sign in to comment.