Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x](backport #27256) Support endpoint on every platform but centos/redhat 7 on arm #28449

Merged
merged 1 commit into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions x-pack/elastic-agent/pkg/agent/application/info/inject_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ import (
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/errors"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/config"
"github.com/elastic/go-sysinfo"
)

// InjectAgentConfig injects config to a provided configuration.
func InjectAgentConfig(c *config.Config) error {
globalConfig := agentGlobalConfig()
globalConfig, err := agentGlobalConfig()
if err != nil {
return err
}

if err := c.Merge(globalConfig); err != nil {
return errors.New("failed to inject agent global config", err, errors.TypeConfig)
}
Expand All @@ -24,15 +29,26 @@ func InjectAgentConfig(c *config.Config) error {

// agentGlobalConfig gets global config used for resolution of variables inside configuration
// such as ${path.data}.
func agentGlobalConfig() map[string]interface{} {
func agentGlobalConfig() (map[string]interface{}, error) {
hostInfo, err := sysinfo.Host()
if err != nil {
return nil, err
}

return map[string]interface{}{
"path": map[string]interface{}{
"data": paths.Data(),
"config": paths.Config(),
"home": paths.Home(),
"logs": paths.Logs(),
},
"runtime.os": runtime.GOOS,
"runtime.arch": runtime.GOARCH,
}
"runtime.os": runtime.GOOS,
"runtime.arch": runtime.GOARCH,
"runtime.osinfo.type": hostInfo.Info().OS.Type,
"runtime.osinfo.family": hostInfo.Info().OS.Family,
"runtime.osinfo.version": hostInfo.Info().OS.Version,
"runtime.osinfo.major": hostInfo.Info().OS.Major,
"runtime.osinfo.minor": hostInfo.Info().OS.Minor,
"runtime.osinfo.patch": hostInfo.Info().OS.Patch,
}, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (e *Controller) Update(c *config.Config) error {
if err != nil {
return errors.New(err, "could not create the AST from the configuration", errors.TypeConfig)
}

rawAst, err := transpiler.NewAST(m)
if err != nil {
return errors.New(err, "could not create the AST from the configuration", errors.TypeConfig)
Expand Down
2 changes: 1 addition & 1 deletion x-pack/elastic-agent/pkg/agent/program/supported.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x-pack/elastic-agent/spec/endpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ rules:
- revision

when: length(${fleet}) > 0 and length(${inputs}) > 0 and hasKey(${output}, 'elasticsearch')
constraints: ${runtime.arch} != 'arm64'
constraints: ${runtime.arch} != 'arm64' and ${runtime.family} != 'redhat' and ${runtime.major} != '7'