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) MarkNodeForDeletion(ctx context.Context, request *MarkNodeForDeletionRequest) (*MarkNodeForDeletionResponse, error)
- func (t *Client) NodePoolUpdateTargetSize(ctx context.Context, request *NodePoolUpdateTargetSizeRequest) (*NodePoolUpdateTargetSizeResponse, 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 MarkNodeForDeletionRequest
- type MarkNodeForDeletionResponse
- type NodePoolUpdateTargetSizeRequest
- type NodePoolUpdateTargetSizeResponse
- 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) MarkNodeForDeletion ¶ added in v0.10.0
func (t *Client) MarkNodeForDeletion(ctx context.Context, request *MarkNodeForDeletionRequest) (*MarkNodeForDeletionResponse, error)
func (*Client) NodePoolUpdateTargetSize ¶ added in v0.10.0
func (t *Client) NodePoolUpdateTargetSize(ctx context.Context, request *NodePoolUpdateTargetSizeRequest) (*NodePoolUpdateTargetSizeResponse, error)
func (*Client) UpsertManifest ¶
func (t *Client) UpsertManifest(ctx context.Context, request *UpsertManifestRequest) error
type ClientAPI ¶
type ClientAPI interface {
io.Closer
healthcheck.HealthChecker
ManifestAPI
CrudAPI
}
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)
// Marks the node for deletion along with updating the 'count' of the nodepool itself
// if requested.
//
// If the requested nodepool/node/config tuple is not found the [ErrNotFound] error is returned.
//
// If the change couldn't be handled by the Manager the [ErrVersionMismatch] error is returned
// in which case the caller should either retry the operation or abort.
MarkNodeForDeletion(ctx context.Context, request *MarkNodeForDeletionRequest) (*MarkNodeForDeletionResponse, error)
// NodePoolUpdateTargetSize updates the target size of the nodepool.
NodePoolUpdateTargetSize(ctx context.Context, request *NodePoolUpdateTargetSizeRequest) (*NodePoolUpdateTargetSizeResponse, 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 MarkNodeForDeletionRequest ¶ added in v0.10.0
type MarkNodeForDeletionRequest struct {
Config string
Cluster string
NodePool string
Node string
// If set the node will be searched for in this
// specified loadbalanacer. The passed in [Cluster]
// specifies the kuberentes cluster, but loadbalancers
// are attached to the kubernetes cluster thus the search
// requires the kubernetes cluster id but makes the loadbalancer
// id optional.
LoadBalancer *string
// This flag only has effect with autoscaled dynamic nodepools,
// if any other nodepool is detected and this parameter is set
// it will be ignored.
//
// Why only for autoscaled nodepools ?
//
// Dynamic and Static nodepools have a fixed desired capacity that
// does not change until explicitly changed in the InputManifest.
// So even if this Api endpoint would allow to decrease the capacity
// for these nodepools on the next iteration of the reconciliation
// loop it would be overwritten by the desired count and effectively
// result in a Noop.
//
// Autoscaled nodepools work within a range of nodes [Min, Max] and
// works with two counters for nodes, 'count' which is the current number
// of nodes within the nodepool and 'targetSize' which is the Target Size
// within [Min, Max] that the NodePool should have. This parameter is
// externally managed, i.e. the desired state does not come from the
// InputManifest, for autoscaled nodepools and thus is also made
// available via this parameter.
//
// This parameter adjusts the 'targetSize' which will result of downscaling.
ShouldDecrementDesiredCapacity *bool
}
type MarkNodeForDeletionResponse ¶ added in v0.10.0
type MarkNodeForDeletionResponse struct {
// The new desirec capacity of the nodepool.
TargetSize int64
}
type NodePoolUpdateTargetSizeRequest ¶ added in v0.10.0
type NodePoolUpdateTargetSizeRequest struct {
Config string
Cluster string
NodePool string
// If set the node will be searched for in this
// specified loadbalanacer. The passed in [Cluster]
// specifies the kuberentes cluster, but loadbalancers
// are attached to the kubernetes cluster thus the search
// requires the kubernetes cluster id but makes the loadbalancer
// id optional.
LoadBalancer *string
// Specifies the target size of the nodepool.
//
// For Dynamic and static nodepools this request or value
// will be ignored
//
// Why ?
//
// If this request would change the targetSize it would be
// overwritten on the next reconciliation loop by the desired
// state from the InputManifest which would result in a Noop.
//
// Only for autoscaled nodepools this will have an effect, which
// effectively sets the TargetSize within the [Min, Max] range of
// the autoscaled nodepool.
TargetSize int32
}
type NodePoolUpdateTargetSizeResponse ¶ added in v0.10.0
type NodePoolUpdateTargetSizeResponse struct {
// The new update targetSize
TargetSize int32
}
type UpsertManifestRequest ¶
type UpsertManifestRequest struct {
Name string
Manifest *Manifest
K8sCtx *KubernetesContext
}
Click to show internal directories.
Click to hide internal directories.