Skip to content

Commit e1baeee

Browse files
committed
Remove elastic-agent directory (#12)
* move directory * fix mage cmd * add missing * licence header * licence header * licence * fix check * mage check fix * fmt * mage fmt update * tests * fix tests * skip flaky test * skip tests
1 parent f92b169 commit e1baeee

File tree

607 files changed

+2341
-3351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

607 files changed

+2341
-3351
lines changed

.ci/Jenkinsfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pipeline {
3636
steps {
3737
withGithubNotify(context: "Lint") {
3838
withMageEnv(){
39-
dir("${BASE_DIR}/elastic-agent"){
39+
dir("${BASE_DIR}"){
4040
cmd(label: 'check license, lint', script: 'mage check')
4141
cmd(label: 'update', script: 'mage update')
4242
}
@@ -65,7 +65,7 @@ pipeline {
6565
deleteDir()
6666
unstash 'source'
6767
withMageEnv(){
68-
dir("${BASE_DIR}/elastic-agent"){
68+
dir("${BASE_DIR}"){
6969
cmd(label: 'Go build', script: 'mage build')
7070
}
7171
}
@@ -76,7 +76,7 @@ pipeline {
7676
steps {
7777
withGithubNotify(context: "Test-${PLATFORM}") {
7878
withMageEnv(){
79-
dir("${BASE_DIR}/elastic-agent"){
79+
dir("${BASE_DIR}"){
8080
cmd(label: 'Go unitTest', script: 'mage unitTest')
8181
}
8282
}

.gitignore

+24-6
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
/build
66
/*/*.template*.json
77
**/html_docs
8-
elastic-agent/data
9-
elastic-agent/pkg/agent/operation/tests/downloads
8+
data
9+
internal/pkg/agent/operation/tests/downloads
1010

1111
# Files
1212
.DS_Store
@@ -19,10 +19,8 @@ beat.db
1919
*.keystore
2020
go_env.properties
2121
mage_output_file.go
22-
elastic-agent/elastic_agent
23-
elastic-agent/fleet.yml
24-
elastic-agent/pkg/agent/operation/tests/scripts/configurable-1.0-darwin-x86_64/configurable
25-
elastic-agent/pkg/agent/operation/tests/scripts/serviceable-1.0-darwin-x86_64/serviceable
22+
elastic_agent
23+
fleet.yml
2624

2725
# Editor swap files
2826
*.swp
@@ -44,3 +42,23 @@ elastic-agent/pkg/agent/operation/tests/scripts/serviceable-1.0-darwin-x86_64/se
4442

4543
# Files generated with the bump version automations
4644
*.bck
45+
46+
47+
# agent
48+
build/
49+
elastic-agent
50+
elastic-agent.dev.yml
51+
elastic-agent.yml.*
52+
fleet.yml
53+
fleet.yml.lock
54+
fleet.yml.old
55+
internal/pkg/agent/operation/tests/scripts/short--1.0.yml
56+
internal/pkg/agent/operation/tests/scripts/configurable-1.0-darwin-x86/configurable
57+
internal/pkg/agent/operation/tests/scripts/servicable-1.0-darwin-x86/configurable
58+
internal/pkg/agent/transpiler/tests/exec-1.0-darwin-x86_64/exec
59+
internal/pkg/agent/operation/tests/scripts/configurable-1.0-darwin-x86_64/configurable
60+
internal/pkg/agent/operation/tests/scripts/serviceable-1.0-darwin-x86_64/serviceable
61+
internal/pkg/agent/application/fleet.yml
62+
63+
# VSCode
64+
/.vscode
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

README.md

+83-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,84 @@
1-
[![Build Status](https://internal-ci.elastic.co/job/elastic-agent/job/elastic-agent-poc-mbp/job/main/badge/icon)](https://internal-ci.elastic.co/job/elastic-agent/job/elastic-agent-poc-mbp/job/main/)
2-
# POC Elastic Agent
1+
# Elastic Agent developer docs
32

4-
T
3+
The source files for the general Elastic Agent documentation are currently stored
4+
in the [observability-docs](https://github.com/elastic/observability-docs) repo. The following docs are only focused on getting developers started building code for Elastic Agent.
5+
6+
## Testing
7+
8+
Prerequisites:
9+
- installed [mage](https://github.com/magefile/mage)
10+
11+
### Testing docker container
12+
13+
Running Elastic Agent in a docker container is a common use case. To build the Elastic Agent and create a docker image run the following command:
14+
15+
```
16+
DEV=true SNAPSHOT=true PLATFORMS=linux/amd64 TYPES=docker mage package
17+
```
18+
19+
If you are in the 7.13 branch, this will create the `docker.elastic.co/beats/elastic-agent:7.13.0-SNAPSHOT` image in your local environment. Now you can use this to for example test this container with the stack in elastic-package:
20+
21+
```
22+
elastic-package stack up --version=7.13.0-SNAPSHOT -v
23+
```
24+
25+
Please note that the docker container is built in both standard and 'complete' variants.
26+
The 'complete' variant contains extra files, like the chromium browser, that are too large
27+
for the standard variant.
28+
29+
### Testing Elastic Agent on Kubernetes
30+
31+
#### Prerequisites
32+
- create kubernetes cluster using kind, check [here](https://github.com/elastic/beats/blob/master/metricbeat/module/kubernetes/_meta/test/docs/README.md) for details
33+
- deploy kube-state-metrics, check [here](https://github.com/elastic/beats/blob/master/metricbeat/module/kubernetes/_meta/test/docs/README.md) for details
34+
- deploy required infrastructure:
35+
- for elastic agent in standalone mode: EK stack or use [elastic cloud](https://cloud.elastic.co), check [here](https://github.com/elastic/beats/blob/master/metricbeat/module/kubernetes/_meta/test/docs/README.md) for details
36+
- for managed mode: use [elastic cloud](https://cloud.elastic.co) or bring up the stack on docker and then connect docker network with kubernetes kind nodes:
37+
```
38+
elastic-package stack up -d -v
39+
docker network connect elastic-package-stack_default <kind_container_id>
40+
```
41+
42+
1. Build elastic-agent:
43+
```bash
44+
cd x-pack/elastic-agent
45+
DEV=true PLATFORMS=linux/amd64 TYPES=docker mage package
46+
```
47+
2. Build docker image:
48+
```bash
49+
cd build/package/elastic-agent/elastic-agent-linux-amd64.docker/docker-build
50+
docker build -t custom-agent-image .
51+
```
52+
3. Load this image in your kind cluster:
53+
```
54+
kind load docker-image custom-agent-image:latest
55+
```
56+
4. Deploy agent with that image:
57+
- download all-in-ome manifest for elastic-agent in standalone or managed mode, change version if needed
58+
```
59+
ELASTIC_AGENT_VERSION="8.0"
60+
ELASTIC_AGENT_MODE="standalone" # ELASTIC_AGENT_MODE="managed"
61+
curl -L -O https://raw.githubusercontent.com/elastic/beats/${ELASTIC_AGENT_VERSION}/deploy/kubernetes/elastic-agent-${ELASTIC_AGENT_MODE}-kubernetes.yaml
62+
```
63+
- Modify downloaded manifest:
64+
- change image name to the one, that was created in the previous step and add `imagePullPolicy: Never`:
65+
```
66+
containers:
67+
- name: elastic-agent
68+
image: custom-agent-image:latest
69+
imagePullPolicy: Never
70+
```
71+
- set environment variables accordingly to the used setup.
72+
73+
Elastic-agent in standalone mode: set `ES_USERNAME`, `ES_PASSWORD`,`ES_HOST`.
74+
75+
Elastic-agent in managed mode: set `FLEET_URL` and `FLEET_ENROLLMENT_TOKEN`.
76+
77+
- create
78+
```
79+
kubectl apply -f elastic-agent-${ELASTIC_AGENT_MODE}-kubernetes.yaml
80+
```
81+
5. Check status of elastic-agent:
82+
```
83+
kubectl -n kube-system get pods -l app=elastic-agent
84+
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

dev-tools/cmd/license/license_generate.go

+3-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev-tools/mage/build.go

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
// Licensed to Elasticsearch B.V. under one or more contributor
2-
// license agreements. See the NOTICE file distributed with
3-
// this work for additional information regarding copyright
4-
// ownership. Elasticsearch B.V. licenses this file to you under
5-
// the Apache License, Version 2.0 (the "License"); you may
6-
// not use this file except in compliance with the License.
7-
// You may obtain a copy of the License at
8-
//
9-
// http://www.apache.org/licenses/LICENSE-2.0
10-
//
11-
// Unless required by applicable law or agreed to in writing,
12-
// software distributed under the License is distributed on an
13-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
// KIND, either express or implied. See the License for the
15-
// specific language governing permissions and limitations
16-
// under the License.
1+
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
// or more contributor license agreements. Licensed under the Elastic License;
3+
// you may not use this file except in compliance with the Elastic License.
174

185
package mage
196

dev-tools/mage/check.go

+8-33
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
// Licensed to Elasticsearch B.V. under one or more contributor
2-
// license agreements. See the NOTICE file distributed with
3-
// this work for additional information regarding copyright
4-
// ownership. Elasticsearch B.V. licenses this file to you under
5-
// the Apache License, Version 2.0 (the "License"); you may
6-
// not use this file except in compliance with the License.
7-
// You may obtain a copy of the License at
8-
//
9-
// http://www.apache.org/licenses/LICENSE-2.0
10-
//
11-
// Unless required by applicable law or agreed to in writing,
12-
// software distributed under the License is distributed on an
13-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
// KIND, either express or implied. See the License for the
15-
// specific language governing permissions and limitations
16-
// under the License.
1+
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
// or more contributor license agreements. Licensed under the Elastic License;
3+
// you may not use this file except in compliance with the Elastic License.
174

185
package mage
196

@@ -189,24 +176,12 @@ func GoVet() error {
189176
// CheckLicenseHeaders checks license headers in .go files.
190177
func CheckLicenseHeaders() error {
191178
fmt.Println(">> fmt - go-licenser: Checking for missing headers")
192-
193179
mg.Deps(InstallGoLicenser)
194180

195-
var license string
196-
switch BeatLicense {
197-
case "ASL2", "ASL 2.0":
198-
license = "ASL2"
199-
case "Elastic", "Elastic License":
200-
license = "Elastic"
201-
default:
202-
return errors.Errorf("unknown license type %v", BeatLicense)
203-
}
204-
205181
licenser := gotool.Licenser
206-
return licenser(licenser.Check(), licenser.License(license))
207-
}
208-
209-
210-
211-
182+
return licenser(
183+
licenser.Check(),
184+
licenser.License("Elastic"),
185+
)
212186

187+
}

dev-tools/mage/clean.go

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
// Licensed to Elasticsearch B.V. under one or more contributor
2-
// license agreements. See the NOTICE file distributed with
3-
// this work for additional information regarding copyright
4-
// ownership. Elasticsearch B.V. licenses this file to you under
5-
// the Apache License, Version 2.0 (the "License"); you may
6-
// not use this file except in compliance with the License.
7-
// You may obtain a copy of the License at
8-
//
9-
// http://www.apache.org/licenses/LICENSE-2.0
10-
//
11-
// Unless required by applicable law or agreed to in writing,
12-
// software distributed under the License is distributed on an
13-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
// KIND, either express or implied. See the License for the
15-
// specific language governing permissions and limitations
16-
// under the License.
1+
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
// or more contributor license agreements. Licensed under the Elastic License;
3+
// you may not use this file except in compliance with the Elastic License.
174

185
package mage
196

dev-tools/mage/common.go

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
// Licensed to Elasticsearch B.V. under one or more contributor
2-
// license agreements. See the NOTICE file distributed with
3-
// this work for additional information regarding copyright
4-
// ownership. Elasticsearch B.V. licenses this file to you under
5-
// the Apache License, Version 2.0 (the "License"); you may
6-
// not use this file except in compliance with the License.
7-
// You may obtain a copy of the License at
8-
//
9-
// http://www.apache.org/licenses/LICENSE-2.0
10-
//
11-
// Unless required by applicable law or agreed to in writing,
12-
// software distributed under the License is distributed on an
13-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
// KIND, either express or implied. See the License for the
15-
// specific language governing permissions and limitations
16-
// under the License.
1+
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
// or more contributor license agreements. Licensed under the Elastic License;
3+
// you may not use this file except in compliance with the Elastic License.
174

185
package mage
196

dev-tools/mage/common_test.go

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
// Licensed to Elasticsearch B.V. under one or more contributor
2-
// license agreements. See the NOTICE file distributed with
3-
// this work for additional information regarding copyright
4-
// ownership. Elasticsearch B.V. licenses this file to you under
5-
// the Apache License, Version 2.0 (the "License"); you may
6-
// not use this file except in compliance with the License.
7-
// You may obtain a copy of the License at
8-
//
9-
// http://www.apache.org/licenses/LICENSE-2.0
10-
//
11-
// Unless required by applicable law or agreed to in writing,
12-
// software distributed under the License is distributed on an
13-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
// KIND, either express or implied. See the License for the
15-
// specific language governing permissions and limitations
16-
// under the License.
1+
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
// or more contributor license agreements. Licensed under the Elastic License;
3+
// you may not use this file except in compliance with the Elastic License.
174

185
package mage
196

dev-tools/mage/config.go

+4-18
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
// Licensed to Elasticsearch B.V. under one or more contributor
2-
// license agreements. See the NOTICE file distributed with
3-
// this work for additional information regarding copyright
4-
// ownership. Elasticsearch B.V. licenses this file to you under
5-
// the Apache License, Version 2.0 (the "License"); you may
6-
// not use this file except in compliance with the License.
7-
// You may obtain a copy of the License at
8-
//
9-
// http://www.apache.org/licenses/LICENSE-2.0
10-
//
11-
// Unless required by applicable law or agreed to in writing,
12-
// software distributed under the License is distributed on an
13-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
// KIND, either express or implied. See the License for the
15-
// specific language governing permissions and limitations
16-
// under the License.
1+
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
// or more contributor license agreements. Licensed under the Elastic License;
3+
// you may not use this file except in compliance with the Elastic License.
174

185
package mage
196

@@ -68,6 +55,7 @@ type ConfigFileParams struct {
6855
Short, Reference, Docker ConfigParams
6956
}
7057

58+
// ConfigParams defines config param template
7159
type ConfigParams struct {
7260
Template string
7361
Deps []interface{}
@@ -216,5 +204,3 @@ func makeHeading(title, separator string) string {
216204
rightEquals := leftEquals + len(title)%2
217205
return "# " + strings.Repeat(separator, leftEquals) + " " + title + " " + strings.Repeat(separator, rightEquals)
218206
}
219-
220-

dev-tools/mage/copy.go

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
// Licensed to Elasticsearch B.V. under one or more contributor
2-
// license agreements. See the NOTICE file distributed with
3-
// this work for additional information regarding copyright
4-
// ownership. Elasticsearch B.V. licenses this file to you under
5-
// the Apache License, Version 2.0 (the "License"); you may
6-
// not use this file except in compliance with the License.
7-
// You may obtain a copy of the License at
8-
//
9-
// http://www.apache.org/licenses/LICENSE-2.0
10-
//
11-
// Unless required by applicable law or agreed to in writing,
12-
// software distributed under the License is distributed on an
13-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
// KIND, either express or implied. See the License for the
15-
// specific language governing permissions and limitations
16-
// under the License.
1+
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
// or more contributor license agreements. Licensed under the Elastic License;
3+
// you may not use this file except in compliance with the Elastic License.
174

185
package mage
196

0 commit comments

Comments
 (0)