-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Elastic Agent] Add basic protocol to control Elastic Agent. #20146
Changes from 7 commits
66f18b7
97eefef
96a2b4c
da8755c
2779b41
1d1dbbe
4ead497
a1bf65e
206fcdb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// 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. | ||
|
||
syntax = "proto3"; | ||
|
||
package proto; | ||
|
||
option cc_enable_arenas = true; | ||
option go_package = "pkg/agent/control/proto;proto"; | ||
|
||
// Status codes for the current state. | ||
enum Status { | ||
STARTING = 0; | ||
CONFIGURING = 1; | ||
HEALTHY = 2; | ||
DEGRADED = 3; | ||
FAILED = 4; | ||
STOPPING = 5; | ||
UPGRADING = 6; | ||
} | ||
|
||
// Action status codes for restart and upgrade response. | ||
enum ActionStatus { | ||
// Action was successful. | ||
SUCCESS = 0; | ||
// Action failed. | ||
FAILURE = 1; | ||
} | ||
|
||
// Empty message. | ||
message Empty { | ||
} | ||
|
||
// Version response message. | ||
message VersionResponse { | ||
// Current running version. | ||
string version = 1; | ||
// Current running commit. | ||
string commit = 2; | ||
// Current running build time. | ||
string buildTime = 3; | ||
// Current running version is a snapshot. | ||
bool snapshot = 4; | ||
} | ||
|
||
message RestartResponse { | ||
// Response status. | ||
ActionStatus status = 1; | ||
// Error message when it fails to trigger restart. | ||
string error = 2; | ||
} | ||
|
||
// Upgrade request message. | ||
message UpgradeRequest { | ||
// (Optional) Version to upgrade to. | ||
// | ||
// If not provided Elastic Agent will auto discover the latest version in the same major | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this makes sense but i'm worried a bit about sealed env. while it initially might all work without even using default sourceURI as everything is packed. then on upgrade request without version and sourceURI it will fail. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Being that CLI call to upgrade over the socket will return an |
||
// to upgrade to. If wanting to upgrade to a new major that major must be present in the | ||
// this version field. | ||
string version = 1; | ||
|
||
// (Optional) Use a different source URI then configured. | ||
// | ||
// If provided the upgrade process will use the provided sourceURI instead of the configured | ||
// sourceURI in the configuration. | ||
string sourceURI = 2; | ||
} | ||
|
||
// A upgrade response message. | ||
message UpgradeResponse { | ||
// Response status. | ||
ActionStatus status = 1; | ||
|
||
// Version that is being upgraded to. | ||
string version = 2; | ||
|
||
// Error message when it fails to trigger upgrade. | ||
string error = 3; | ||
} | ||
|
||
// Current status of the application in Elastic Agent. | ||
message ApplicationStatus { | ||
// Unique application ID. | ||
string id = 1; | ||
// Application name. | ||
string name = 2; | ||
// Current status. | ||
Status status = 3; | ||
// Current status message. | ||
string message = 4; | ||
// Current status payload. | ||
string payload = 5; | ||
} | ||
|
||
// Status is the current status of Elastic Agent. | ||
message StatusResponse { | ||
// Overall status of Elastic Agent. | ||
Status status = 1; | ||
// Overall status message of Elastic Agent. | ||
string message = 2; | ||
// Status of each application in Elastic Agent. | ||
repeated ApplicationStatus applications = 3; | ||
} | ||
|
||
service ElasticAgent { | ||
// Fetches the currently running version of the Elastic Agent. | ||
rpc Version(Empty) returns (VersionResponse); | ||
|
||
// Fetches the currently status of the Elastic Agent. | ||
rpc Status(Empty) returns (StatusResponse); | ||
|
||
// Restart restarts the current running Elastic Agent. | ||
rpc Restart(Empty) returns (RestartResponse); | ||
|
||
// Upgrade starts the upgrade process of Elastic Agent. | ||
rpc Upgrade(UpgradeRequest) returns (UpgradeResponse); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
related to that can we introduce status for ROLLBACK? which takes place in between UPGRADING and FAILED
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes will add rollback