mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
rkt: Update minimum rkt version to 1.7.0
Also remove the redundant `appcVersion` check, that version should already be captured in the rkt version
This commit is contained in:
parent
d0a31873d7
commit
f028a9f410
@ -65,11 +65,11 @@ const (
|
|||||||
RktType = "rkt"
|
RktType = "rkt"
|
||||||
DefaultRktAPIServiceEndpoint = "localhost:15441"
|
DefaultRktAPIServiceEndpoint = "localhost:15441"
|
||||||
|
|
||||||
minimumAppcVersion = "0.8.1"
|
minimumRktBinVersion = "1.7.0"
|
||||||
minimumRktBinVersion = "1.6.0"
|
recommendedRktBinVersion = "1.7.0"
|
||||||
recommendedRktBinVersion = "1.6.0"
|
|
||||||
minimumRktApiVersion = "1.0.0-alpha"
|
minimumRktApiVersion = "1.0.0-alpha"
|
||||||
minimumSystemdVersion = "219"
|
minimumSystemdVersion = "219"
|
||||||
|
|
||||||
systemdServiceDir = "/run/systemd/system"
|
systemdServiceDir = "/run/systemd/system"
|
||||||
rktDataDir = "/var/lib/rkt"
|
rktDataDir = "/var/lib/rkt"
|
||||||
@ -1560,7 +1560,7 @@ func (r *Runtime) APIVersion() (kubecontainer.Version, error) {
|
|||||||
|
|
||||||
// Status returns error if rkt is unhealthy, nil otherwise.
|
// Status returns error if rkt is unhealthy, nil otherwise.
|
||||||
func (r *Runtime) Status() error {
|
func (r *Runtime) Status() error {
|
||||||
return r.checkVersion(minimumRktBinVersion, recommendedRktBinVersion, minimumAppcVersion, minimumRktApiVersion, minimumSystemdVersion)
|
return r.checkVersion(minimumRktBinVersion, recommendedRktBinVersion, minimumRktApiVersion, minimumSystemdVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SyncPod syncs the running pod to match the specified desired pod.
|
// SyncPod syncs the running pod to match the specified desired pod.
|
||||||
|
@ -172,7 +172,6 @@ func TestCheckVersion(t *testing.T) {
|
|||||||
tests := []struct {
|
tests := []struct {
|
||||||
minimumRktBinVersion string
|
minimumRktBinVersion string
|
||||||
recommendedRktBinVersion string
|
recommendedRktBinVersion string
|
||||||
minimumAppcVersion string
|
|
||||||
minimumRktApiVersion string
|
minimumRktApiVersion string
|
||||||
minimumSystemdVersion string
|
minimumSystemdVersion string
|
||||||
err error
|
err error
|
||||||
@ -183,7 +182,6 @@ func TestCheckVersion(t *testing.T) {
|
|||||||
{
|
{
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"1.2.4",
|
|
||||||
"1.2.5",
|
"1.2.5",
|
||||||
"99",
|
"99",
|
||||||
nil,
|
nil,
|
||||||
@ -194,7 +192,6 @@ func TestCheckVersion(t *testing.T) {
|
|||||||
{
|
{
|
||||||
"1.2.3+git",
|
"1.2.3+git",
|
||||||
"1.2.3+git",
|
"1.2.3+git",
|
||||||
"1.2.4+git",
|
|
||||||
"1.2.6-alpha",
|
"1.2.6-alpha",
|
||||||
"100",
|
"100",
|
||||||
nil,
|
nil,
|
||||||
@ -203,7 +200,6 @@ func TestCheckVersion(t *testing.T) {
|
|||||||
},
|
},
|
||||||
// Requires greater binary version.
|
// Requires greater binary version.
|
||||||
{
|
{
|
||||||
"1.2.4",
|
|
||||||
"1.2.4",
|
"1.2.4",
|
||||||
"1.2.4",
|
"1.2.4",
|
||||||
"1.2.6-alpha",
|
"1.2.6-alpha",
|
||||||
@ -212,22 +208,10 @@ func TestCheckVersion(t *testing.T) {
|
|||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
// Requires greater Appc version.
|
|
||||||
{
|
|
||||||
"1.2.3",
|
|
||||||
"1.2.3",
|
|
||||||
"1.2.5",
|
|
||||||
"1.2.6-alpha",
|
|
||||||
"100",
|
|
||||||
fmt.Errorf("rkt: appc version is too old(%v), requires at least %v", fr.info.AppcVersion, "1.2.5"),
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
},
|
|
||||||
// Requires greater API version.
|
// Requires greater API version.
|
||||||
{
|
{
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"1.2.4",
|
|
||||||
"1.2.6",
|
"1.2.6",
|
||||||
"100",
|
"100",
|
||||||
fmt.Errorf("rkt: API version is too old(%v), requires at least %v", fr.info.ApiVersion, "1.2.6"),
|
fmt.Errorf("rkt: API version is too old(%v), requires at least %v", fr.info.ApiVersion, "1.2.6"),
|
||||||
@ -238,7 +222,6 @@ func TestCheckVersion(t *testing.T) {
|
|||||||
{
|
{
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"1.2.4",
|
|
||||||
"1.2.7",
|
"1.2.7",
|
||||||
"100",
|
"100",
|
||||||
fmt.Errorf("rkt: API version is too old(%v), requires at least %v", fr.info.ApiVersion, "1.2.7"),
|
fmt.Errorf("rkt: API version is too old(%v), requires at least %v", fr.info.ApiVersion, "1.2.7"),
|
||||||
@ -249,7 +232,6 @@ func TestCheckVersion(t *testing.T) {
|
|||||||
{
|
{
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
"1.2.4",
|
|
||||||
"1.2.7",
|
"1.2.7",
|
||||||
"101",
|
"101",
|
||||||
fmt.Errorf("rkt: systemd version(%v) is too old, requires at least %v", fs.version, "101"),
|
fmt.Errorf("rkt: systemd version(%v) is too old, requires at least %v", fs.version, "101"),
|
||||||
@ -260,7 +242,7 @@ func TestCheckVersion(t *testing.T) {
|
|||||||
|
|
||||||
for i, tt := range tests {
|
for i, tt := range tests {
|
||||||
testCaseHint := fmt.Sprintf("test case #%d", i)
|
testCaseHint := fmt.Sprintf("test case #%d", i)
|
||||||
err := r.checkVersion(tt.minimumRktBinVersion, tt.recommendedRktBinVersion, tt.minimumAppcVersion, tt.minimumRktApiVersion, tt.minimumSystemdVersion)
|
err := r.checkVersion(tt.minimumRktBinVersion, tt.recommendedRktBinVersion, tt.minimumRktApiVersion, tt.minimumSystemdVersion)
|
||||||
assert.Equal(t, tt.err, err, testCaseHint)
|
assert.Equal(t, tt.err, err, testCaseHint)
|
||||||
|
|
||||||
if tt.calledGetInfo {
|
if tt.calledGetInfo {
|
||||||
@ -271,7 +253,6 @@ func TestCheckVersion(t *testing.T) {
|
|||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
assert.Equal(t, fr.info.RktVersion, r.versions.binVersion.String(), testCaseHint)
|
assert.Equal(t, fr.info.RktVersion, r.versions.binVersion.String(), testCaseHint)
|
||||||
assert.Equal(t, fr.info.AppcVersion, r.versions.appcVersion.String(), testCaseHint)
|
|
||||||
assert.Equal(t, fr.info.ApiVersion, r.versions.apiVersion.String(), testCaseHint)
|
assert.Equal(t, fr.info.ApiVersion, r.versions.apiVersion.String(), testCaseHint)
|
||||||
}
|
}
|
||||||
fr.CleanCalls()
|
fr.CleanCalls()
|
||||||
|
@ -30,7 +30,6 @@ type versions struct {
|
|||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
binVersion rktVersion
|
binVersion rktVersion
|
||||||
apiVersion rktVersion
|
apiVersion rktVersion
|
||||||
appcVersion rktVersion
|
|
||||||
systemdVersion systemdVersion
|
systemdVersion systemdVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,12 +86,6 @@ func (r *Runtime) getVersions() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Appc version.
|
|
||||||
r.versions.appcVersion, err = newRktVersion(resp.Info.AppcVersion)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get rkt API version.
|
// Get rkt API version.
|
||||||
r.versions.apiVersion, err = newRktVersion(resp.Info.ApiVersion)
|
r.versions.apiVersion, err = newRktVersion(resp.Info.ApiVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -103,7 +96,7 @@ func (r *Runtime) getVersions() error {
|
|||||||
|
|
||||||
// checkVersion tests whether the rkt/systemd/rkt-api-service that meet the version requirement.
|
// checkVersion tests whether the rkt/systemd/rkt-api-service that meet the version requirement.
|
||||||
// If all version requirements are met, it returns nil.
|
// If all version requirements are met, it returns nil.
|
||||||
func (r *Runtime) checkVersion(minimumRktBinVersion, recommendedRktBinVersion, minimumAppcVersion, minimumRktApiVersion, minimumSystemdVersion string) error {
|
func (r *Runtime) checkVersion(minimumRktBinVersion, recommendedRktBinVersion, minimumRktApiVersion, minimumSystemdVersion string) error {
|
||||||
if err := r.getVersions(); err != nil {
|
if err := r.getVersions(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -137,15 +130,6 @@ func (r *Runtime) checkVersion(minimumRktBinVersion, recommendedRktBinVersion, m
|
|||||||
glog.Warningf("rkt: current binary version %q is not recommended (recommended version %q)", r.versions.binVersion, recommendedRktBinVersion)
|
glog.Warningf("rkt: current binary version %q is not recommended (recommended version %q)", r.versions.binVersion, recommendedRktBinVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Appc version.
|
|
||||||
result, err = r.versions.appcVersion.Compare(minimumAppcVersion)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if result < 0 {
|
|
||||||
return fmt.Errorf("rkt: appc version is too old(%v), requires at least %v", r.versions.appcVersion, minimumAppcVersion)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check rkt API version.
|
// Check rkt API version.
|
||||||
result, err = r.versions.apiVersion.Compare(minimumRktApiVersion)
|
result, err = r.versions.apiVersion.Compare(minimumRktApiVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user