Skip to content

Commit a674e2c

Browse files
authored
Merge branch 'main' into otel-v0.120.0
2 parents def9cba + 894ef93 commit a674e2c

File tree

16 files changed

+595
-321
lines changed

16 files changed

+595
-321
lines changed

NOTICE.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,11 +1319,11 @@ SOFTWARE
13191319

13201320
--------------------------------------------------------------------------------
13211321
Dependency : github.com/elastic/elastic-agent-libs
1322-
Version: v0.18.12
1322+
Version: v0.19.0
13231323
Licence type (autodetected): Apache-2.0
13241324
--------------------------------------------------------------------------------
13251325

1326-
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.18.12/LICENSE:
1326+
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.19.0/LICENSE:
13271327

13281328
Apache License
13291329
Version 2.0, January 2004
@@ -2375,11 +2375,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-licenser@v0.
23752375

23762376
--------------------------------------------------------------------------------
23772377
Dependency : github.com/elastic/go-sysinfo
2378-
Version: v1.15.2
2378+
Version: v1.15.3
23792379
Licence type (autodetected): Apache-2.0
23802380
--------------------------------------------------------------------------------
23812381

2382-
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].2/LICENSE.txt:
2382+
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].3/LICENSE.txt:
23832383

23842384

23852385
Apache License
@@ -18507,11 +18507,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1850718507

1850818508
--------------------------------------------------------------------------------
1850918509
Dependency : golang.org/x/net
18510-
Version: v0.37.0
18510+
Version: v0.38.0
1851118511
Licence type (autodetected): BSD-3-Clause
1851218512
--------------------------------------------------------------------------------
1851318513

18514-
Contents of probable licence file $GOMODCACHE/golang.org/x/net@v0.37.0/LICENSE:
18514+
Contents of probable licence file $GOMODCACHE/golang.org/x/net@v0.38.0/LICENSE:
1851518515

1851618516
Copyright 2009 The Go Authors.
1851718517

deploy/helm/elastic-agent/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ The chart built-in [kubernetes integration](https://docs.elastic.co/integrations
8686
| kubernetes.containers.state.enabled | bool | `true` | enable containers state stream (kube-state-metrics) [ref](https://www.elastic.co/guide/en/beats/metricbeat/8.11/metricbeat-metricset-kubernetes-state_container.html) |
8787
| kubernetes.containers.state.vars | object | `{}` | containers state stream vars |
8888
| kubernetes.containers.logs.enabled | bool | `true` | enable containers logs stream [ref](https://www.elastic.co/docs/current/integrations/kubernetes/container-logs) |
89+
| kubernetes.containers.logs.vars | object | `{}` | containers logs stream vars |
8990
| kubernetes.containers.audit_logs.enabled | bool | `false` | enable containers audit logs stream [ref](https://www.elastic.co/docs/current/integrations/kubernetes/audit-logs) |
9091
| kubernetes.pods.metrics.enabled | bool | `true` | enable pods metric stream (kubelet) [ref](https://www.elastic.co/docs/current/integrations/kubernetes/kubelet#pod) |
9192
| kubernetes.pods.metrics.vars | object | `{}` | pod metric stream vars |

deploy/helm/elastic-agent/templates/integrations/_kubernetes/_kubernetes_logs_containers.tpl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ Config input for container logs
2525
prospector.scanner.symlinks: {{ dig "vars" "symlinks" true .Values.kubernetes.containers.logs }}
2626
parsers:
2727
- container:
28-
stream: {{ dig "vars" "stream" "all" .Values.kubernetes.containers.logs }}
29-
format: {{ dig "vars" "format" "auto" .Values.kubernetes.containers.logs }}
30-
{{- with $.Values.kubernetes.containers.logs.additionalParsersConfig }}
28+
stream: {{ dig "vars" "containerParserStream" "all" .Values.kubernetes.containers.logs }}
29+
format: {{ dig "vars" "containerParserFormat" "auto" .Values.kubernetes.containers.logs }}
30+
{{- with (dig "vars" "additionalParsersConfig" list .Values.kubernetes.containers.logs) }}
3131
{{ . | toYaml | nindent 6 }}
3232
{{- end }}
33+
{{- $additionalProcessors := dig "vars" "processors" list $.Values.kubernetes.containers.logs -}}
34+
{{- $builtInProcessors := dig "vars" "enabledDefaultProcessors" true $.Values.kubernetes.containers.logs -}}
35+
{{- if (or $builtInProcessors $additionalProcessors) }}
3336
processors:
37+
{{- with $builtInProcessors }}
3438
- add_fields:
3539
target: kubernetes
3640
fields:
@@ -67,4 +71,9 @@ Config input for container logs
6771
- kubernetes.annotations.elastic_co/preserve_original_event
6872
- regexp:
6973
kubernetes.annotations.elastic_co/preserve_original_event: ^(?i)true$
74+
{{- end }}
75+
{{- with $additionalProcessors }}
76+
{{- . | toYaml | nindent 6 }}
77+
{{- end }}
78+
{{- end }}
7079
{{- end -}}

deploy/helm/elastic-agent/values.schema.json

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,46 @@
225225
"type": "boolean",
226226
"description": "Enable containers logs stream."
227227
},
228-
"additionalParsersConfig": {
229-
"type": "array",
230-
"items": {
231-
"type": "object"
228+
"vars": {
229+
"type": "object",
230+
"description": "Stream variables.",
231+
"properties": {
232+
"enabledDefaultProcessors": {
233+
"type": "boolean",
234+
"description": "Enable container logs stream default processors.",
235+
"default": true
236+
},
237+
"symlinks": {
238+
"type": "boolean",
239+
"description": "Use Symlinks.",
240+
"default": true
241+
},
242+
"additionalParsersConfig": {
243+
"type": "array",
244+
"description": "Additional parsers configuration.",
245+
"items": {
246+
"type": "object"
247+
},
248+
"default": []
249+
},
250+
"containerParserStream": {
251+
"type": "string",
252+
"description": "Container parser's stream configuration.",
253+
"default": "all"
254+
},
255+
"containerParserFormat": {
256+
"type": "string",
257+
"description": "Container parser's format configuration.",
258+
"default": "auto"
259+
},
260+
"processors": {
261+
"type": "array",
262+
"description": "Additional processors to use on the container logs streams. Processors are used to reduce the number of fields in the exported event or to enhance the event with metadata. This executes in the agent before the events are shipped.",
263+
"items": {
264+
"type": "object"
265+
},
266+
"default": []
267+
}
232268
}
233269
}
234270
},

deploy/helm/elastic-agent/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ kubernetes:
147147
# -- enable containers logs stream [ref](https://www.elastic.co/docs/current/integrations/kubernetes/container-logs)
148148
# @section -- 2 - Kubernetes integration
149149
enabled: true
150-
additionalParsersConfig: []
150+
# -- containers logs stream vars
151+
# @section -- 2 - Kubernetes integration
152+
vars: {}
151153
audit_logs:
152154
# -- enable containers audit logs stream [ref](https://www.elastic.co/docs/current/integrations/kubernetes/audit-logs)
153155
# @section -- 2 - Kubernetes integration

dev-tools/mage/checksums.go

Lines changed: 55 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/otiai10/copy"
1616

1717
"github.com/elastic/elastic-agent/dev-tools/mage/manifest"
18+
"github.com/elastic/elastic-agent/dev-tools/packaging"
1819
)
1920

2021
const ComponentSpecFileSuffix = ".spec.yml"
@@ -94,157 +95,76 @@ func ChecksumsWithoutManifest(versionedFlatPath string, versionedDropPath string
9495
}
9596

9697
// This is a helper function for flattenDependencies that's used when building from a manifest
97-
func ChecksumsWithManifest(requiredPackage string, versionedFlatPath string, versionedDropPath string, manifestResponse *manifest.Build) map[string]string {
98+
func ChecksumsWithManifest(platform, dependenciesVersion string, versionedFlatPath string, versionedDropPath string, manifestResponse *manifest.Build) map[string]string {
9899
checksums := make(map[string]string)
99100
if manifestResponse == nil {
100101
return checksums
101102
}
102103

103-
// Iterate over the component projects in the manifest
104-
projects := manifestResponse.Projects
105-
for componentName := range projects {
106-
// Iterate over the individual package files within each component project
107-
for pkgName := range projects[componentName].Packages {
108-
// Only care about packages that match the required package constraint (os/arch)
109-
if strings.Contains(pkgName, requiredPackage) {
110-
// Iterate over the external binaries that we care about for packaging agent
111-
for _, spec := range manifest.ExpectedBinaries {
112-
// If the individual package doesn't match the expected prefix, then continue
113-
// FIXME temporarily skip fips packages until elastic-agent FIPS is in place
114-
if !strings.HasPrefix(pkgName, spec.BinaryName) || strings.Contains(pkgName, "-fips-") {
115-
if mg.Verbose() {
116-
log.Printf(">>>>>>> Package [%s] skipped", pkgName)
117-
}
118-
continue
119-
}
120-
121-
if mg.Verbose() {
122-
log.Printf(">>>>>>> Package [%s] matches requiredPackage [%s]", pkgName, requiredPackage)
123-
}
124-
125-
// Get the version from the component based on the version in the package name
126-
// This is useful in the case where it's an Independent Agent Release, where
127-
// the opted-in projects will be one patch version ahead of the rest of the
128-
// opted-out/previously-released projects
129-
componentVersion := getComponentVersion(componentName, requiredPackage, projects[componentName])
130-
if mg.Verbose() {
131-
log.Printf(">>>>>>> Component [%s]/[%s] version is [%s]", componentName, requiredPackage, componentVersion)
132-
}
133-
134-
// Combine the package name w/ the versioned flat path
135-
fullPath := filepath.Join(versionedFlatPath, pkgName)
136-
137-
// Eliminate the file extensions to get the proper directory
138-
// name that we need to copy
139-
var dirToCopy string
140-
if strings.HasSuffix(fullPath, ".tar.gz") {
141-
dirToCopy = fullPath[:strings.LastIndex(fullPath, ".tar.gz")]
142-
} else if strings.HasSuffix(fullPath, ".zip") {
143-
dirToCopy = fullPath[:strings.LastIndex(fullPath, ".zip")]
144-
} else {
145-
dirToCopy = fullPath
146-
}
147-
if mg.Verbose() {
148-
log.Printf(">>>>>>> Calculated directory to copy: [%s]", dirToCopy)
149-
}
150-
151-
// Set copy options
152-
options := copy.Options{
153-
OnSymlink: func(_ string) copy.SymlinkAction {
154-
return copy.Shallow
155-
},
156-
Sync: true,
157-
}
158-
if mg.Verbose() {
159-
log.Printf("> prepare to copy %s into %s ", dirToCopy, versionedDropPath)
160-
}
161-
162-
// Do the copy
163-
err := copy.Copy(dirToCopy, versionedDropPath, options)
164-
if err != nil {
165-
panic(err)
166-
}
167-
168-
// copy spec file for match
169-
specName := filepath.Base(dirToCopy)
170-
idx := strings.Index(specName, "-"+componentVersion)
171-
if idx != -1 {
172-
specName = specName[:idx]
173-
}
174-
if mg.Verbose() {
175-
log.Printf(">>>> Looking to copy spec file: [%s]", specName)
176-
}
177-
178-
checksum, err := CopyComponentSpecs(specName, versionedDropPath)
179-
if err != nil {
180-
panic(err)
181-
}
182-
183-
checksums[specName+ComponentSpecFileSuffix] = checksum
184-
}
104+
// Iterate over the external binaries that we care about for packaging agent
105+
for _, spec := range packaging.ExpectedBinaries {
106+
107+
if spec.PythonWheel {
108+
if mg.Verbose() {
109+
log.Printf(">>>>>>> Component %s/%s is a Python wheel, skipping", spec.ProjectName, spec.BinaryName)
185110
}
111+
continue
186112
}
187-
}
188113

189-
return checksums
190-
}
114+
if !spec.SupportsPlatform(platform) {
115+
log.Printf(">>>>>>> Component %s/%s does not support platform %s, skipping", spec.ProjectName, spec.BinaryName, platform)
116+
continue
117+
}
191118

192-
// This function is used when building with a Manifest. In that manifest, it's possible
193-
// for projects in an Independent Agent Release to have different versions since the opted-in
194-
// ones will be one patch version higher than the opted-out/previously released projects.
195-
// This function tries to find the versions from the package name
196-
func getComponentVersion(componentName string, requiredPackage string, componentProject manifest.Project) string {
197-
var componentVersion string
198-
var foundIt bool
199-
// Iterate over all the packages in the component project
200-
for pkgName := range componentProject.Packages {
201-
// Only care about the external binaries that we want to package
202-
for _, spec := range manifest.ExpectedBinaries {
203-
// If the given component name doesn't match the external binary component, skip
204-
// FIXME temporarily skip fips packages until elastic-agent FIPS is in place
205-
if componentName != spec.ProjectName || strings.Contains(pkgName, "-fips-") {
206-
continue
119+
manifestPackage, err := manifest.ResolveManifestPackage(manifestResponse.Projects[spec.ProjectName], spec, dependenciesVersion, platform)
120+
if err != nil {
121+
if mg.Verbose() {
122+
log.Printf(">>>>>>> Error resolving package for [%s/%s]", spec.BinaryName, platform)
207123
}
124+
continue
125+
}
208126

209-
// Split the package name on the binary name prefix plus a dash
210-
firstSplit := strings.Split(pkgName, spec.BinaryName+"-")
211-
if len(firstSplit) < 2 {
212-
continue
213-
}
127+
// Combine the package name w/ the versioned flat path
128+
fullPath := filepath.Join(versionedFlatPath, manifestPackage.Name)
129+
130+
// Eliminate the file extensions to get the proper directory
131+
// name that we need to copy
132+
var dirToCopy string
133+
if strings.HasSuffix(fullPath, ".tar.gz") {
134+
dirToCopy = fullPath[:strings.LastIndex(fullPath, ".tar.gz")]
135+
} else if strings.HasSuffix(fullPath, ".zip") {
136+
dirToCopy = fullPath[:strings.LastIndex(fullPath, ".zip")]
137+
} else {
138+
dirToCopy = fullPath
139+
}
140+
if mg.Verbose() {
141+
log.Printf(">>>>>>> Calculated directory to copy: [%s]", dirToCopy)
142+
}
214143

215-
// Get the second part of the first split
216-
secondHalf := firstSplit[1]
217-
if len(secondHalf) < 2 {
218-
continue
219-
}
144+
// Set copy options
145+
options := copy.Options{
146+
OnSymlink: func(_ string) copy.SymlinkAction {
147+
return copy.Shallow
148+
},
149+
Sync: true,
150+
}
151+
if mg.Verbose() {
152+
log.Printf("> prepare to copy %s into %s ", dirToCopy, versionedDropPath)
153+
}
220154

221-
// Make sure the second half matches the required package
222-
if strings.Contains(secondHalf, requiredPackage) {
223-
// ignore packages with names where this splitting doesn't results in proper version
224-
if strings.Contains(secondHalf, "docker-image") {
225-
continue
226-
}
227-
if strings.Contains(secondHalf, "oss-") {
228-
continue
229-
}
230-
231-
// The component version should be the first entry after splitting w/ the requiredPackage
232-
componentVersion = strings.Split(secondHalf, "-"+requiredPackage)[0]
233-
foundIt = true
234-
// break out of inner loop
235-
break
236-
}
155+
// Do the copy
156+
err = copy.Copy(dirToCopy, versionedDropPath, options)
157+
if err != nil {
158+
panic(err)
237159
}
238-
if foundIt {
239-
// break out of outer loop
240-
break
160+
161+
checksum, err := CopyComponentSpecs(spec.BinaryName, versionedDropPath)
162+
if err != nil {
163+
panic(err)
241164
}
242-
}
243165

244-
if componentVersion == "" {
245-
errMsg := fmt.Sprintf("Unable to determine component version for [%s]", componentName)
246-
panic(errMsg)
166+
checksums[spec.BinaryName+ComponentSpecFileSuffix] = checksum
247167
}
248168

249-
return componentVersion
169+
return checksums
250170
}

0 commit comments

Comments
 (0)