storagenode-updater: fix logic to use minimum version correctly
See: https://review.dev.storj.io/c/storj/storj/+/2052 https://review.dev.storj.io/c/storj/private/+/2053 Change-Id: I30952c6e3893194ca876c12ecb7e53944e66aa2e
This commit is contained in:
parent
4dd47a4601
commit
d9b1c4520e
@ -221,6 +221,10 @@ func testVersionControlWithUpdates(ctx *testcontext.Context, t *testing.T, updat
|
||||
},
|
||||
Binary: versioncontrol.ProcessesConfig{
|
||||
Storagenode: versioncontrol.ProcessConfig{
|
||||
Minimum: versioncontrol.VersionConfig{
|
||||
Version: oldVersion,
|
||||
URL: ts.URL + "/storagenode-old",
|
||||
},
|
||||
Suggested: versioncontrol.VersionConfig{
|
||||
Version: newVersion,
|
||||
URL: ts.URL + "/storagenode",
|
||||
@ -231,6 +235,10 @@ func testVersionControlWithUpdates(ctx *testcontext.Context, t *testing.T, updat
|
||||
},
|
||||
},
|
||||
StoragenodeUpdater: versioncontrol.ProcessConfig{
|
||||
Minimum: versioncontrol.VersionConfig{
|
||||
Version: oldVersion,
|
||||
URL: ts.URL + "/storagenode-old",
|
||||
},
|
||||
Suggested: versioncontrol.VersionConfig{
|
||||
Version: newVersion,
|
||||
URL: ts.URL + "/storagenode-updater",
|
||||
|
@ -50,12 +50,12 @@ func updateSelf(ctx context.Context, binaryLocation string, ver version.Process)
|
||||
currentVersion := version.Build.Version
|
||||
|
||||
// should update
|
||||
if currentVersion.Compare(suggestedVersion) >= 0 {
|
||||
zap.L().Info("Version is up to date.", zap.String("Service", updaterServiceName))
|
||||
return nil
|
||||
shouldUpdate, reason, err := version.ShouldUpdateVersion(currentVersion, nodeID, ver)
|
||||
if err != nil {
|
||||
return errs.Wrap(err)
|
||||
}
|
||||
if !version.ShouldUpdate(ver.Rollout, nodeID) {
|
||||
zap.L().Info("New version available but not rolled out to this nodeID yet", zap.String("Service", updaterServiceName))
|
||||
if !shouldUpdate {
|
||||
zap.L().Info(reason, zap.String("Service", updaterServiceName))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -30,12 +30,12 @@ func update(ctx context.Context, serviceName, binaryLocation string, ver version
|
||||
}
|
||||
|
||||
// should update
|
||||
if currentVersion.Compare(suggestedVersion) >= 0 {
|
||||
zap.L().Info("Version is up to date.", zap.String("Service", serviceName))
|
||||
return nil
|
||||
shouldUpdate, reason, err := version.ShouldUpdateVersion(currentVersion, nodeID, ver)
|
||||
if err != nil {
|
||||
return errs.Wrap(err)
|
||||
}
|
||||
if !version.ShouldUpdate(ver.Rollout, nodeID) {
|
||||
zap.L().Info("New version available but not rolled out to this nodeID yet", zap.String("Service", serviceName))
|
||||
if !shouldUpdate {
|
||||
zap.L().Info(reason, zap.String("Service", serviceName))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -42,6 +42,6 @@ require (
|
||||
storj.io/common v0.0.0-20200601223809-7af8b7ee5d6c
|
||||
storj.io/drpc v0.0.12
|
||||
storj.io/monkit-jaeger v0.0.0-20200518165323-80778fc3f91b
|
||||
storj.io/private v0.0.0-20200527091855-082647005cf3
|
||||
storj.io/private v0.0.0-20200605221229-3236fe879ab3
|
||||
storj.io/uplink v1.0.7
|
||||
)
|
||||
|
4
go.sum
4
go.sum
@ -647,7 +647,7 @@ storj.io/drpc v0.0.12 h1:4ei1M4cnWlYxcQheX0Dg4+c12zCD+oJqfweVQVWarsA=
|
||||
storj.io/drpc v0.0.12/go.mod h1:82nfl+6YwRwF6UG31cEWWUqv/FaKvP5SGqUvoqTxCMA=
|
||||
storj.io/monkit-jaeger v0.0.0-20200518165323-80778fc3f91b h1:Bbg9JCtY6l3HrDxs3BXzT2UYnYCBLqNi6i84Y8QIPUs=
|
||||
storj.io/monkit-jaeger v0.0.0-20200518165323-80778fc3f91b/go.mod h1:gj4vuCeyCRjRmH8LIrgoyU9Dc9uR6H+/GcDUXmTbf80=
|
||||
storj.io/private v0.0.0-20200527091855-082647005cf3 h1:niVMosczB5dcenexg5gIvbn5hfFeFweGIB5vykRHHPQ=
|
||||
storj.io/private v0.0.0-20200527091855-082647005cf3/go.mod h1:iDgIudPntDcHt5vyOecd2KS7YEx3E5CD0/sxjtM7fG0=
|
||||
storj.io/private v0.0.0-20200605221229-3236fe879ab3 h1:kUn1+iJmBwBTJopuNlN3daKAXLNe1u3F/cGDq0o3sak=
|
||||
storj.io/private v0.0.0-20200605221229-3236fe879ab3/go.mod h1:iDgIudPntDcHt5vyOecd2KS7YEx3E5CD0/sxjtM7fG0=
|
||||
storj.io/uplink v1.0.7 h1:vI0csamiYsN2vTj17x4QUUQ8xyyFVQvNzxJjUsSEi7U=
|
||||
storj.io/uplink v1.0.7/go.mod h1:PiLAqaFPUgsOs4u0xfVtm1jkWSQwdQmXv7KQUJUL/MU=
|
||||
|
Loading…
Reference in New Issue
Block a user