-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[k8s] embed hints inputs in agent container image (#6381)
* feat: embed hints inputs in elastic-agent container image * chore: disable lint overflow warnings (cherry picked from commit a631362) # Conflicts: # deploy/helm/elastic-agent/examples/kubernetes-hints-autodiscover/rendered/manifest.yaml # deploy/helm/elastic-agent/examples/multiple-integrations/rendered/manifest.yaml
- Loading branch information
1 parent
21a3846
commit 46f64cd
Showing
12 changed files
with
180 additions
and
58 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
changelog/fragments/1734512365-embed-hints-inputs-in-agent-container-image.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Kind can be one of: | ||
# - breaking-change: a change to previously-documented behavior | ||
# - deprecation: functionality that is being removed in a later release | ||
# - bug-fix: fixes a problem in a previous version | ||
# - enhancement: extends functionality but does not break or fix existing behavior | ||
# - feature: new functionality | ||
# - known-issue: problems that we are aware of in a given version | ||
# - security: impacts on the security of a product or a user’s deployment. | ||
# - upgrade: important information for someone upgrading from a prior version | ||
# - other: does not fit into any of the other categories | ||
kind: enhancement | ||
|
||
# Change summary; a 80ish characters long description of the change. | ||
summary: Embed hints-based inputs in the Elastic Agent container image. | ||
|
||
# Long description; in case the summary is not enough to describe the change | ||
# this field accommodates a description without length limits. | ||
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment. | ||
description: This change includes the addition of hints-based inputs directly within the Elastic Agent container image, enabling streamlined configurations for input discovery when deployed in containerized environments. | ||
|
||
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc. | ||
component: elastic-agent | ||
|
||
# PR URL; optional; the PR number that added the changeset. | ||
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added. | ||
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number. | ||
# Please provide it if you are adding a fragment for a different PR. | ||
pr: https://github.com/elastic/elastic-agent/pull/6381 | ||
|
||
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of). | ||
# If not present is automatically filled by the tooling with the issue linked to the PR number. | ||
issue: https://github.com/elastic/elastic-agent/issues/5661 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
deploy/helm/elastic-agent/templates/integrations/_kubernetes/_kubernetes_hints.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
{{- define "elasticagent.kubernetes.config.hints.init" -}} | ||
{{- if eq $.Values.kubernetes.hints.enabled true -}} | ||
{{- $preset := $.Values.agent.presets.perNode -}} | ||
{{- include "elasticagent.preset.applyOnce" (list $ $preset "elasticagent.kubernetes.pernode.preset") -}} | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
internal/pkg/composable/providers/kubernetes/config_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License 2.0; | ||
// you may not use this file except in compliance with the Elastic License 2.0. | ||
|
||
package kubernetes | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/elastic/elastic-agent/internal/pkg/config" | ||
"github.com/elastic/elastic-agent/pkg/core/logger" | ||
) | ||
|
||
func TestGetHintsInputConfigPath(t *testing.T) { | ||
|
||
log, err := logger.New("loader_test", true) | ||
require.NoError(t, err, "failed to create logger ", err) | ||
|
||
for _, tc := range []struct { | ||
name string | ||
cfg map[string]any | ||
expectedPath string | ||
}{ | ||
{ | ||
name: "fully composite yaml key", | ||
cfg: map[string]any{ | ||
"providers.kubernetes.hints.enabled": true, | ||
}, | ||
expectedPath: hintsInputsPathPattern, | ||
}, | ||
{ | ||
name: "partially composite yaml key", | ||
cfg: map[string]any{ | ||
"providers.kubernetes": map[string]any{ | ||
"hints.enabled": false, | ||
}, | ||
}, | ||
expectedPath: "", | ||
}, | ||
{ | ||
name: "normal yaml key", | ||
cfg: map[string]any{ | ||
"providers": map[string]any{ | ||
"kubernetes": map[string]any{ | ||
"hints": map[string]any{ | ||
"enabled": true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
expectedPath: hintsInputsPathPattern, | ||
}, | ||
{ | ||
name: "hints enabled no bool", | ||
cfg: map[string]any{ | ||
"providers": map[string]any{ | ||
"kubernetes": map[string]any{ | ||
"hints": map[string]any{ | ||
"enabled": "true", | ||
}, | ||
}, | ||
}, | ||
}, | ||
expectedPath: "", | ||
}, | ||
} { | ||
t.Run(tc.name, func(t *testing.T) { | ||
cfg, err := config.NewConfigFrom(tc.cfg) | ||
require.NoError(t, err) | ||
|
||
mapCfg, err := cfg.ToMapStr() | ||
require.NoError(t, err) | ||
|
||
require.Equal(t, tc.expectedPath, GetHintsInputConfigPath(log, mapCfg)) | ||
}) | ||
} | ||
|
||
} |
Oops, something went wrong.