Skip to content

Commit 510a1ab

Browse files
Merge branch 'main' into feauture/use-docker-elastic-images
2 parents 245740e + 82460a2 commit 510a1ab

12 files changed

Lines changed: 201 additions & 174 deletions

File tree

.buildkite/scripts/steps/run-agentless-tests.sh

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,34 @@ set -eox pipefail
2020
_SELF=$(dirname $0)
2121
source "${_SELF}/../common.sh"
2222

23-
extract_sha() {
24-
local env=$1
25-
local sha
26-
27-
# Ensure repo is available
28-
git clone --depth 1 git@github.com:elastic/serverless-gitops.git || (
29-
cd serverless-gitops
30-
git pull
31-
)
32-
23+
setup_extract_sha() {
24+
# Ensure repo is available - redirect output to /dev/null
25+
if [ ! -d "serverless-gitops" ]; then
26+
git clone --depth 1 git@github.com:elastic/serverless-gitops.git
27+
else
28+
(cd serverless-gitops && git pull)
29+
fi
30+
31+
# Install yq for YAML parsing
3332
go install github.com/mikefarah/yq/v4@v4.45.1
33+
}
3434

35+
extract_sha() {
36+
local env=$1
37+
3538
# Extract first matching SHA for the environment pattern
36-
sha=$(yq eval ".services.agentless-controller.versions | to_entries | .[] | select(.key | test(\"^${env}.*\")) | .value" serverless-gitops/services/agentless-controller/versions.yaml | head -1)
37-
38-
echo "$sha"
39+
yq eval ".services.agentless-controller.versions | to_entries | .[] | select(.key | test(\"^${env}.*\")) | .value" serverless-gitops/services/agentless-controller/versions.yaml | head -1
3940
}
4041

42+
4143
# Check environment variable
4244
if [ -z "${ENVIRONMENT:-}" ]; then
4345
echo "ENVIRONMENT variable is not set"
4446
exit 1
4547
fi
4648

49+
setup_extract_sha
50+
4751
# Extract agentless_controller_sha for the specified environment
4852
agentless_controller_sha=$(extract_sha "$ENVIRONMENT")
4953

.github/workflows/bump-golang.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/checkout@v4
2323

2424
- name: Install Updatecli in the runner
25-
uses: updatecli/updatecli-action@f11c0cb3aca7a018d6000dc86a57eb3442277219 # 2.81.0
25+
uses: updatecli/updatecli-action@ae3030ce1710c6496214fb1f8fd3bd9437b2a69d # 2.82.0
2626

2727
- name: Run Updatecli in Apply mode
2828
run: updatecli apply --config .ci/updatecli/updatecli-bump-golang.yml --values .ci/updatecli/values.d/scm.yml

NOTICE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,11 +1421,11 @@ SOFTWARE
14211421

14221422
--------------------------------------------------------------------------------
14231423
Dependency : github.com/elastic/elastic-agent-libs
1424-
Version: v0.19.2
1424+
Version: v0.19.3
14251425
Licence type (autodetected): Apache-2.0
14261426
--------------------------------------------------------------------------------
14271427

1428-
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.19.2/LICENSE:
1428+
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.19.3/LICENSE:
14291429

14301430
Apache License
14311431
Version 2.0, January 2004
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Kind can be one of:
2+
# - breaking-change: a change to previously-documented behavior
3+
# - deprecation: functionality that is being removed in a later release
4+
# - bug-fix: fixes a problem in a previous version
5+
# - enhancement: extends functionality but does not break or fix existing behavior
6+
# - feature: new functionality
7+
# - known-issue: problems that we are aware of in a given version
8+
# - security: impacts on the security of a product or a user’s deployment.
9+
# - upgrade: important information for someone upgrading from a prior version
10+
# - other: does not fit into any of the other categories
11+
kind: feature
12+
13+
# Change summary; a 80ish characters long description of the change.
14+
summary: set collectors fullnameOverride for edot kube-stack values
15+
16+
# Long description; in case the summary is not enough to describe the change
17+
# this field accommodate a description without length limits.
18+
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
19+
#description:
20+
21+
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
22+
component: elastic-agent
23+
24+
# PR URL; optional; the PR number that added the changeset.
25+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
26+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
27+
# Please provide it if you are adding a fragment for a different PR.
28+
pr: https://github.com/elastic/elastic-agent/pull/7754
29+
30+
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
31+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
32+
issue: https://github.com/elastic/elastic-agent/issues/7381

deploy/helm/edot-collector/kube-stack/managed_otlp/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ collectors:
3333
# Cluster is a K8s deployment EDOT collector focused on gathering telemetry
3434
# at the cluster level (Kubernetes Events and cluster metrics).
3535
cluster:
36+
fullnameOverride: "opentelemetry-kube-stack-cluster-stats"
3637
env:
3738
- name: ELASTIC_AGENT_OTEL
3839
value: '"true"'
@@ -184,6 +185,7 @@ collectors:
184185
# node level and exposing an OTLP endpoint for data ingestion.
185186
# Auto-instrumentation SDKs will use this endpoint.
186187
daemon:
188+
fullnameOverride: "opentelemetry-kube-stack-daemon"
187189
env:
188190
# Work around for open /mounts error: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35990
189191
- name: HOST_PROC_MOUNTINFO
@@ -526,6 +528,7 @@ collectors:
526528
# Gateway is a K8s deployment EDOT collector focused on processing and
527529
# forwarding telemetry to an Elasticsearch endpoint.
528530
gateway:
531+
fullnameOverride: "opentelemetry-kube-stack-gateway"
529532
suffix: gateway
530533
replicas: 2
531534
autoscaler:

deploy/helm/edot-collector/kube-stack/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ collectors:
3333
# Cluster is a K8s deployment EDOT collector focused on gathering telemetry
3434
# at the cluster level (Kubernetes Events and cluster metrics).
3535
cluster:
36+
fullnameOverride: "opentelemetry-kube-stack-cluster-stats"
3637
env:
3738
- name: ELASTIC_AGENT_OTEL
3839
value: '"true"'
@@ -184,6 +185,7 @@ collectors:
184185
# node level and exposing an OTLP endpoint for data ingestion.
185186
# Auto-instrumentation SDKs will use this endpoint.
186187
daemon:
188+
fullnameOverride: "opentelemetry-kube-stack-daemon"
187189
env:
188190
# Work around for open /mounts error: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35990
189191
- name: HOST_PROC_MOUNTINFO
@@ -526,6 +528,7 @@ collectors:
526528
# Gateway is a K8s deployment EDOT collector focused on processing and
527529
# forwarding telemetry to an Elasticsearch endpoint.
528530
gateway:
531+
fullnameOverride: "opentelemetry-kube-stack-gateway"
529532
resources:
530533
limits:
531534
cpu: 1500m

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/elastic/cloud-on-k8s/v2 v2.0.0-20250327073047-b624240832ae
1818
github.com/elastic/elastic-agent-autodiscover v0.9.0
1919
github.com/elastic/elastic-agent-client/v7 v7.17.2
20-
github.com/elastic/elastic-agent-libs v0.19.2
20+
github.com/elastic/elastic-agent-libs v0.19.3
2121
github.com/elastic/elastic-agent-system-metrics v0.11.11
2222
github.com/elastic/elastic-transport-go/v8 v8.7.0
2323
github.com/elastic/go-elasticsearch/v8 v8.17.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,8 @@ github.com/elastic/elastic-agent-autodiscover v0.9.0 h1:+iWIKh0u3e8I+CJa3FfWe9h0
480480
github.com/elastic/elastic-agent-autodiscover v0.9.0/go.mod h1:5iUxLHhVdaGSWYTveSwfJEY4RqPXTG13LPiFoxcpFd4=
481481
github.com/elastic/elastic-agent-client/v7 v7.17.2 h1:Cl2TeABqWZgW40t5fchGWT/sRk4MDDLWA0d8iHHOxLA=
482482
github.com/elastic/elastic-agent-client/v7 v7.17.2/go.mod h1:5irRFqp6HLqtu1S+OeY0jg8x7K6PLL+DW+PwVk1vJnk=
483-
github.com/elastic/elastic-agent-libs v0.19.2 h1:uOLUF/KQQf9t6iKr5mfp3jO7CxVZToCJKbb2iSWMswU=
484-
github.com/elastic/elastic-agent-libs v0.19.2/go.mod h1:1HNxREH8C27kGrJCtKZh/ot8pV8joH8VREP21+FrH5s=
483+
github.com/elastic/elastic-agent-libs v0.19.3 h1:DuSVJMowcV3tHbW44SDzCbVJv3Y696GTBRikcAxwr2A=
484+
github.com/elastic/elastic-agent-libs v0.19.3/go.mod h1:1HNxREH8C27kGrJCtKZh/ot8pV8joH8VREP21+FrH5s=
485485
github.com/elastic/elastic-agent-system-metrics v0.11.11 h1:Qjh3Zef23PfGlG91AF+9ciNLNQf/8cDJ4CalnLZtV3g=
486486
github.com/elastic/elastic-agent-system-metrics v0.11.11/go.mod h1:GNqmKfvOt8PwORjbS6GllNdMfkLpOWyTa7P8oQq4E5o=
487487
github.com/elastic/elastic-transport-go/v8 v8.7.0 h1:OgTneVuXP2uip4BA658Xi6Hfw+PeIOod2rY3GVMGoVE=

testing/integration/kubernetes_agent_standalone_test.go

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"github.com/stretchr/testify/require"
3030

3131
"github.com/elastic/elastic-agent-libs/kibana"
32+
"github.com/elastic/elastic-agent-libs/testing/estools"
3233
"github.com/elastic/go-elasticsearch/v8"
3334

3435
appsv1 "k8s.io/api/apps/v1"
@@ -864,7 +865,8 @@ func k8sCheckAgentStatus(ctx context.Context, client klient.Client, stdout *byte
864865

865866
// k8sGetAgentID returns the agent ID for the given agent pod
866867
func k8sGetAgentID(ctx context.Context, client klient.Client, stdout *bytes.Buffer, stderr *bytes.Buffer,
867-
namespace string, agentPodName string, containerName string) (string, error) {
868+
namespace string, agentPodName string, containerName string,
869+
) (string, error) {
868870
command := []string{"elastic-agent", "status", "--output=json"}
869871

870872
status := atesting.AgentStatusOutput{} // clear status output
@@ -997,7 +999,7 @@ func k8sDumpPods(t *testing.T, ctx context.Context, client klient.Client, testNa
997999
header := &tar.Header{
9981000
Name: logFileName,
9991001
Size: int64(len(b)),
1000-
Mode: 0600,
1002+
Mode: 0o600,
10011003
ModTime: time.Now(),
10021004
AccessTime: time.Now(),
10031005
ChangeTime: time.Now(),
@@ -1024,7 +1026,7 @@ func k8sDumpPods(t *testing.T, ctx context.Context, client klient.Client, testNa
10241026
header := &tar.Header{
10251027
Name: statesDumpFile,
10261028
Size: int64(len(b)),
1027-
Mode: 0600,
1029+
Mode: 0o600,
10281030
ModTime: time.Now(),
10291031
AccessTime: time.Now(),
10301032
ChangeTime: time.Now(),
@@ -1102,35 +1104,8 @@ func k8sRenderKustomize(kustomizePath string) ([]byte, error) {
11021104
}
11031105

11041106
// generateESAPIKey generates an API key for the given Elasticsearch.
1105-
func generateESAPIKey(esClient *elasticsearch.Client, keyName string) (string, error) {
1106-
apiKeyReqBody := fmt.Sprintf(`{
1107-
"name": "%s",
1108-
"expiration": "1d"
1109-
}`, keyName)
1110-
1111-
resp, err := esClient.Security.CreateAPIKey(strings.NewReader(apiKeyReqBody))
1112-
if err != nil {
1113-
return "", err
1114-
}
1115-
defer resp.Body.Close()
1116-
1117-
response := make(map[string]interface{})
1118-
err = json.NewDecoder(resp.Body).Decode(&response)
1119-
if err != nil {
1120-
return "", err
1121-
}
1122-
1123-
keyToken := response["api_key"].(string)
1124-
if keyToken == "" {
1125-
return "", fmt.Errorf("key token is empty")
1126-
}
1127-
1128-
keyID := response["id"].(string)
1129-
if keyID == "" {
1130-
return "", fmt.Errorf("key ID is empty")
1131-
}
1132-
1133-
return fmt.Sprintf("%s:%s", keyID, keyToken), nil
1107+
func generateESAPIKey(esClient *elasticsearch.Client, keyName string) (estools.APIKeyResponse, error) {
1108+
return estools.CreateAPIKey(context.Background(), esClient, estools.APIKeyRequest{Name: keyName, Expiration: "1d"})
11341109
}
11351110

11361111
// k8sDeleteOpts contains options for deleting k8s objects
@@ -1330,6 +1305,8 @@ type k8sContext struct {
13301305
esHost string
13311306
// esAPIKey is the API key of the elasticsearch to use in the test
13321307
esAPIKey string
1308+
// esEncodedAPIKey is the encoded API key of the elasticsearch to use in the test
1309+
esEncodedAPIKey string
13331310
// enrollParams contains the information needed to enroll an agent with Fleet in the test
13341311
enrollParams *fleettools.EnrollParams
13351312
// createdAt is the time when the k8sContext was created
@@ -1415,16 +1392,17 @@ func k8sGetContext(t *testing.T, info *define.Info) k8sContext {
14151392
require.NoError(t, err, "failed to create fleet enroll params")
14161393

14171394
return k8sContext{
1418-
client: client,
1419-
clientSet: clientSet,
1420-
agentImage: agentImage,
1421-
agentImageRepo: agentImageRepo,
1422-
agentImageTag: agentImageTag,
1423-
logsBasePath: testLogsBasePath,
1424-
esHost: esHost,
1425-
esAPIKey: esAPIKey,
1426-
enrollParams: enrollParams,
1427-
createdAt: time.Now(),
1395+
client: client,
1396+
clientSet: clientSet,
1397+
agentImage: agentImage,
1398+
agentImageRepo: agentImageRepo,
1399+
agentImageTag: agentImageTag,
1400+
logsBasePath: testLogsBasePath,
1401+
esHost: esHost,
1402+
esAPIKey: esAPIKey.APIKey,
1403+
esEncodedAPIKey: esAPIKey.Encoded,
1404+
enrollParams: enrollParams,
1405+
createdAt: time.Now(),
14281406
}
14291407
}
14301408

0 commit comments

Comments
 (0)