Skip to content

Commit

Permalink
Add hidden flag to skip downgrade check during apply for dev use (#152)
Browse files Browse the repository at this point in the history
* Allow user to override semver check

Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>

* Update phase/validate_facts.go

Co-authored-by: Kimmo Lehto <kimmo.lehto@gmail.com>

* Update phase/validate_facts.go

Co-authored-by: Kimmo Lehto <kimmo.lehto@gmail.com>

* Update cmd/apply.go

Co-authored-by: Kimmo Lehto <kimmo.lehto@gmail.com>

* Update cmd/apply.go

Co-authored-by: Kimmo Lehto <kimmo.lehto@gmail.com>

Co-authored-by: Kimmo Lehto <kimmo.lehto@gmail.com>
  • Loading branch information
jasmingacic and kke committed Jun 16, 2021
1 parent cb35161 commit f51a48d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ var applyCommand = &cli.Command{
Usage: "Path to cluster backup archive to restore the state from",
TakesFile: true,
},
&cli.BoolFlag{
Name: "disable-downgrade-check",
Usage: "Skip downgrade check",
Hidden: true,
},
debugFlag,
traceFlag,
analyticsFlag,
Expand Down Expand Up @@ -70,7 +75,7 @@ var applyCommand = &cli.Command{
&phase.UploadFiles{},
&phase.ValidateHosts{},
&phase.GatherK0sFacts{},
&phase.ValidateFacts{},
&phase.ValidateFacts{SkipDowngradeCheck: ctx.Bool("disable-downgrade-check")},
&phase.ConfigureK0s{},
&phase.Restore{
RestoreFrom: ctx.String("restore-from"),
Expand Down
4 changes: 4 additions & 0 deletions phase/validate_facts.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
// ValidateFacts performs remote OS detection
type ValidateFacts struct {
GenericPhase
SkipDowngradeCheck bool
}

// Title for the phase
Expand All @@ -31,6 +32,9 @@ func (p *ValidateFacts) Run() error {
}

func (p *ValidateFacts) validateDowngrade() error {
if p.SkipDowngradeCheck {
return nil
}
if p.Config.Spec.K0sLeader().Metadata.K0sRunningVersion == "" {
return nil
}
Expand Down

0 comments on commit f51a48d

Please sign in to comment.