Documentation ¶
Index ¶
- Constants
- Variables
- func Retry(logger *zerolog.Logger, description string, fn func() error) error
- type Client
- func (t *Client) Close() error
- func (t *Client) GetConfig(ctx context.Context, request *GetConfigRequest) (*GetConfigResponse, error)
- func (t *Client) HealthCheck() error
- func (t *Client) ListConfigs(ctx context.Context, _ *ListConfigRequest) (*ListConfigResponse, error)
- func (t *Client) MarkForDeletion(ctx context.Context, request *MarkForDeletionRequest) error
- func (t *Client) NextTask(ctx context.Context) (*NextTaskResponse, error)
- func (t *Client) TaskComplete(ctx context.Context, req *TaskCompleteRequest) error
- func (t *Client) TaskUpdate(ctx context.Context, req *TaskUpdateRequest) error
- func (t *Client) UpdateNodePool(ctx context.Context, req *UpdateNodePoolRequest) error
- func (t *Client) UpsertManifest(ctx context.Context, request *UpsertManifestRequest) error
- type ClientAPI
- type CrudAPI
- type GetConfigRequest
- type GetConfigResponse
- type KubernetesContext
- type ListConfigRequest
- type ListConfigResponse
- type Manifest
- type ManifestAPI
- type MarkForDeletionRequest
- type NextTaskResponse
- type StateAPI
- type TaskAPI
- type TaskCompleteRequest
- type TaskUpdateRequest
- type UpdateNodePoolRequest
- type UpsertManifestRequest
Constants ¶
View Source
const TolerateDirtyWrites = 20
TolerateDirtyWrites defines how many dirty writes the client should tolerate before giving up on writing the value to the manager.
Variables ¶
View Source
var ( // ErrVersionMismatch is returned when the requested operation errors out due to a mismatch in the document version. // Two writes using the same document version occurred but this writes failed as the document was modified by the other write. ErrVersionMismatch = errors.New("requested operation failed due to document version mismatch") // ErrNotFound is returned when the requested resource, i.e. Config, cluster, task etc. is not found. ErrNotFound = errors.New("not found") )
View Source
var ErrRetriesExhausted = errors.New("exhausted all retries")
ErrRetriesExhausted is returned when all the TolerateDirtyWrites retries fail due to a dirty write.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetConfig ¶
func (t *Client) GetConfig(ctx context.Context, request *GetConfigRequest) (*GetConfigResponse, error)
func (*Client) HealthCheck ¶
func (*Client) ListConfigs ¶
func (t *Client) ListConfigs(ctx context.Context, _ *ListConfigRequest) (*ListConfigResponse, error)
func (*Client) MarkForDeletion ¶
func (t *Client) MarkForDeletion(ctx context.Context, request *MarkForDeletionRequest) error
func (*Client) TaskComplete ¶
func (t *Client) TaskComplete(ctx context.Context, req *TaskCompleteRequest) error
func (*Client) TaskUpdate ¶
func (t *Client) TaskUpdate(ctx context.Context, req *TaskUpdateRequest) error
func (*Client) UpdateNodePool ¶
func (t *Client) UpdateNodePool(ctx context.Context, req *UpdateNodePoolRequest) error
func (*Client) UpsertManifest ¶
func (t *Client) UpsertManifest(ctx context.Context, request *UpsertManifestRequest) error
type ClientAPI ¶
type ClientAPI interface { io.Closer healthcheck.HealthChecker TaskAPI ManifestAPI CrudAPI StateAPI }
ClientAPI wraps all manager apis into a single interface.
type CrudAPI ¶
type CrudAPI interface { // GetConfig will query the config with the specified name. If the requested // config is not found the ErrNotFound error is returned. GetConfig(ctx context.Context, request *GetConfigRequest) (*GetConfigResponse, error) // ListConfigs will query all the configs the manager handles. ListConfigs(ctx context.Context, request *ListConfigRequest) (*ListConfigResponse, error) }
type GetConfigRequest ¶
type GetConfigRequest struct{ Name string }
type GetConfigResponse ¶
type KubernetesContext ¶
type KubernetesContext struct{ Name, Namespace string }
type ListConfigRequest ¶
type ListConfigRequest struct{}
type ListConfigResponse ¶
type ManifestAPI ¶
type ManifestAPI interface { // UpsertManifest will update the [store.Manifest] and [store.KubernetesContext] of an existing // config or will create a new config (if not present) from the passed in values. // The function will return the ErrVersionMismatch error indicating a Dirty write, // the application code should execute the Read/Update/Write cycle again, to resolve the merge conflicts. UpsertManifest(ctx context.Context, request *UpsertManifestRequest) error // MarkForDeletion will mark the Infrastructure of the specified Config to be deleted. // If the requested config with the specific version is not found the ErrVersionMismatch error is // returned indicating a Dirty write. On a Dirty write the application code should execute // the Read/Update/Write cycle again. If the config is not present an error will be returned // along with other errors. If the requested config for deletion is not found the ErrNotFound error // is returned. MarkForDeletion(ctx context.Context, request *MarkForDeletionRequest) error }
type MarkForDeletionRequest ¶
type MarkForDeletionRequest struct{ Name string }
type NextTaskResponse ¶
type StateAPI ¶
type StateAPI interface { // UpdateNodePool will update the nodepool of a cluster within a config. If during an update a dirty // write occurs the ErrVersionMismatch error is returned. On a dirty write the application code should execute // the Read/Update/Write cycle again. If either one of nodepool, cluster, config is not found the ErrNotFound // error is returned. UpdateNodePool(ctx context.Context, request *UpdateNodePoolRequest) error }
type TaskAPI ¶
type TaskAPI interface { // NextTask will fetch the next task from the queue of tasks available at the Manager service. // If no tasks are available a nil response and a nil error is returned. If at any point an error // occurred an error is returned describing the cause. The API on server performs validation before // and initialization before returning the task, thus the error ErrVersionMismatch will be returned in // case a dirty write occurred on the server side. On the Client it is simply enough to call the // NextTask function again. Once new tasks are scheduled a non-nil response is returned. // If no tasks are scheduled or the Config for which the task was scheduled was deleted in the // meantime, the ErrNotFound error is returned. NextTask(ctx context.Context) (*NextTaskResponse, error) // TaskUpdate will update the state of the cluster within the specified config and version. If the requested config version is not // found the ErrVersionMismatch error is returned indicating a Dirty write. On a dirty write the application code // should execute the Read/Update/Write cycle again. If either the config or the cluster within the config or // the task for which the state should be updated is not found the ErrNotFound error is returned. TaskUpdate(ctx context.Context, request *TaskUpdateRequest) error // TaskComplete will mark the given task as completed either with status "DONE" or "ERROR. Further, it will update // the current state of the cluster within the specified config and version. If the requested config version is not // found the ErrVersionMismatch error is returned indicating a Dirty write. On a dirty write the application code // should execute the Read/Update/Write cycle again. If either the (cluster, config, task) triple is not found the // ErrNotFound error is returned. TaskComplete(ctx context.Context, request *TaskCompleteRequest) error }
type TaskCompleteRequest ¶
type TaskUpdateRequest ¶
type UpdateNodePoolRequest ¶
type UpsertManifestRequest ¶
type UpsertManifestRequest struct { Name string Manifest *Manifest K8sCtx *KubernetesContext }
Click to show internal directories.
Click to hide internal directories.