Skip to content

Commit 3b2e58b

Browse files
authored
Overwrite instead of delete the token-file after joining a cluster (#257)
* Do not remove the token file after join The actual commit * Modify message
1 parent 08752e4 commit 3b2e58b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

phase/install_controllers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ func (p *InstallControllers) Run() error {
7878
}
7979

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

phase/install_workers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ func (p *InstallWorkers) Run() error {
9999

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

0 commit comments

Comments
 (0)