Skip to content

Commit

Permalink
fix: do not require ToVersion to be set when detecting version
Browse files Browse the repository at this point in the history
We do not know the upgrade version when checking components versions in
Theila.

Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
  • Loading branch information
Unix4ever authored and talos-bot committed Jul 21, 2021
1 parent 0953b19 commit 70d2505
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/cluster/kubernetes/detect.go
Expand Up @@ -33,9 +33,12 @@ func DetectLowestVersion(ctx context.Context, cluster UpgradeProvider, options U
return "", err
}

version, err := semver.NewVersion(options.ToVersion)
if err != nil {
return "", err
var version *semver.Version
if options.ToVersion != "" {
version, err = semver.NewVersion(options.ToVersion)
if err != nil {
return "", err
}
}

for _, pod := range pods.Items {
Expand All @@ -61,7 +64,7 @@ func DetectLowestVersion(ctx context.Context, cluster UpgradeProvider, options U
continue
}

if v.LessThan(*version) {
if version == nil || v.LessThan(*version) {
version = v
}
}
Expand Down

0 comments on commit 70d2505

Please sign in to comment.