Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest reset after k0s install has already run #581

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions action/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ func (a Apply) Run() error {

if result = a.Manager.Run(); result != nil {
analytics.Client.Publish("apply-failure", map[string]interface{}{"clusterID": a.Manager.Config.Spec.K0s.Metadata.ClusterID})
log.Info(phase.Colorize.Red("==> Apply failed").String())

var installedHosts []string
for _, h := range a.Manager.Config.Spec.Hosts {
if h.Metadata.K0sInstalled {
installedHosts = append(installedHosts, h.String())
}
}
if len(installedHosts) > 0 {
log.Warn("Cluster setup failed, but 'k0s install' has been run on the following hosts:")
for _, h := range installedHosts {
log.Warnf(" - %s", h)
}
log.Warn("You may need to reset them before retrying 'k0sctl apply'. See 'k0sctl reset --help' for more information.")
}

return result
}

Expand Down
2 changes: 2 additions & 0 deletions phase/initialize_k0s.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func (p *InitializeK0s) Run() error {
return err
}

h.Metadata.K0sInstalled = true

if len(h.Environment) > 0 {
log.Infof("%s: updating service environment", h)
if err := h.Configurer.UpdateServiceEnvironment(h, h.K0sServiceName(), h.Environment); err != nil {
Expand Down
1 change: 1 addition & 0 deletions phase/install_controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func (p *InstallControllers) Run() error {
if err = h.Exec(cmd); err != nil {
return err
}
h.Metadata.K0sInstalled = true

if len(h.Environment) > 0 {
log.Infof("%s: updating service environment", h)
Expand Down
2 changes: 2 additions & 0 deletions phase/install_workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ func (p *InstallWorkers) Run() error {
return err
}

h.Metadata.K0sInstalled = true

if len(h.Environment) > 0 {
log.Infof("%s: updating service environment", h)
if err := h.Configurer.UpdateServiceEnvironment(h, h.K0sServiceName(), h.Environment); err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ type HostMetadata struct {
K0sBinaryVersion *version.Version
K0sBinaryTempFile string
K0sRunningVersion *version.Version
K0sInstalled bool
Arch string
IsK0sLeader bool
Hostname string
Expand Down
Loading