Skip to content
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: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2018-2025 Elasticsearch BV
Copyright 2018-2026 Elasticsearch BV

This product includes software developed by The Apache Software
Foundation (http://www.apache.org/).
Expand Down
2 changes: 0 additions & 2 deletions docs/reference/api-reference/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -1649,8 +1649,6 @@ UpdateStrategy specifies how updates to the cluster should be performed.





% TODO add function to crd-ref-docs return anchor used in links docs-v3 does not seem to produce valid markdown anchors
## enterprisesearch.k8s.elastic.co/v1 [#enterprisesearchk8selasticcov1]

Expand Down
17 changes: 5 additions & 12 deletions pkg/apis/elasticsearch/v1/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ var MinReadinessPortVersion = version.MinFor(8, 2, 0)
const (
ClusterName = "cluster.name"

DiscoveryZenMinimumMasterNodes = "discovery.zen.minimum_master_nodes"
ClusterInitialMasterNodes = "cluster.initial_master_nodes"
ClusterInitialMasterNodes = "cluster.initial_master_nodes"

DiscoveryZenHostsProvider = "discovery.zen.hosts_provider" // ES < 7.X
DiscoverySeedProviders = "discovery.seed_providers" // ES >= 7.X
DiscoverySeedHosts = "discovery.seed_hosts" // ES >= 7.X
DiscoverySeedProviders = "discovery.seed_providers"
DiscoverySeedHosts = "discovery.seed_hosts"

ReadinessPort = "readiness.port" // ES >= 8.2.0

Expand All @@ -38,12 +36,8 @@ const (
ShardAwarenessAttributes = "cluster.routing.allocation.awareness.attributes"
NodeAttr = "node.attr"

XPackSecurityAuthcRealmsFileFile1Order = "xpack.security.authc.realms.file.file1.order" // 7.x realm syntax
XPackSecurityAuthcRealmsFile1Order = "xpack.security.authc.realms.file1.order" // 6.x realm syntax
XPackSecurityAuthcRealmsFile1Type = "xpack.security.authc.realms.file1.type" // 6.x realm syntax
XPackSecurityAuthcRealmsNativeNative1Order = "xpack.security.authc.realms.native.native1.order" // 7.x realm syntax
XPackSecurityAuthcRealmsNative1Order = "xpack.security.authc.realms.native1.order" // 6.x realm syntax
XPackSecurityAuthcRealmsNative1Type = "xpack.security.authc.realms.native1.type" // 6.x realm syntax
XPackSecurityAuthcRealmsFileFile1Order = "xpack.security.authc.realms.file.file1.order"
XPackSecurityAuthcRealmsNativeNative1Order = "xpack.security.authc.realms.native.native1.order"

XPackSecurityAuthcReservedRealmEnabled = "xpack.security.authc.reserved_realm.enabled"
XPackSecurityEnabled = "xpack.security.enabled"
Expand Down Expand Up @@ -72,7 +66,6 @@ var UnsupportedSettings = []string{
ClusterName,
DiscoverySeedHosts,
DiscoverySeedProviders,
DiscoveryZenMinimumMasterNodes,
ClusterInitialMasterNodes,
NetworkHost,
NetworkPublishHost,
Expand Down
4 changes: 0 additions & 4 deletions pkg/apis/elasticsearch/v1beta1/elasticsearch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,6 @@ type ElasticsearchStatus struct {
Phase ElasticsearchOrchestrationPhase `json:"phase,omitempty"`
}

type ZenDiscoveryStatus struct {
MinimumMasterNodes int `json:"minimumMasterNodes,omitempty"`
}

// IsDegraded returns true if the current status is worse than the previous.
func (es ElasticsearchStatus) IsDegraded(prev ElasticsearchStatus) bool {
return es.Health.Less(prev.Health)
Expand Down
15 changes: 4 additions & 11 deletions pkg/apis/elasticsearch/v1beta1/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ package v1beta1
const (
ClusterName = "cluster.name"

DiscoveryZenMinimumMasterNodes = "discovery.zen.minimum_master_nodes"
ClusterInitialMasterNodes = "cluster.initial_master_nodes"
ClusterInitialMasterNodes = "cluster.initial_master_nodes"

DiscoveryZenHostsProvider = "discovery.zen.hosts_provider" // ES < 7.X
DiscoverySeedProviders = "discovery.seed_providers" // ES >= 7.X
DiscoverySeedProviders = "discovery.seed_providers"

NetworkHost = "network.host"
NetworkPublishHost = "network.publish_host"
Expand All @@ -21,12 +19,8 @@ const (
PathData = "path.data"
PathLogs = "path.logs"

XPackSecurityAuthcRealmsFileFile1Order = "xpack.security.authc.realms.file.file1.order" // 7.x realm syntax
XPackSecurityAuthcRealmsFile1Order = "xpack.security.authc.realms.file1.order" // 6.x realm syntax
XPackSecurityAuthcRealmsFile1Type = "xpack.security.authc.realms.file1.type" // 6.x realm syntax
XPackSecurityAuthcRealmsNativeNative1Order = "xpack.security.authc.realms.native.native1.order" // 7.x realm syntax
XPackSecurityAuthcRealmsNative1Order = "xpack.security.authc.realms.native1.order" // 6.x realm syntax
XPackSecurityAuthcRealmsNative1Type = "xpack.security.authc.realms.native1.type" // 6.x realm syntax
XPackSecurityAuthcRealmsFileFile1Order = "xpack.security.authc.realms.file.file1.order"
XPackSecurityAuthcRealmsNativeNative1Order = "xpack.security.authc.realms.native.native1.order"

XPackSecurityAuthcReservedRealmEnabled = "xpack.security.authc.reserved_realm.enabled"
XPackSecurityEnabled = "xpack.security.enabled"
Expand All @@ -43,7 +37,6 @@ const (

var UnsupportedSettings = []string{
ClusterName,
DiscoveryZenMinimumMasterNodes,
ClusterInitialMasterNodes,
NetworkHost,
NetworkPublishHost,
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/elasticsearch/v1beta1/validations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func Test_hasMaster(t *testing.T) {
}{
{
name: "no topology",
es: es("6.8.0"),
es: es("7.17.0"),
expectErrors: true,
},
{
Expand Down Expand Up @@ -543,7 +543,7 @@ func TestValidation_noDowngrades(t *testing.T) {
{
name: "no validation on create",
current: nil,
proposed: es("6.8.0"),
proposed: es("7.17.0"),
expectErrors: false,
},
{
Expand Down Expand Up @@ -604,7 +604,7 @@ func Test_validUpgradePath(t *testing.T) {
},
{
name: "in range accepted",
current: es("6.8.0"),
current: es("7.0.0"),
proposed: es("7.17.0"),
expectErrors: false,
},
Expand Down
15 changes: 0 additions & 15 deletions pkg/apis/elasticsearch/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 3 additions & 11 deletions pkg/controller/association/controller/apm_es.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,10 @@ func getAPMElasticsearchRoles(associated commonv1.Associated) (string, error) {
}, ","), nil
}

// 7.1.x to 7.4.x
if v.GTE(version.From(7, 1, 0)) {
return strings.Join([]string{
user.ApmUserRoleV7, // Retrieve cluster details (e.g. version) and manage apm-* indices
"ingest_admin", // Set up index templates
"apm_system", // To collect metrics about APM Server
}, ","), nil
}

// 6.8
// 7.1.x to 7.4.x (and fallback for any older 7.x versions)
return strings.Join([]string{
user.ApmUserRoleV6, // Retrieve cluster details (e.g. version) and manage apm-* indices
user.ApmUserRoleV7, // Retrieve cluster details (e.g. version) and manage apm-* indices
"ingest_admin", // Set up index templates
"apm_system", // To collect metrics about APM Server
}, ","), nil
}
15 changes: 3 additions & 12 deletions pkg/controller/association/controller/apm_es_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,13 @@ func Test_getAPMElasticsearchRoles(t *testing.T) {
wantErr bool
}{
{
name: "Test roles for APM Server v6.8.0",
name: "Test roles for APM Server v7.0.0",
args: args{
associated: &apmv1.ApmServer{
Spec: apmv1.ApmServerSpec{Version: "6.8.0"},
Spec: apmv1.ApmServerSpec{Version: "7.0.0"},
},
},
want: "eck_apm_user_role_v6,apm_system",
},
{
name: "Test roles for APM Server v6.8.99",
args: args{
associated: &apmv1.ApmServer{
Spec: apmv1.ApmServerSpec{Version: "6.8.99"},
},
},
want: "eck_apm_user_role_v6,apm_system",
want: "eck_apm_user_role_v7,ingest_admin,apm_system",
},
{
name: "Test roles for APM Server v7.1.0",
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/common/expectations/expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Things that could happen without this mechanism in place:
- delete more than one master node at a time
- outgrow the changeBudget during upscale and downscales
- clear shards allocation excludes for a node that is not removed yet
- update zen1/zen2 minimum_master_nodes/initial_master_nodes based on the wrong number of nodes
- update zen1/zen2 minimum_master_nodes/initial_master_nodes based on the wrong nodes specification (ignoring master->data upgrades)
- update zen2 initial_master_nodes based on the wrong number of nodes
- update zen2 initial_master_nodes based on the wrong nodes specification (ignoring master->data upgrades)
- clear voting_config_exclusions while a Pod has not finished its restart yet (or maybe just started)

## What if the operator restarts?
Expand All @@ -64,7 +64,7 @@ No. In most situations, it's totally fine to rely on Kubernetes optimistic locki
* if we delete a resource that does not exist, the operation fails

The only cases where we need it are (so far):
- when interacting with external systems own orchestration mechanism (Elasticsearch zen1/zen2)
- when interacting with external systems own orchestration mechanism (Elasticsearch zen2)
- when trying to control how many creations/deletions/upgrades happen in parallel

## Where does it come from?
Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/elasticsearch/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ func ReconcileClusterUUID(ctx context.Context, k8sClient k8s.Client, cluster *es
clusterUUID, err := getClusterUUID(ctx, esClient)
if err != nil {
// There was an error while retrieving the UUID of the Elasticsearch cluster.
// For example, it could be the case with ES 6.x if the cluster does not have a master yet, in this case an
// API call to get the cluster UUID returns a 503 error.
// For example, if the cluster does not have a master yet, an API call to get the cluster UUID returns a 503 error.
// However we don't want to stop the reconciliation loop here because it could prevent the user to apply
// an update to the cluster spec to fix a problem.
// Therefore we just log the error and notify the driver that the reconciliation should be eventually re-queued.
Expand Down
11 changes: 4 additions & 7 deletions pkg/controller/elasticsearch/client/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,17 @@ func (c *baseClient) request(

func versioned(b *baseClient, v version.Version) Client {
b.version = v
v6 := clientV6{
v7 := clientV7{
baseClient: *b,
}
switch v.Major {
case 7:
return &clientV7{
clientV6: v6,
}
case 8, 9:
return &clientV8{
clientV7: clientV7{clientV6: v6},
clientV7: v7,
}
default:
return &v6
// Default to v7 client for version 7.x and any future versions
return &v7
}
}

Expand Down
2 changes: 0 additions & 2 deletions pkg/controller/elasticsearch/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ type Client interface {
GetClusterHealthWaitForAllEvents(ctx context.Context) (Health, error)
// GetClusterState calls the _cluster/state api.
GetClusterState(ctx context.Context) (ClusterState, error)
// SetMinimumMasterNodes sets the transient and persistent setting of the same name in cluster settings.
SetMinimumMasterNodes(ctx context.Context, n int) error
// ReloadSecureSettings will decrypt and re-read the entire keystore, on every cluster node,
// but only the reloadable secure settings will be applied
ReloadSecureSettings(ctx context.Context) error
Expand Down
Loading