Documentation
¶
Index ¶
- Constants
- Variables
- func CheckpointContainer(ctx context.Context, checkpointId, runcId, runcRoot, address, protocol string) (*daemon.DumpResp, *profiling.Data, error)
- func CheckpointContainerRootfs(ctx context.Context, checkpointId, runcId, namespace, address, protocol string, ...) (*daemon.DumpResp, *profiling.Data, error)
- func FindContainersForReq(req CheckpointPodReq, address, protocol string) ([]*k8s.Container, error)
- type CheckpointInformation
- type CheckpointPodReq
- type EventStream
- type ImageSecret
- type ProfilingInfo
Constants ¶
View Source
const ( MAX_RETRIES = 5 CLIENT_RETRY_PERIOD = time.Second )
Variables ¶
View Source
var HelperCmd = &cobra.Command{ Use: "k8s-helper", Short: "Helper for running in Kubernetes", RunE: func(cmd *cobra.Command, args []string) error { ctx := cmd.Context() restart, _ := cmd.Flags().GetBool("restart") if restart { if err := runScript(ctx, restartScript, true); err != nil { return fmt.Errorf("error restarting: %w", err) } } setupHost, _ := cmd.Flags().GetBool("setup-host") if setupHost { if err := runScript(ctx, setupHostScript, true); err != nil { return fmt.Errorf("error setting up host: %w", err) } } startChroot, _ := cmd.Flags().GetBool("start-chroot") startChroot = startChroot || setupHost return startHelper(ctx, config.Global.Address, config.Global.Protocol) }, }
View Source
var QueryCmd = &cobra.Command{ Use: "k8s", Short: "Query k8s containers", Args: cobra.ArbitraryArgs, RunE: func(cmd *cobra.Command, args []string) error { client, ok := cmd.Context().Value(keys.CLIENT_CONTEXT_KEY).(*client.Client) if !ok { return fmt.Errorf("invalid client in context") } root, _ := cmd.Flags().GetString(runc_flags.RootFlag.Full) namespace, _ := cmd.Flags().GetString(containerd_flags.NamespaceFlag.Full) names, _ := cmd.Flags().GetStringSlice(k8s_flags.NameFlag.Full) sandboxes, _ := cmd.Flags().GetStringSlice(k8s_flags.SandboxFlag.Full) req := &daemon.QueryReq{ Type: "k8s", K8S: &k8s.QueryReq{ Root: root, Namespace: namespace, ContainerNames: names, SandboxNames: sandboxes, }, } resp, err := client.Query(cmd.Context(), req) if err != nil { return err } result := resp.K8S if len(result.Containers) == 0 { fmt.Println("No containers found") return nil } tableWriter := table.NewWriter() tableWriter.SetStyle(style.TableStyle) tableWriter.SetOutputMirror(os.Stdout) tableWriter.AppendHeader(table.Row{ "Sandbox ID", "Sandbox Name", "Sandbox Namespace", "Sandbox UID", "Image", "Container ID", "Bundle", "Root", }) tableWriter.SortBy([]table.SortBy{ {Name: "Sandbox ID", Mode: table.Asc}, }) for _, container := range result.Containers { tableWriter.AppendRow(table.Row{ container.SandboxID, container.SandboxName, container.SandboxNamespace, container.SandboxUID, container.Image, container.Runc.ID, container.Runc.Bundle, container.Runc.Root, }) } tableWriter.Render() if len(resp.Messages) > 0 { fmt.Println() } for _, msg := range resp.Messages { fmt.Println(msg) } return nil }, }
Functions ¶
func CheckpointContainer ¶ added in v0.9.244
func CheckpointContainerRootfs ¶ added in v0.9.254
func FindContainersForReq ¶ added in v0.9.244
func FindContainersForReq(req CheckpointPodReq, address, protocol string) ([]*k8s.Container, error)
Types ¶
type CheckpointInformation ¶ added in v0.9.244
type CheckpointInformation struct {
ActionId string `json:"action_id"`
PodId string `json:"pod_id"`
CheckpointId string `json:"checkpoint_id"`
Status string `json:"status"`
Path string `json:"path"`
Gpu bool `json:"gpu"`
Platform string `json:"platform"`
ProfilingInfo ProfilingInfo `json:"profiling_info"`
}
type CheckpointPodReq ¶ added in v0.9.244
type EventStream ¶ added in v0.9.244
type EventStream struct {
// contains filtered or unexported fields
}
func NewEventStream ¶ added in v0.9.244
func NewEventStream(queueURL string) (*EventStream, error)
func (*EventStream) ConsumeCheckpointRequest ¶ added in v0.9.244
func (es *EventStream) ConsumeCheckpointRequest(address, protocol string) (*rabbitmq.Consumer, error)
func (*EventStream) NewPublisher ¶ added in v0.9.244
func (es *EventStream) NewPublisher() error
func (*EventStream) PublishCheckpointSuccess ¶ added in v0.9.244
func (es *EventStream) PublishCheckpointSuccess(req CheckpointPodReq, pod_id, id string, profiling *profiling.Data, resp *daemon.DumpResp, rootfs bool) error
type ImageSecret ¶ added in v0.9.254
type ImageSecret struct {
ImageSecret string `json:"image_secret"`
ImageSource string `json:"image_source"`
}
func GetImageSecret ¶ added in v0.9.254
func GetImageSecret() (*ImageSecret, error)
type ProfilingInfo ¶ added in v0.9.258
Click to show internal directories.
Click to hide internal directories.