castai

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func NewRestyClient

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

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

Types

type AKSInitDataRequest

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

type ActionApproveCSR struct {
	NodeName         string `json:"nodeName"`
	NodeID           string `json:"nodeId"`
	AllowAutoApprove *bool  `json:"allowAutoApprove,omitempty"`
}

type ActionChartRollback

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

type ActionChartUninstall

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

type ActionChartUpsert

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"`
	ResetThenReuseValues bool              `json:"resetThenReuseValues,omitempty"`
}

type ActionCheckNodeDeleted

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

type ActionCheckNodeStatus

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

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

type ActionCreate

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

type ActionCreateEvent

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

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

type ActionDeleteNode

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

type ActionDisconnectCluster

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

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

type ActionSendAKSInitData struct{}

type CastAIClient

type CastAIClient 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
}

CastAIClient lists functions used by actions package.

type ChartSource

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

func (*ChartSource) Validate

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

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

func (*Client) SendLog

func (c *Client) SendLog(ctx context.Context, e *logexporter.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

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

func (GroupVersionResource) String

func (r GroupVersionResource) String() string

type LogEvent

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

type NodeTaint

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

type ObjectID

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

Directories

Path Synopsis
Package mock_castai is a generated GoMock package.
Package mock_castai is a generated GoMock package.

Jump to

Keyboard shortcuts

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