Skip to content

Commit 0440db5

Browse files
authored
Add variant for Kibana >= 8.7.0 with Fleet experimental toggles enabled (#1128)
1 parent 409ee85 commit 0440db5

File tree

8 files changed

+124
-11
lines changed

8 files changed

+124
-11
lines changed

.ci/Jenkinsfile

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ pipeline {
9999
'stack-command-default': generateTestCommandStage(command: 'test-stack-command-default', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*', 'build/elastic-stack-status/*/*']),
100100
'stack-command-oldest': generateTestCommandStage(command: 'test-stack-command-oldest', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*', 'build/elastic-stack-status/*/*']),
101101
'stack-command-7x': generateTestCommandStage(command: 'test-stack-command-7x', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*', 'build/elastic-stack-status/*/*']),
102+
'stack-command-86': generateTestCommandStage(command: 'test-stack-command-86', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*', 'build/elastic-stack-status/*/*']),
102103
'stack-command-8x': generateTestCommandStage(command: 'test-stack-command-8x', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*', 'build/elastic-stack-status/*/*']),
103104
'check-packages-with-kind': generateTestCommandStage(command: 'test-check-packages-with-kind', artifacts: ['build/test-results/*.xml', 'build/kubectl-dump.txt', 'build/elastic-stack-dump/check-*/logs/*.log', 'build/elastic-stack-dump/check-*/logs/fleet-server-internal/*'], junitArtifacts: true, publishCoverage: true),
104105
'check-packages-other': generateTestCommandStage(command: 'test-check-packages-other', artifacts: ['build/test-results/*.xml', 'build/elastic-stack-dump/check-*/logs/*.log', 'build/elastic-stack-dump/check-*/logs/fleet-server-internal/*'], junitArtifacts: true, publishCoverage: true),

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ test-stack-command-oldest:
5858
./scripts/test-stack-command.sh 7.14.2
5959

6060
test-stack-command-7x:
61-
./scripts/test-stack-command.sh 7.17.3-SNAPSHOT
61+
./scripts/test-stack-command.sh 7.17.8
62+
63+
# Keeping a test for 8.6 because it has an specific configuration file.
64+
test-stack-command-86:
65+
./scripts/test-stack-command.sh 8.6.1
6266

6367
test-stack-command-8x:
64-
./scripts/test-stack-command.sh 8.6.0-SNAPSHOT
68+
./scripts/test-stack-command.sh 8.7.0-SNAPSHOT
6569

6670
test-stack-command: test-stack-command-default test-stack-command-7x test-stack-command-800 test-stack-command-8x
6771

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
server.name: kibana
2+
server.host: "0.0.0.0"
3+
server.ssl.enabled: true
4+
server.ssl.certificate: "/usr/share/kibana/config/certs/cert.pem"
5+
server.ssl.key: "/usr/share/kibana/config/certs/key.pem"
6+
server.ssl.certificateAuthorities: ["/usr/share/kibana/config/certs/ca-cert.pem"]
7+
8+
elasticsearch.hosts: [ "https://elasticsearch:9200" ]
9+
elasticsearch.ssl.certificateAuthorities: "/usr/share/kibana/config/certs/ca-cert.pem"
10+
elasticsearch.serviceAccountToken: "AAEAAWVsYXN0aWMva2liYW5hL2VsYXN0aWMtcGFja2FnZS1raWJhbmEtdG9rZW46b2x4b051SWNRa0tYMHdXazdLWmFBdw"
11+
12+
monitoring.ui.container.elasticsearch.enabled: true
13+
14+
xpack.fleet.registryUrl: "https://package-registry:8080"
15+
xpack.fleet.agents.enabled: true
16+
xpack.fleet.agents.elasticsearch.hosts: ["https://elasticsearch:9200"]
17+
xpack.fleet.agents.fleet_server.hosts: ["https://fleet-server:8220"]
18+
19+
xpack.encryptedSavedObjects.encryptionKey: "12345678901234567890123456789012"
20+
21+
xpack.cloudSecurityPosture.enabled: true
22+
23+
xpack.fleet.packages:
24+
- name: system
25+
version: latest
26+
- name: elastic_agent
27+
version: latest
28+
- name: fleet_server
29+
version: latest
30+
xpack.fleet.agentPolicies:
31+
- name: Elastic-Agent (elastic-package)
32+
id: elastic-agent-managed-ep
33+
is_default: true
34+
is_managed: false
35+
namespace: default
36+
monitoring_enabled:
37+
- logs
38+
- metrics
39+
package_policies:
40+
- name: system-1
41+
id: default-system
42+
package:
43+
name: system
44+
- name: Fleet Server (elastic-package)
45+
id: fleet-server-policy
46+
is_default_fleet_server: true
47+
is_managed: false
48+
namespace: default
49+
package_policies:
50+
- name: fleet_server-1
51+
id: default-fleet-server
52+
package:
53+
name: fleet_server
54+
xpack.fleet.outputs:
55+
- id: fleet-default-output
56+
name: default
57+
type: elasticsearch
58+
hosts: [ https://elasticsearch:9200 ]
59+
ca_trusted_fingerprint: "${ELASTIC_PACKAGE_CA_TRUSTED_FINGERPRINT}"
60+
is_default: true
61+
is_default_monitoring: true

internal/profile/_static/kibana_config_8x.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ xpack.fleet.registryUrl: "https://package-registry:8080"
1515
xpack.fleet.agents.enabled: true
1616
xpack.fleet.agents.elasticsearch.hosts: ["https://elasticsearch:9200"]
1717
xpack.fleet.agents.fleet_server.hosts: ["https://fleet-server:8220"]
18+
xpack.fleet.enableExperimental: ["experimentalDataStreamSettings"] # Enable experimental toggles in Fleet UI
1819

1920
xpack.encryptedSavedObjects.encryptionKey: "12345678901234567890123456789012"
2021

internal/profile/profile.go

+3
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ type configFile string
4040
var managedProfileFiles = map[configFile]NewConfig{
4141
ElasticAgentDefaultEnvFile: newElasticAgentDefaultEnv,
4242
ElasticAgent8xEnvFile: newElasticAgent8xEnv,
43+
ElasticAgent86EnvFile: newElasticAgent86Env,
4344
ElasticAgent80EnvFile: newElasticAgent80Env,
4445
ElasticsearchConfigDefaultFile: newElasticsearchConfigDefault,
4546
ElasticsearchConfig8xFile: newElasticsearchConfig8x,
47+
ElasticsearchConfig86File: newElasticsearchConfig86,
4648
ElasticsearchConfig80File: newElasticsearchConfig80,
4749
KibanaConfigDefaultFile: newKibanaConfigDefault,
4850
KibanaConfig8xFile: newKibanaConfig8x,
51+
KibanaConfig86File: newKibanaConfig86,
4952
KibanaConfig80File: newKibanaConfig80,
5053
PackageRegistryDockerfileFile: newPackageRegistryDockerfile,
5154
PackageRegistryConfigFile: newPackageRegistryConfig,

internal/profile/static.go

+37
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@ func newKibanaConfig8x(_ string, profilePath string) (*simpleFile, error) {
5353
}, nil
5454
}
5555

56+
// KibanaConfig86File is the Kibana config file for the 8.x stack family (8.2 to 8.6)
57+
const KibanaConfig86File configFile = "kibana.config.86.yml"
58+
59+
//go:embed _static/kibana_config_86.yml
60+
var kibanaConfig86Yml string
61+
62+
func newKibanaConfig86(_ string, profilePath string) (*simpleFile, error) {
63+
return &simpleFile{
64+
name: string(KibanaConfig86File),
65+
path: filepath.Join(profilePath, profileStackPath, string(KibanaConfig86File)),
66+
body: kibanaConfig86Yml,
67+
}, nil
68+
}
69+
5670
// KibanaConfig80File is the Kibana config file for 8.0 stack family (8.0 to 8.1)
5771
const KibanaConfig80File configFile = "kibana.config.80.yml"
5872

@@ -95,6 +109,17 @@ func newElasticsearchConfig8x(_ string, profilePath string) (*simpleFile, error)
95109
}, nil
96110
}
97111

112+
// ElasticsearchConfig8xFile is the Elasticsearch config file for 8.x stack family (8.2 to 8.6)
113+
const ElasticsearchConfig86File configFile = "elasticsearch.config.86.yml"
114+
115+
func newElasticsearchConfig86(_ string, profilePath string) (*simpleFile, error) {
116+
return &simpleFile{
117+
name: string(ElasticsearchConfig86File),
118+
path: filepath.Join(profilePath, profileStackPath, string(ElasticsearchConfig86File)),
119+
body: elasticsearchConfig8xYml,
120+
}, nil
121+
}
122+
98123
// ElasticsearchConfig80File is the Elasticsearch virtual config file name for 8.0 stack family (8.0 to 8.1)
99124
// This file does not exist in the source code, since it's identical to the 8x config file.
100125
const ElasticsearchConfig80File configFile = "elasticsearch.config.80.yml"
@@ -154,6 +179,18 @@ func newElasticAgent80Env(_ string, profilePath string) (*simpleFile, error) {
154179
}, nil
155180
}
156181

182+
// ElasticAgent86EnvFile is the .env for the 8.6 stack.
183+
// This file does not exist in the source code, since it's identical to the 8x env file.
184+
const ElasticAgent86EnvFile configFile = "elastic-agent.86.env"
185+
186+
func newElasticAgent86Env(_ string, profilePath string) (*simpleFile, error) {
187+
return &simpleFile{
188+
name: string(ElasticAgent86EnvFile),
189+
path: filepath.Join(profilePath, profileStackPath, string(ElasticAgent86EnvFile)),
190+
body: elasticAgent8xEnv,
191+
}, nil
192+
}
193+
157194
// ElasticAgent8xEnvFile is the .env for the 8x stack.
158195
const ElasticAgent8xEnvFile configFile = "elastic-agent.8x.env"
159196

internal/stack/variants.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ import (
1414
// This map is used to deploy different versions of the Elastic stack with matching configurations.
1515
var configurationVariantMap = map[string]string{
1616
"8.0-0 - 8.1.x-x": "80",
17-
"^8.2-0": "8x",
17+
"8.2-0 - 8.6.x-x": "86",
18+
"^8.7-0": "8x",
1819
}
1920

2021
// stackVariantAsEnv function returns a stack variant based on the given stack version.
2122
// We identified three variants:
2223
// * default, covers all of 7.x branches
2324
// * 80, covers stack versions 8.0.0 to 8.1.x
25+
// * 86, covers stack versions 8.2.0 to 8.6.x, they don't support experimental toggles in Fleet
2426
// * 8x, supports different configuration options in Kibana, covers stack versions 8.2.0+
2527
func stackVariantAsEnv(version string) string {
2628
return fmt.Sprintf("STACK_VERSION_VARIANT=%s", selectStackVersion(version))

internal/stack/variants_test.go

+12-8
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,18 @@ var tests = []struct {
3232
{"8.1.58", "80"},
3333
{"8.1.99-beta", "80"},
3434
{"8.1.999-SNAPSHOT", "80"},
35-
{"8.2-0", "8x"},
36-
{"8.2", "8x"},
37-
{"8.2.0-alpha", "8x"},
38-
{"8.2.0", "8x"},
39-
{"8.2.58", "8x"},
40-
{"8.2.99-gamma", "8x"},
41-
{"8.2.777-SNAPSHOT+arm64", "8x"},
42-
{"8.5", "8x"},
35+
{"8.2-0", "86"},
36+
{"8.2", "86"},
37+
{"8.2.0-alpha", "86"},
38+
{"8.2.0", "86"},
39+
{"8.2.58", "86"},
40+
{"8.2.99-gamma", "86"},
41+
{"8.2.777-SNAPSHOT+arm64", "86"},
42+
{"8.5", "86"},
43+
{"8.6.1", "86"},
44+
{"8.7.0", "8x"},
45+
{"8.7.0-SNAPSHOT", "8x"},
46+
{"8.7.1-SNAPSHOT", "8x"},
4347
{"9", "default"},
4448
}
4549

0 commit comments

Comments
 (0)