comms

package
v1.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

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

View Source
const CONN_TIMEOUT = 5 * time.Second
View Source
const NUM_RETRIES = 3

Variables

This section is empty.

Functions

func WithNetworkDialer

func WithNetworkDialer(serverAddr string) func(*Client)

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

func ConnectToClusterOrch(serverAddr string, tlsConfig *tls.Config) (*Client, error)

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

func NewClient(serverAddr string, tlsConfig *tls.Config, options ...func(*Client)) *Client

NewClient creates grpc client to Cluster Orchestrator southbound API by default it uses tcp network dialer and insecure transport

func (*Client) Connect

func (cli *Client) Connect() (err error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL