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

Display the stability status of the Elastic Agent #17336

Merged
merged 2 commits into from
Mar 31, 2020
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
1 change: 1 addition & 0 deletions x-pack/agent/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
2 changes: 2 additions & 0 deletions x-pack/agent/pkg/agent/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -42,6 +43,7 @@ func createApplication(
pathConfigFile string,
config *config.Config,
) (Application, error) {
warn.LogNotGA(log)

log.Info("Detecting execution mode")
c := localDefaultConfig()
Expand Down
3 changes: 3 additions & 0 deletions x-pack/agent/pkg/agent/cmd/enroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
24 changes: 24 additions & 0 deletions x-pack/agent/pkg/agent/warn/warn.go
Original file line number Diff line number Diff line change
@@ -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)
}