diff --git a/x-pack/agent/CHANGELOG.asciidoc b/x-pack/agent/CHANGELOG.asciidoc index 804d43e75ad..8347f781cf2 100644 --- a/x-pack/agent/CHANGELOG.asciidoc +++ b/x-pack/agent/CHANGELOG.asciidoc @@ -20,3 +20,4 @@ - Generate index name in a format type-dataset-namespace {pull}16903[16903] - OS agnostic default configuration {pull}17016[17016] - Support for config constraints {pull}17112[17112] +- Display the stability of the agent at enroll and start. {pull}17336[17336] diff --git a/x-pack/agent/pkg/agent/application/application.go b/x-pack/agent/pkg/agent/application/application.go index 9cc2a83c088..d2e3e4f72e5 100644 --- a/x-pack/agent/pkg/agent/application/application.go +++ b/x-pack/agent/pkg/agent/application/application.go @@ -9,6 +9,7 @@ import ( "github.com/elastic/beats/v7/x-pack/agent/pkg/agent/application/info" "github.com/elastic/beats/v7/x-pack/agent/pkg/agent/errors" + "github.com/elastic/beats/v7/x-pack/agent/pkg/agent/warn" "github.com/elastic/beats/v7/x-pack/agent/pkg/config" "github.com/elastic/beats/v7/x-pack/agent/pkg/core/logger" ) @@ -42,6 +43,7 @@ func createApplication( pathConfigFile string, config *config.Config, ) (Application, error) { + warn.LogNotGA(log) log.Info("Detecting execution mode") c := localDefaultConfig() diff --git a/x-pack/agent/pkg/agent/cmd/enroll.go b/x-pack/agent/pkg/agent/cmd/enroll.go index dd2cd71b0ca..d61804e9ba7 100644 --- a/x-pack/agent/pkg/agent/cmd/enroll.go +++ b/x-pack/agent/pkg/agent/cmd/enroll.go @@ -15,6 +15,7 @@ import ( c "github.com/elastic/beats/v7/libbeat/common/cli" "github.com/elastic/beats/v7/x-pack/agent/pkg/agent/application" "github.com/elastic/beats/v7/x-pack/agent/pkg/agent/errors" + "github.com/elastic/beats/v7/x-pack/agent/pkg/agent/warn" "github.com/elastic/beats/v7/x-pack/agent/pkg/cli" "github.com/elastic/beats/v7/x-pack/agent/pkg/config" "github.com/elastic/beats/v7/x-pack/agent/pkg/core/logger" @@ -44,6 +45,8 @@ func newEnrollCommandWithArgs(flags *globalFlags, _ []string, streams *cli.IOStr } func enroll(streams *cli.IOStreams, cmd *cobra.Command, flags *globalFlags, args []string) error { + warn.PrintNotGA(streams.Out) + config, err := config.LoadYAML(flags.PathConfigFile) if err != nil { return errors.New(err, diff --git a/x-pack/agent/pkg/agent/warn/warn.go b/x-pack/agent/pkg/agent/warn/warn.go new file mode 100644 index 00000000000..ddbbc20132c --- /dev/null +++ b/x-pack/agent/pkg/agent/warn/warn.go @@ -0,0 +1,24 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package warn + +import ( + "fmt" + "io" + + "github.com/elastic/beats/v7/x-pack/agent/pkg/core/logger" +) + +const message = "The Elastic Agent is currently in Alpha and should not be used in production" + +// LogNotGA warns the users in the log that the Elastic Agent is not GA. +func LogNotGA(log *logger.Logger) { + log.Info(message) +} + +// PrintNotGA writes to the received writer that the Agent is not GA. +func PrintNotGA(output io.Writer) { + fmt.Fprintln(output, message) +}