Documentation
¶
Overview ¶
package comms provides communication with Cluster Orchestrator via its southbound gRPC API. The Cluster Agent will be a GRPC client and it uses a protobuf interfaces for the messages: It sends RegisterClusterRequest message to the server. It receives RegisterClusterResponse message That contains RegisterClusterCommand. After a seccussful connection the function will execute the requested command.
In case of any failure the code will print the relevant error.
Index ¶
Constants ¶
const CONN_TIMEOUT = 5 * time.Second
const NUM_RETRIES = 3
Variables ¶
This section is empty.
Functions ¶
func WithNetworkDialer ¶
Helper function for dailing to the server.
Types ¶
type Client ¶
type Client struct {
ServerAddr string
Dialer grpc.DialOption
Transport grpc.DialOption
GrpcConn *grpc.ClientConn
CoSouthboundClient proto.ClusterOrchestratorSouthboundClient
RegisterToClusterOrch func(ctx context.Context, guid string) (installCmd, uninstallCmd string)
}
func ConnectToClusterOrch ¶
ConnectToClusterOrch function uses comms API's and the Cluster Orchestrator cluster address to connect with GRPC the Cluster Orchestrator server. The function will return the Client struct In case of error the function will print the error message, will sleep for some period time and will try again infnit.
func NewClient ¶
NewClient creates grpc client to Cluster Orchestrator southbound API by default it uses tcp network dialer and insecure transport
func (*Client) Connect ¶
FIXME: SA1019: grpc.Dial is deprecated: use NewClient instead. Connect client method establishes GRPC connection with a Cluster Orchestrator Server. In case of an error the function will return the error.
func (*Client) Register ¶
func (cli *Client) Register(ctx context.Context, nodeAuthToken string) (*proto.RegisterClusterResponse, error)
Register client method sends RegisterClusterRequest message to the server. It receives RegisterClusterResponse message That contains RegisterClusterCommand. In case of an error the function will return the error.
func (*Client) UpdateClusterStatus ¶
func (cli *Client) UpdateClusterStatus(ctx context.Context, state string, nodeAuthToken string) (*proto.UpdateClusterStatusResponse, error)
UpdateClusterStatus client method sends UpdateClusterStatusRequest message to the server. It receives UpdateClusterStatusResponse message The message contain enum value - with the stage status of the cluster agent. In case of an error the function will return the error.