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

>=7.6.0: set allowed license upload types #2257

Merged
merged 3 commits into from
Dec 18, 2019
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
2 changes: 2 additions & 0 deletions pkg/apis/elasticsearch/v1/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const (
XPackSecurityTransportSslEnabled = "xpack.security.transport.ssl.enabled"
XPackSecurityTransportSslKey = "xpack.security.transport.ssl.key"
XPackSecurityTransportSslVerificationMode = "xpack.security.transport.ssl.verification_mode"

XPackLicenseUploadTypes = "xpack.license.upload.types" // >= 7.6.0
)

var UnsupportedSettings = []string{
Expand Down
7 changes: 7 additions & 0 deletions pkg/controller/elasticsearch/settings/merged_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
common "github.com/elastic/cloud-on-k8s/pkg/controller/common/settings"
"github.com/elastic/cloud-on-k8s/pkg/controller/common/version"
escerts "github.com/elastic/cloud-on-k8s/pkg/controller/elasticsearch/certificates"
"github.com/elastic/cloud-on-k8s/pkg/controller/elasticsearch/client"
"github.com/elastic/cloud-on-k8s/pkg/controller/elasticsearch/volume"
)

Expand Down Expand Up @@ -113,5 +114,11 @@ func xpackConfig(ver version.Version, httpCfg commonv1.HTTPConfig, certResources
cfg[esv1.XPackSecurityAuthcRealmsNativeNative1Order] = -99
}

if ver.IsSameOrAfter(version.MustParse("7.6.0")) {
cfg[esv1.XPackLicenseUploadTypes] = []string{
string(client.ElasticsearchLicenseTypeTrial), string(client.ElasticsearchLicenseTypeEnterprise),
}
}

return &CanonicalConfig{common.MustCanonicalConfig(cfg)}
}
16 changes: 16 additions & 0 deletions pkg/controller/elasticsearch/settings/merged_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@ func TestNewMergedESConfig(t *testing.T) {
require.Equal(t, 1, len(cfg.HasKeys([]string{esv1.DiscoverySeedProviders})))
},
},
{
name: "prior to 7.6.0, we should not set allowed license upload types",
version: "7.5.0",
cfgData: map[string]interface{}{},
assert: func(cfg CanonicalConfig) {
require.Equal(t, 0, len(cfg.HasKeys([]string{esv1.XPackLicenseUploadTypes})))
},
},
{
name: "starting 7.6.0, we should set allowed license upload types",
version: "7.6.0",
cfgData: map[string]interface{}{},
assert: func(cfg CanonicalConfig) {
require.Equal(t, 1, len(cfg.HasKeys([]string{esv1.XPackLicenseUploadTypes})))
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down