Skip to content
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

Stub initial support for Elastic stack version 8.0 #2613

Merged
merged 1 commit into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/apis/elasticsearch/v1/validations.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ func validUpgradePath(current, proposed *Elasticsearch) field.ErrorList {
// this should not happen, since this is the already persisted version
errs = append(errs, field.Invalid(field.NewPath("spec").Child("version"), current.Spec.Version, parseStoredVersionErrMsg))
}
currVer, err := version.Parse(proposed.Spec.Version)
proposedVer, err := version.Parse(proposed.Spec.Version)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh! good catch

if err != nil {
errs = append(errs, field.Invalid(field.NewPath("spec").Child("version"), proposed.Spec.Version, parseVersionErrMsg))
}
if len(errs) != 0 {
return errs
}

v := esversion.SupportedVersions(*currVer)
v := esversion.SupportedVersions(*proposedVer)
if v == nil {
errs = append(errs, field.Invalid(field.NewPath("spec").Child("version"), proposed.Spec.Version, unsupportedVersionMsg))
return errs
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/elasticsearch/client/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ func versioned(b *baseClient, v version.Version) Client {
return &clientV7{
clientV6: v6,
}
case 8:
return &clientV8{
clientV7: clientV7{clientV6: v6},
}
default:
return &v6
}
Expand Down
20 changes: 20 additions & 0 deletions pkg/controller/elasticsearch/client/v8.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package client

type clientV8 struct {
clientV7
}

// Equal returns true if c2 can be considered the same as c
func (c *clientV8) Equal(c2 Client) bool {
other, ok := c2.(*clientV8)
if !ok {
return false
}
return c.baseClient.equal(&other.baseClient)
}

var _ Client = &clientV8{}
6 changes: 6 additions & 0 deletions pkg/controller/elasticsearch/version/supported_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ func SupportedVersions(v version.Version) *LowestHighestSupportedVersions {
// higher may be possible, but not proven yet, lower may also be a requirement...
HighestSupportedVersion: version.MustParse("7.99.99"),
}
case 8:
return &LowestHighestSupportedVersions{
// 7.4.0 is the lowest version that offers a direct upgrade path to 8.0
LowestSupportedVersion: version.MustParse("7.4.0"),
HighestSupportedVersion: version.MustParse("8.99.99"),
}
default:
return nil
}
Expand Down
13 changes: 13 additions & 0 deletions pkg/controller/elasticsearch/version/supported_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ func TestSupportedVersions(t *testing.T) {
version.MustParse("8.0.0"),
},
},
{
name: "8.x",
args: args{
v: version.MustParse("8.0.0"),
},
supported: []version.Version{
version.MustParse("7.4.0"),
version.MustParse("8.9.0"),
},
unsupported: []version.Version{
version.MustParse("7.1.0"), // supported by ECK but no direct upgrade path to 8.x
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down