castai

package
v0.41.8 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelNodeID = "provisioner.cast.ai/node-id"
)

Variables

This section is empty.

Functions

func NewDefaultClient

func NewDefaultClient(url, key string, level logrus.Level, binVersion *config.ClusterControllerVersion, defaultTimeout time.Duration) (*resty.Client, error)

NewDefaultClient configures a default instance of the resty.Client used to do HTTP requests.

Types

type AKSInitDataRequest added in v0.9.0

type AKSInitDataRequest struct {
	CloudConfigBase64       string `json:"cloudConfigBase64"`
	ProtectedSettingsBase64 string `json:"protectedSettingsBase64"`
	Architecture            string `json:"architecture"`
}

type AckClusterActionRequest

type AckClusterActionRequest struct {
	Error *string `json:"error"`
}

type ActionApproveCSR added in v0.5.0

type ActionApproveCSR struct {
	NodeName string `json:"nodeName"`
	NodeID   string `json:"nodeId"`
}

type ActionChartRollback added in v0.20.0

type ActionChartRollback struct {
	Namespace   string `json:"namespace"`
	ReleaseName string `json:"releaseName"`
	Version     string `json:"version"`
}

type ActionChartUninstall added in v0.11.0

type ActionChartUninstall struct {
	Namespace   string `json:"namespace"`
	ReleaseName string `json:"releaseName"`
}

type ActionChartUpsert added in v0.6.0

type ActionChartUpsert struct {
	Namespace       string            `json:"namespace"`
	ReleaseName     string            `json:"releaseName"`
	ValuesOverrides map[string]string `json:"valuesOverrides,omitempty"`
	ChartSource     ChartSource       `json:"chartSource"`
	CreateNamespace bool              `json:"createNamespace"`
}

type ActionCheckNodeDeleted added in v0.17.0

type ActionCheckNodeDeleted struct {
	NodeName string `json:"nodeName"`
	NodeID   string `json:"nodeId"`
}

type ActionCheckNodeStatus added in v0.22.0

type ActionCheckNodeStatus struct {
	NodeName           string                       `json:"nodeName"`
	NodeID             string                       `json:"nodeId"`
	NodeStatus         ActionCheckNodeStatus_Status `json:"nodeStatus,omitempty"`
	WaitTimeoutSeconds *int32                       `json:"waitTimeoutSeconds,omitempty"`
}

type ActionCheckNodeStatus_Status added in v0.22.0

type ActionCheckNodeStatus_Status string
const (
	ActionCheckNodeStatus_READY   ActionCheckNodeStatus_Status = "NodeStatus_READY"
	ActionCheckNodeStatus_DELETED ActionCheckNodeStatus_Status = "NodeStatus_DELETED"
)

type ActionCreate added in v0.39.0

type ActionCreate struct {
	GroupVersionResource `json:",inline"`
	Object               map[string]interface{} `json:"object,omitempty"`
}

type ActionCreateEvent added in v0.4.0

type ActionCreateEvent struct {
	Reporter  string             `json:"reportingComponent"`
	ObjectRef v1.ObjectReference `json:"objectReference"`
	EventTime time.Time          `json:"eventTime"`
	EventType string             `json:"eventType"`
	Reason    string             `json:"reason"`
	Action    string             `json:"action"`
	Message   string             `json:"message"`
}

type ActionDelete added in v0.39.0

type ActionDelete struct {
	ID ObjectID `json:"id"`
}

type ActionDeleteNode

type ActionDeleteNode struct {
	NodeName string `json:"nodeName"`
	NodeID   string `json:"nodeId"`
}

type ActionDisconnectCluster added in v0.8.0

type ActionDisconnectCluster struct {
}

type ActionDrainNode

type ActionDrainNode struct {
	NodeName            string `json:"nodeName"`
	NodeID              string `json:"nodeId"`
	DrainTimeoutSeconds int    `json:"drainTimeoutSeconds"`
	Force               bool   `json:"force"`
}

type ActionPatch added in v0.37.0

type ActionPatch struct {
	ID        ObjectID `json:"id"`
	PatchType string   `json:"patchType"`
	Patch     string   `json:"patch"`
}

type ActionPatchNode

type ActionPatchNode struct {
	NodeName      string            `json:"nodeName"`
	NodeID        string            `json:"nodeId"`
	Labels        map[string]string `json:"labels"`
	Taints        []NodeTaint       `json:"taints"`
	Annotations   map[string]string `json:"annotations"`
	Unschedulable *bool             `json:"unschedulable"`
	// Capacity allows advertising extended resources for a Node.
	// More info: https://kubernetes.io/docs/tasks/administer-cluster/extended-resource-node/
	Capacity v1.ResourceList `json:"capacity"`
}

type ActionSendAKSInitData added in v0.9.0

type ActionSendAKSInitData struct {
}

type ActionsClient added in v0.41.8

type ActionsClient interface {
	GetActions(ctx context.Context, k8sVersion string) ([]*ClusterAction, error)
	AckAction(ctx context.Context, actionID string, req *AckClusterActionRequest) error
	SendAKSInitData(ctx context.Context, req *AKSInitDataRequest) error
}

ActionsClient lists functions used by actions package. TODO: move interface into actions package.

type ChartSource added in v0.6.0

type ChartSource struct {
	RepoURL string `json:"repoUrl"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

func (*ChartSource) Validate added in v0.6.0

func (c *ChartSource) Validate() error

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client talks to Cast AI. It can poll and acknowledge actions and also inject logs.

func NewClient

func NewClient(log *logrus.Logger, rest *resty.Client, clusterID string) *Client

NewClient returns new Client for communicating with Cast AI.

func (*Client) AckAction

func (c *Client) AckAction(ctx context.Context, actionID string, req *AckClusterActionRequest) error

func (*Client) GetActions

func (c *Client) GetActions(ctx context.Context, k8sVersion string) ([]*ClusterAction, error)

func (*Client) SendAKSInitData added in v0.9.0

func (c *Client) SendAKSInitData(ctx context.Context, req *AKSInitDataRequest) error

func (*Client) SendLog added in v0.41.8

func (c *Client) SendLog(ctx context.Context, e *logEntry) error

type ClusterAction

type ClusterAction struct {
	ID                      string                   `json:"id"`
	ActionDeleteNode        *ActionDeleteNode        `json:"actionDeleteNode,omitempty"`
	ActionDrainNode         *ActionDrainNode         `json:"actionDrainNode,omitempty"`
	ActionPatchNode         *ActionPatchNode         `json:"actionPatchNode,omitempty"`
	ActionCreateEvent       *ActionCreateEvent       `json:"actionCreateEvent,omitempty"`
	ActionApproveCSR        *ActionApproveCSR        `json:"actionApproveCsr,omitempty"`
	ActionChartUpsert       *ActionChartUpsert       `json:"actionChartUpsert,omitempty"`
	ActionChartUninstall    *ActionChartUninstall    `json:"actionChartUninstall,omitempty"`
	ActionChartRollback     *ActionChartRollback     `json:"actionChartRollback,omitempty"`
	ActionDisconnectCluster *ActionDisconnectCluster `json:"actionDisconnectCluster,omitempty"`
	ActionSendAKSInitData   *ActionSendAKSInitData   `json:"actionSendAksInitData,omitempty"`
	ActionCheckNodeDeleted  *ActionCheckNodeDeleted  `json:"actionCheckNodeDeleted,omitempty"`
	ActionCheckNodeStatus   *ActionCheckNodeStatus   `json:"actionCheckNodeStatus,omitempty"`
	ActionPatch             *ActionPatch             `json:"actionPatch,omitempty"`
	ActionCreate            *ActionCreate            `json:"actionCreate,omitempty"`
	ActionDelete            *ActionDelete            `json:"actionDelete,omitempty"`
	CreatedAt               time.Time                `json:"createdAt"`
	DoneAt                  *time.Time               `json:"doneAt,omitempty"`
	Error                   *string                  `json:"error,omitempty"`
}

func (*ClusterAction) Data

func (c *ClusterAction) Data() interface{}

type GetClusterActionsResponse

type GetClusterActionsResponse struct {
	Items []*ClusterAction `json:"items"`
}

type GroupVersionResource added in v0.39.0

type GroupVersionResource struct {
	Group    string `json:"group"`
	Version  string `json:"version"`
	Resource string `json:"resource"`
}

func (GroupVersionResource) String added in v0.39.0

func (r GroupVersionResource) String() string

type LogEvent added in v0.3.0

type LogEvent struct {
	Level   string        `json:"level"`
	Time    time.Time     `json:"time"`
	Message string        `json:"message"`
	Fields  logrus.Fields `json:"fields"`
}

type LogExporter added in v0.41.8

type LogExporter struct {
	// contains filtered or unexported fields
}

LogExporter hooks into logrus and sends logs to Mothership.

func NewLogExporter added in v0.41.8

func NewLogExporter(logger *logrus.Logger, sender logSender) *LogExporter

NewLogExporter returns new exporter that can be hooked into logrus to inject logs into Cast AI.

func (*LogExporter) Fire added in v0.41.8

func (e *LogExporter) Fire(entry *logrus.Entry) error

Fire called by logrus with log entry that LogExporter sends out.

func (*LogExporter) Levels added in v0.41.8

func (e *LogExporter) Levels() []logrus.Level

Levels lists levels that tell logrus to trigger log injection.

func (*LogExporter) Wait added in v0.41.8

func (e *LogExporter) Wait()

Wait lets all pending log sends to finish.

type NodeTaint

type NodeTaint struct {
	Effect string `json:"effect"`
	Key    string `json:"key"`
	Value  string `json:"value"`
}

type ObjectID added in v0.37.0

type ObjectID struct {
	GroupVersionResource `json:",inline"`
	Namespace            *string `json:"namespace"`
	Name                 string  `json:"name"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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