Documentation
¶
Index ¶
- func NewHttpServer(ctx context.Context, cfg Config, testServer *CastAITestServer) error
- type CastAITestServer
- func (c *CastAITestServer) AckAction(ctx context.Context, actionID string, req *castai.AckClusterActionRequest) error
- func (c *CastAITestServer) ExecuteActions(ctx context.Context, actions []castai.ClusterAction)
- func (c *CastAITestServer) GetActions(ctx context.Context, _ string) ([]*castai.ClusterAction, error)
- func (c *CastAITestServer) SendLog(ctx context.Context, e *castai.LogEntry) error
- type Config
- type TestServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHttpServer ¶
func NewHttpServer(ctx context.Context, cfg Config, testServer *CastAITestServer) error
Types ¶
type CastAITestServer ¶
type CastAITestServer struct {
// contains filtered or unexported fields
}
CastAITestServer acts as simple cluster hub mock replacement. It exposes a way to "push" actions to the cluster controller via GetActionsPushChannel and can be used as an implementation of the server interface that cluster controller expects to call.
func NewTestServer ¶
func NewTestServer(logger *slog.Logger, cfg TestServerConfig) *CastAITestServer
func (*CastAITestServer) AckAction ¶
func (c *CastAITestServer) AckAction(ctx context.Context, actionID string, req *castai.AckClusterActionRequest) error
func (*CastAITestServer) ExecuteActions ¶
func (c *CastAITestServer) ExecuteActions(ctx context.Context, actions []castai.ClusterAction)
ExecuteActions pushes the list of actions to the queue for cluster controller to process. This method returns when all actions are acked or context is cancelled.
func (*CastAITestServer) GetActions ¶
func (c *CastAITestServer) GetActions(ctx context.Context, _ string) ([]*castai.ClusterAction, error)
type Config ¶
type Config struct {
// Port where the mock server to listen on.
Port int
// KubeConfig can point to a kubeconfig file. If empty, InCluster client will be assumed.
KubeConfig string
}
Config for the HTTP server.
type TestServerConfig ¶
type TestServerConfig struct {
// MaxActionsPerCall is the upper limit of actions to return in one CastAITestServer.GetActions call.
MaxActionsPerCall int
// TimeoutWaitingForActions controls how long to wait for at least 1 action to appear on server side.
// This mimics CH behavior of not returning early if there are no pending actions and keeping the request "running".
TimeoutWaitingForActions time.Duration
}
TestServerConfig has settings for the mock server instance.
Click to show internal directories.
Click to hide internal directories.