Documentation
¶
Index ¶
- Variables
- func NewRestyClient(config *config.Config, apiURL string, auth auth.Auth) *resty.Client
- func SetVersion(v config.CastwareOperatorVersion)
- type AckActionRequest
- type Action
- type ActionInstall
- type ActionRollback
- type ActionType
- type ActionUninstall
- type ActionUpgrade
- type ApiError
- type CastAIClient
- type Client
- func (c *Client) AckAction(ctx context.Context, clusterID, actionID string, error error) error
- func (c *Client) ExchangeAgentTelemetry(ctx context.Context, clusterID string, req *castai.AgentTelemetryRequest) (*castai.AgentTelemetryResponse, error)
- func (c *Client) GetCluster(ctx context.Context, clusterID string) (*Cluster, error)
- func (c *Client) GetComponentByName(ctx context.Context, name string) (*Component, error)
- func (c *Client) Me(ctx context.Context) (*User, error)
- func (c *Client) PollActions(ctx context.Context, clusterID string) (*PollActionsResponse, error)
- func (c *Client) RecordActionResult(ctx context.Context, clusterID string, req *ComponentActionResult) error
- func (c *Client) RegisterCluster(ctx context.Context, req *castai.RegisterClusterRequest) (*castai.RegisterClusterResponse, error)
- func (c *Client) SendDelta(ctx context.Context, clusterID string, delta *castai.Delta) error
- func (c *Client) SendLogEvent(ctx context.Context, clusterID string, req *castai.IngestAgentLogsRequest) (*castai.IngestAgentLogsResponse, error)
- func (c *Client) ValidateComponentUpgrade(ctx context.Context, req *ValidateComponentUpgradeRequest) (*ValidateComponentUpgradeResponse, error)
- type Cluster
- type Component
- type ComponentActionResult
- type PollActionsResponse
- type Status
- type User
- type ValidateComponentUpgradeRequest
- type ValidateComponentUpgradeResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoApiKey = errors.New("no api key") ErrNotFound = errors.New("not found") )
Functions ¶
func NewRestyClient ¶
NewRestyClient returns a new authenticated rest client to send requests to the specified API.
func SetVersion ¶
func SetVersion(v config.CastwareOperatorVersion)
Types ¶
type AckActionRequest ¶ added in v0.0.6
type AckActionRequest struct {
Error *string `json:"error"`
}
type Action ¶ added in v0.0.6
type Action struct {
// The ID of the action.
Id string `json:"id"`
// Creation date of the action.
CreateTime *time.Time `json:"createTime"`
ActionInstall *ActionInstall `json:"install"`
ActionUpgrade *ActionUpgrade `json:"upgrade"`
ActionRollback *ActionRollback `json:"rollback"`
ActionUninstall *ActionUninstall `json:"uninstall"`
}
type ActionInstall ¶ added in v0.0.6
type ActionInstall struct {
// Version of the component to install, if empty install the latest version.
Version string `json:"version"`
// Name of the component to install.
Component string `json:"component"`
// If true and the component is already installed the operator will attempt to reinstall it.
Upsert bool `json:"upsert"`
// Helm values overrides, use dot notation for nested values.
ValuesOverrides map[string]string `json:"valuesOverrides"`
// If true the component and upsert is true will be upgraded with
// helm flag reset-than-reuse-values instead of reuse-values.
ResetThenReuseValues bool `json:"resetThenReuseValues"`
}
ActionInstall installs a new component on a cluster.
type ActionRollback ¶ added in v0.0.6
type ActionRollback struct {
// Name of the component to rollback.
Component string `json:"component"`
}
ActionRollback rolls back a component to the previously installed version.
type ActionType ¶ added in v0.0.6
type ActionType string
The action that can be performed on a CASTware component.
const ( // An install component action. Action_INSTALL ActionType = "ENABLE" // An upgrade component action. Action_UPGRADE ActionType = "UPDATE" // A delete component action. Action_DELETE ActionType = "DISABLE" // A rollback component action. Action_ROLLBACK ActionType = "ROLLBACK" )
type ActionUninstall ¶ added in v0.0.6
type ActionUninstall struct {
// Name of the component to uninstall.
Component string `json:"component"`
}
ActionUninstall uninstalls a component from a cluster.
type ActionUpgrade ¶ added in v0.0.6
type ActionUpgrade struct {
// Version of the component to upgrade, if empty upgrade to the latest version.
Version string `json:"version"`
// Name of the component to upgrade.
Component string `json:"component"`
// Helm values overrides, use dot notation for nested values.
ValuesOverrides map[string]string `json:"valuesOverrides"`
// If true the component will be upgraded with helm flag reset-than-reuse-values instead of reuse-values.
ResetThenReuseValues bool `json:"resetThenReuseValues"`
}
ActionUpgrade upgrades an existing component on a cluster.
type ApiError ¶
type ApiError struct {
Message string `json:"message"`
FieldViolations []interface{} `json:"fieldViolations"`
}
type CastAIClient ¶
type CastAIClient interface {
castai.Client
Me(ctx context.Context) (*User, error)
GetCluster(ctx context.Context, clusterID string) (*Cluster, error)
GetComponentByName(ctx context.Context, name string) (*Component, error)
RecordActionResult(ctx context.Context, clusterID string, req *ComponentActionResult) error
PollActions(ctx context.Context, clusterID string) (*PollActionsResponse, error)
AckAction(ctx context.Context, clusterID, actionID string, error error) error
ValidateComponentUpgrade(ctx context.Context, req *ValidateComponentUpgradeRequest) (*ValidateComponentUpgradeResponse, error)
}
func NewClient ¶
func NewClient(log logrus.FieldLogger, config *config.Config, rest *resty.Client) CastAIClient
NewClient returns new Client for communicating with Cast AI.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ExchangeAgentTelemetry ¶
func (c *Client) ExchangeAgentTelemetry(ctx context.Context, clusterID string, req *castai.AgentTelemetryRequest) (*castai.AgentTelemetryResponse, error)
ExchangeAgentTelemetry is not supported in castware operator, this function is here only to implement castai.Client interface needed for cluster registration
func (*Client) GetCluster ¶
GetCluster gets a cluster by id.
func (*Client) GetComponentByName ¶
GetComponentByName retrieves a component by its name.
func (*Client) PollActions ¶ added in v0.0.6
func (*Client) RecordActionResult ¶ added in v0.0.6
func (c *Client) RecordActionResult(ctx context.Context, clusterID string, req *ComponentActionResult) error
RecordActionResult recors the results of an action performed on a component.
func (*Client) RegisterCluster ¶
func (c *Client) RegisterCluster(ctx context.Context, req *castai.RegisterClusterRequest) (*castai.RegisterClusterResponse, error)
RegisterCluster registers a new cluster in the mothership and returns a cluster id, if the cluster already exists the id of the existing cluster is returned
func (*Client) SendDelta ¶
SendDelta is not supported in castware operator, this function is here only to implement castai.Client interface needed for cluster registration
func (*Client) SendLogEvent ¶
func (c *Client) SendLogEvent(ctx context.Context, clusterID string, req *castai.IngestAgentLogsRequest) (*castai.IngestAgentLogsResponse, error)
SendLogEvent is not supported in castware operator, this function is here only to implement castai.Client interface needed for cluster registration
func (*Client) ValidateComponentUpgrade ¶ added in v0.0.15
func (c *Client) ValidateComponentUpgrade(ctx context.Context, req *ValidateComponentUpgradeRequest) (*ValidateComponentUpgradeResponse, error)
type Cluster ¶
type Cluster struct {
// The cluster's ID.
Id string `json:"id,omitempty"`
// The name of the external cluster.
Name string `json:"name,omitempty"`
// The cluster's organization ID.
OrganizationId string `json:"organization_id,omitempty"`
// The date when cluster was registered.
CreatedAt *time.Time `json:"created_at,omitempty"`
// Current status of the cluster.
Status string `json:"status,omitempty"`
// The date agent snapshot was last received.
AgentSnapshotReceivedAt *time.Time `json:"agent_snapshot_received_at,omitempty"`
// Agent status.
AgentStatus string `json:"agent_status,omitempty"`
}
type ComponentActionResult ¶ added in v0.0.6
type ComponentActionResult struct {
// The name of the component.
Name string `json:"name,omitempty"`
// The action that has been performed on the component.
Action ActionType `json:"action,omitempty"`
// The current version of the component installed on the cluster.
// An empty string means the component was not installed prior the performing the action.
CurrentVersion string `json:"current_version,omitempty"`
// The version of the component targeted by the action.
// An empty string means the installed component has been deleted while performing the action.
Version string `json:"version,omitempty"`
// The status of the component installed on the cluster.
Status Status `json:"status,omitempty"`
// The list of available images and their versions.
ImageVersions map[string]string `json:"image_versions,omitempty"`
// The Helm release name of the installed component.
ReleaseName string `json:"release_name,omitempty"`
// The verbose details of the outcome.
Message string `json:"message,omitempty"`
}
type PollActionsResponse ¶ added in v0.0.6
type PollActionsResponse struct {
// List of pending actions sorted from the oldest one.
Actions []*Action `json:"actions"`
}
Response message with pending lifecycle actions
type Status ¶ added in v0.0.6
type Status string
The status of an installed CASTware component.
const ( // Unspecified status. Status_STATUS_UNSPECIFIED Status = "STATUS_UNSPECIFIED" // A component which is disconnected. Status_DISCONNECTED Status = "DISCONNECTED" // A component which needs an update. Status_UPDATE_NEEDED Status = "UPDATE_NEEDED" // A component which needs a user action. Status_ACTION_REQUIRED Status = "ACTION_REQUIRED" // A component which has an error. Status_ERROR Status = "ERROR" // A component which has an OK status. Status_OK Status = "OK" // A component which is currently being installed, updated, or deleted. Status_PROGRESSING Status = "PROGRESSING" )