Skip to content

Commit

Permalink
[Elastic Agent] Adjust some naming to fleet-server (#25520) (#25528)
Browse files Browse the repository at this point in the history
Updates some of the code comments and error messages to use fleet-server instead of Fleet to be more accurate.

(cherry picked from commit b69056a)

Co-authored-by: Nicolas Ruflin <spam@ruflin.com>
  • Loading branch information
mergify[bot] and ruflin authored May 4, 2021
1 parent 403d542 commit d19bbea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ func (f *fleetGateway) worker() {
case <-f.scheduler.WaitTick():
f.log.Debug("FleetGateway calling Checkin API")

// Execute the checkin call and for any errors returned by the fleet API
// the function will retry to communicate with fleet with an exponential delay and some
// Execute the checkin call and for any errors returned by the fleet-server API
// the function will retry to communicate with fleet-server with an exponential delay and some
// jitter to help better distribute the load from a fleet of agents.
resp, err := f.doExecute()
if err != nil {
Expand Down Expand Up @@ -199,9 +199,10 @@ func (f *fleetGateway) doExecute() (*fleetapi.CheckinResponse, error) {
f.backoff.Reset()
for f.bgContext.Err() == nil {
// TODO: wrap with timeout context
f.log.Debugf("Checking started")
resp, err := f.execute(f.bgContext)
if err != nil {
f.log.Errorf("Could not communicate with Checking API will retry, error: %s", err)
f.log.Errorf("Could not communicate with fleet-server Checking API will retry, error: %s", err)
if !f.backoff.Wait() {
return nil, errors.New(
"execute retry loop was stopped",
Expand Down
6 changes: 3 additions & 3 deletions x-pack/elastic-agent/pkg/fleetapi/checkin_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type CheckinRequest struct {
Metadata *info.ECSMeta `json:"local_metadata,omitempty"`
}

// SerializableEvent is a representation of the event to be send to the Fleet API via the checkin
// SerializableEvent is a representation of the event to be send to the Fleet Server API via the checkin
// endpoint, we are liberal into what we accept to be send you only need a type and be able to be
// serialized into JSON.
type SerializableEvent interface {
Expand Down Expand Up @@ -78,7 +78,7 @@ func NewCheckinCmd(info agentInfo, client client.Sender) *CheckinCmd {
}
}

// Execute enroll the Agent in the Fleet.
// Execute enroll the Agent in the Fleet Server.
func (e *CheckinCmd) Execute(ctx context.Context, r *CheckinRequest) (*CheckinResponse, error) {
if err := r.Validate(); err != nil {
return nil, err
Expand All @@ -95,7 +95,7 @@ func (e *CheckinCmd) Execute(ctx context.Context, r *CheckinRequest) (*CheckinRe
resp, err := e.client.Send(ctx, "POST", cp, nil, nil, bytes.NewBuffer(b))
if err != nil {
return nil, errors.New(err,
"fail to checkin to fleet",
"fail to checkin to fleet-server",
errors.TypeNetwork,
errors.M(errors.MetaKeyURI, cp))
}
Expand Down
6 changes: 3 additions & 3 deletions x-pack/elastic-agent/pkg/fleetapi/enroll_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (p EnrollType) MarshalJSON() ([]byte, error) {
return json.Marshal(v)
}

// EnrollRequest is the data required to enroll the elastic-agent into Fleet.
// EnrollRequest is the data required to enroll the elastic-agent into Fleet Server.
//
// Example:
// POST /api/fleet/agents/enroll
Expand Down Expand Up @@ -167,12 +167,12 @@ func (e *EnrollResponse) Validate() error {
return err
}

// EnrollCmd is the command to be executed to enroll an elastic-agent into Fleet.
// EnrollCmd is the command to be executed to enroll an elastic-agent into Fleet Server.
type EnrollCmd struct {
client client.Sender
}

// Execute enroll the Agent in the Fleet.
// Execute enroll the Agent in the Fleet Server.
func (e *EnrollCmd) Execute(ctx context.Context, r *EnrollRequest) (*EnrollResponse, error) {
const p = "/api/fleet/agents/enroll"
const key = "Authorization"
Expand Down

0 comments on commit d19bbea

Please sign in to comment.