-
Notifications
You must be signed in to change notification settings - Fork 5k
hyperkit driver should be happy with current minimum verison #9365
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
Merged
medyagh
merged 27 commits into
kubernetes:master
from
ilya-zuyev:gh_7422-reuse_hyperkit_driver
Oct 21, 2020
Merged
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
2423f81
Introduce minHyperkitVersion constant to keep the minimum compatible …
ilya-zuyev d124f29
Update comments
ilya-zuyev 8ba7478
Add copyrights
ilya-zuyev 334779c
Change required min hyperkit version to 1.11.0
ilya-zuyev 11b8534
Fix unit tests error messages
ilya-zuyev c82e327
Do not panic if min version constant is invalid
ilya-zuyev 6ca9402
Extract a function to download driver file, but don't change ownershi…
ilya-zuyev 2641e3d
Add hyperkit driver v1.11.0 to testdata
ilya-zuyev 7322fdd
Add an integration test for hyperkit driver upgrades
ilya-zuyev 08da827
Rename minDriverVersion => minAcceptableDriverVersion. Add comments
ilya-zuyev 9b70ec8
Update integration test:
ilya-zuyev 786037e
Fix error message in int test
ilya-zuyev 1381394
Fix comments
ilya-zuyev 0a9cbbb
Use "--interactive=false" to avoid asking for sudo password
ilya-zuyev bfca3a6
Reorganize code - move tests related to hyperkit to driver_install_or…
ilya-zuyev 489b59b
Integration tests: fix the default test driver perms
ilya-zuyev eef3fd8
Integration tests: add comments to internal functions
ilya-zuyev 4eb6f9a
Integration tests: fix naming
ilya-zuyev 3941018
Integration tests: update README in testsdata
ilya-zuyev 2b32f6f
Integration tests: add copyright header
ilya-zuyev 63ca225
Integration tests: fix driver permission
ilya-zuyev 4c5ac5a
Integration tests: remove driver_install_or_update_darwin_test.go
ilya-zuyev a072e89
Merge branch 'master' into gh_7422-reuse_hyperkit_driver
ilya-zuyev 8db8f55
replace glog -> klog
ilya-zuyev 57a0e40
Reuse $MINIKUBE_HOME/cache files;
ilya-zuyev 5fc73c7
Add a comment
ilya-zuyev 6c65c5d
Log driver version when validating driver
ilya-zuyev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package driver | ||
|
||
import ( | ||
"github.com/blang/semver" | ||
"github.com/golang/glog" | ||
) | ||
|
||
// minHyperkitVersion is the minimum version of the minikube hyperkit driver compatible with the current minikube code | ||
var minHyperkitVersion semver.Version | ||
|
||
const minHyperkitVersionStr = "1.10.0" | ||
medyagh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
func init() { | ||
v, err := semver.New(minHyperkitVersionStr) | ||
if err != nil { | ||
glog.Fatalf("Failed to parse the hyperkit driver version: %v", err) | ||
medyagh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
minHyperkitVersion = *v | ||
} | ||
|
||
func minDriverVersion(driver string, mkVer semver.Version) semver.Version { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add comment here, consider more descriptive name. maybe minAcceptableVersion There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
switch driver { | ||
case HyperKit: | ||
return minHyperkitVersion | ||
case KVM2: | ||
return mkVer | ||
default: | ||
glog.Warningf("Unexpected driver: %v", driver) | ||
return mkVer | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package driver | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/blang/semver" | ||
) | ||
|
||
func Test_minDriverVersion(t *testing.T) { | ||
|
||
tests := []struct { | ||
desc string | ||
driver string | ||
mkV string | ||
want semver.Version | ||
}{ | ||
{"Hyperkit", HyperKit, "1.1.1", minHyperkitVersion}, | ||
{"Invalid", "_invalid_", "1.1.1", v("1.1.1")}, | ||
{"KVM2", KVM2, "1.1.1", v("1.1.1")}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.desc, func(t *testing.T) { | ||
if got := minDriverVersion(tt.driver, v(tt.mkV)); !got.EQ(tt.want) { | ||
t.Errorf("minDriverVersion() = %v, want %v", got, tt.want) | ||
medyagh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
}) | ||
} | ||
} | ||
|
||
func v(s string) semver.Version { | ||
r, err := semver.New(s) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return *r | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we allow version mismatches, could you please add a log sttatement declaring what driver version we are using? This will help for future debugging;
klog.Infof("%s version is %s", path, driverVersion)
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Done.