Documentation ¶
Index ¶
- Constants
- func FromAlertManager(ctx context.Context, cluster ops.Site) ([]*models.GettableAlert, error)
- func PrintEvent(w io.Writer, event *pb.TimelineEvent)
- func SetExtensionFunc(f NewExtensionFunc)
- func Timeline(ctx context.Context) (*pb.TimelineResponse, error)
- func WaitCluster(ctx context.Context, operator ops.Operator) error
- func WaitController(ctx context.Context, client *http.Client) error
- func WaitForAgent(ctx context.Context) error
- func WaitForNodeHealthy(ctx context.Context) (err error)
- type Agent
- type ApplicationEndpoints
- type ApplicationsEndpoints
- type Cluster
- type ClusterEndpoints
- type ClusterOperation
- type ClusterOperationProgress
- type ClusterServer
- type Endpoints
- type Extension
- type NewExtensionFunc
- type Status
- type SystemStatus
Constants ¶
const ( // NodeHealthy is the status of a healthy node NodeHealthy = "healthy" // NodeOffline is the status of an unreachable/unavailable node NodeOffline = "offline" // NodeDegraded is the status of a node with failed probes NodeDegraded = "degraded" )
Variables ¶
This section is empty.
Functions ¶
func FromAlertManager ¶
FromAlertManager collects alerts from the prometheus alertmanager deployed to the cluster
func PrintEvent ¶
func PrintEvent(w io.Writer, event *pb.TimelineEvent)
PrintEvent prints the event to the provided writer.
func SetExtensionFunc ¶
func SetExtensionFunc(f NewExtensionFunc)
SetExtensionFunc sets the status collector extension
func Timeline ¶
func Timeline(ctx context.Context) (*pb.TimelineResponse, error)
Timeline queries the currently stored cluster timeline.
func WaitCluster ¶
WaitCluster blocks until the local cluster is healthy or until the context expires.
func WaitController ¶
WaitController blocks until either the cluster controller reports healthy or the specified context expires
func WaitForAgent ¶
WaitForAgent blocks until able to retrieve status from planet-agent on local node (ignoring the result)
func WaitForNodeHealthy ¶
WaitForNodeHealthy blocks until receiving a healthy status from planet-agent on local node
Types ¶
type Agent ¶
type Agent struct { // SystemStatus defines the health status of the whole cluster SystemStatus SystemStatus `json:"system_status"` // Nodes lists status of each individual cluster node Nodes []ClusterServer `json:"nodes"` }
Agent specifies the status of the system and individual nodes
func FromLocalPlanetAgent ¶
FromLocalPlanetAgent collects the node status from the local planet agent
func FromPlanetAgent ¶
FromPlanetAgent collects the cluster status from the planet agent
func (Agent) GetSystemStatus ¶
func (r Agent) GetSystemStatus() pb.SystemStatus_Type
GetSystemStatus returns the status of the system
type ApplicationEndpoints ¶
type ApplicationEndpoints struct { // Application is the application locator. Application loc.Locator `json:"application"` // Endpoints is a list of application endpoints. Endpoints []ops.Endpoint `json:"endpoints"` }
ApplicationEndpoints contains endpoints for a single application.
type ApplicationsEndpoints ¶
type ApplicationsEndpoints struct { // Endpoints lists the endpoints of all applications Endpoints []ApplicationEndpoints `json:"endpoints,omitempty"` // Error indicates whether there was an error fetching endpoints Error error `json:"-"` }
ApplicationsEndpoints contains endpoints for multiple applications.
type Cluster ¶
type Cluster struct { // App references the installed application App loc.Locator `json:"application"` // State describes the cluster state State string `json:"state"` // Reason specifies the reason for the state Reason storage.Reason `json:"reason,omitempty"` // Domain provides the name of the cluster domain Domain string `json:"domain"` // CloudProvider has the name of the provider CloudProvider string `json:"cloud_provider,omitempty"` // Token specifies the provisioning token used for joining nodes to cluster if any Token storage.ProvisioningToken `json:"token"` // Operation describes a cluster operation. // This can either refer to the last completed or a specific operation Operation *ClusterOperation `json:"operation,omitempty"` // ActiveOperations is a list of operations currently active in the cluster ActiveOperations []*ClusterOperation `json:"active_operations,omitempty"` // Endpoints contains cluster and application endpoints. Endpoints Endpoints `json:"endpoints"` // Extension is a cluster status extension Extension `json:"inline,omitempty"` // ServerVersion is version of the server the operator is talking to. ServerVersion *proto.Version `json:"server_version,omitempty"` // ClientVersion is version of the binary collecting the status. ClientVersion proto.Version `json:"client_version"` }
Cluster encapsulates collected cluster status information
type ClusterEndpoints ¶
type ClusterEndpoints struct { // AuthGateway contains addresses that users should specify via --proxy // flag to tsh commands (essentially, address of gravity-site service) AuthGateway []string `json:"auth_gateway,omitempty"` // UI contains URLs of the cluster control panel. UI []string `json:"ui,omitempty"` }
ClusterEndpoints describes cluster system endpoints.
type ClusterOperation ¶
type ClusterOperation struct { // Type of the operation Type string `json:"type"` // ID of the operation ID string `json:"id"` // State of the operation (completed, in progress, failed etc) State string `json:"state"` // Created specifies the time the operation was created Created time.Time `json:"created"` // Description is the human friendly operation description Description string `json:"description"` // Progress describes the progress of an operation Progress ClusterOperationProgress `json:"progress"` // contains filtered or unexported fields }
ClusterOperation describes a cluster operation. This can either refer to the last or a specific operation
func (ClusterOperation) Key ¶
func (r ClusterOperation) Key() ops.SiteOperationKey
Key returns key structure that identifies this operation
type ClusterOperationProgress ¶
type ClusterOperationProgress struct { // Message provides the free text associated with this entry Message string `json:"message"` // Completion specifies the progress value in percent (0..100) Completion int `json:"completion"` // Created specifies the time the progress entry was created Created time.Time `json:"created"` }
ClusterOperationProgress describes the progress of an operation
func (ClusterOperationProgress) IsCompleted ¶
func (r ClusterOperationProgress) IsCompleted() bool
IsCompleted returns whether this progress entry identifies a completed (successful or failed) operation
type ClusterServer ¶
type ClusterServer struct { // Hostname provides the node's hostname Hostname string `json:"hostname"` // AdvertiseIP specifies the advertise IP address AdvertiseIP string `json:"advertise_ip"` // Role is the node's cluster service role (master or regular) Role string `json:"role"` // Profile is the node's profile name from application manifest Profile string `json:"profile"` // Status describes the node's status Status string `json:"status"` // SELinux indicates whether the SELinux support is on on the node SELinux *bool `json:"selinux,omitempty"` // FailedProbes lists all failed probes if the node is not healthy FailedProbes []string `json:"failed_probes,omitempty"` // WarnProbes lists all warning probes WarnProbes []string `json:"warn_probes,omitempty"` // TeleportNode contains information about Teleport node running on this server TeleportNode *ops.Node `json:"teleport_node,omitempty"` // InstanceID is the node cloud specific instance ID InstanceID string `json:"instance_id,omitempty"` // InstanceType is the node cloud specific instance Type InstanceType string `json:"instance_type,omitempty"` }
ClusterServer describes the status of the cluster node
type Endpoints ¶
type Endpoints struct { // Applications contains endpoints for installed applications. Applications ApplicationsEndpoints `json:"applications,omitempty"` // Cluster contains system cluster endpoints. Cluster ClusterEndpoints `json:"cluster"` }
Endpoints contains information about cluster and application endpoints.
type Extension ¶
type Extension interface { // Collect collects extended cluster status information Collect(context.Context) error // WriterTo allows to write extended cluster status into provided writer io.WriterTo }
Extension defines an interface for the cluster status extension
type NewExtensionFunc ¶
type NewExtensionFunc func() Extension
NewExtensionFunc defines a function that returns a new instance of a status extension
type Status ¶
type Status struct { // Cluster describes the operational status of the cluster *Cluster `json:",inline,omitempty"` // Agent describes the status of the system and individual nodes *Agent `json:",inline,omitempty"` // Alerts is a list of alerts collected by prometheus alertmanager Alerts []*models.GettableAlert `json:"alerts,omitempty"` }
Status describes the status of the cluster as a whole
func FromCluster ¶
func FromCluster(ctx context.Context, operator ops.Operator, cluster ops.Site, operationID string) (status *Status, err error)
FromCluster collects cluster status information. The function returns the partial status if not all details can be collected
func (Status) IsDegraded ¶
IsDegraded returns whether the cluster is in degraded state
type SystemStatus ¶
type SystemStatus pb.SystemStatus_Type
SystemStatus is an alias for system status type
func (SystemStatus) GoString ¶
func (r SystemStatus) GoString() string
GoString returns a textual representation of this system status
func (SystemStatus) String ¶
func (r SystemStatus) String() string
String returns a textual representation of this system status