Skip to content

Commit

Permalink
Respect upgrade.recovery when set through the config file
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitris Karakasilis <[email protected]>
  • Loading branch information
jimmykarily committed Aug 26, 2024
1 parent 0e8195b commit 332d516
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/config/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"reflect"
"strings"

"github.com/kairos-io/kairos-sdk/collector"
sdkTypes "github.com/kairos-io/kairos-sdk/types"

"github.com/google/go-containerregistry/pkg/crane"
Expand Down Expand Up @@ -323,7 +324,21 @@ func NewUpgradeSpec(cfg *Config) (*v1.UpgradeSpec, error) {
}
}

// Deep look to see if upgrade.recovery == true in the config
// if yes, we set the upgrade spec "Entry" to "recovery"
entry := ""
_, ok := cfg.Config["upgrade"]
if ok {
_, ok = cfg.Config["upgrade"].(collector.Config)["recovery"]
if ok {
if cfg.Config["upgrade"].(collector.Config)["recovery"].(bool) {
entry = constants.BootEntryRecovery
}
}
}

spec := &v1.UpgradeSpec{
Entry: entry,
Active: active,
Recovery: recovery,
Passive: passive,
Expand Down

0 comments on commit 332d516

Please sign in to comment.