Documentation
¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) GetContainerInfoFromPod(ctx context.Context, podName string, containerNames []string) ([]ContainerPIDInfo, error)
- func (c *Client) InspectContainer(ctx context.Context, containerID string) (*InspectResponse, error)
- func (c *Client) ListContainers(ctx context.Context, podID string) (*ContainersResponse, error)
- func (c *Client) ListPods(ctx context.Context, nameFilter string) (*PodsResponse, error)
- type ContainerImageRef
- type ContainerInfo
- type ContainerMetadata
- type ContainerMount
- type ContainerPIDInfo
- type ContainerStatus
- type ContainersResponse
- type InspectResponse
- type PodInfo
- type PodMetadata
- type PodsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a high-level interface to the container runtime.
func NewClient ¶
NewClient creates a new CRI client by discovering the runtime socket. The provided context is used for testing the connection to the CRI runtime.
func (*Client) GetContainerInfoFromPod ¶
func (c *Client) GetContainerInfoFromPod(ctx context.Context, podName string, containerNames []string) ([]ContainerPIDInfo, error)
GetContainerInfoFromPod retrieves container information for the specified pod.
func (*Client) InspectContainer ¶
func (c *Client) InspectContainer(ctx context.Context, containerID string) (*InspectResponse, error)
InspectContainer returns detailed information about a specific container.
func (*Client) ListContainers ¶
ListContainers lists containers, optionally filtering by pod ID.
type ContainerImageRef ¶
type ContainerImageRef struct {
Image string `json:"image"`
}
ContainerImageRef contains container image reference.
type ContainerInfo ¶
type ContainerInfo struct {
ID string `json:"id"`
PodID string `json:"podSandboxId"`
Metadata ContainerMetadata `json:"metadata"`
Image ContainerImageRef `json:"image"`
ImageRef string `json:"imageRef"`
State string `json:"state"`
CreatedAt int64 `json:"createdAt"`
Labels map[string]string `json:"labels,omitempty"`
}
ContainerInfo represents a container in the CRI runtime.
type ContainerMetadata ¶
ContainerMetadata contains container metadata.
type ContainerMount ¶
type ContainerMount struct {
ContainerPath string `json:"containerPath"`
HostPath string `json:"hostPath"`
Readonly bool `json:"readonly"`
}
ContainerMount represents a container mount point.
type ContainerPIDInfo ¶
type ContainerPIDInfo struct {
PodName string `json:"podName"`
ContainerName string `json:"containerName"`
ContainerID string `json:"containerID"`
PID int32 `json:"pid"`
Namespace string `json:"namespace"`
}
ContainerPIDInfo represents container information with process ID.
func GetContainerPIDsFromPod ¶
func GetContainerPIDsFromPod(ctx context.Context, podName string, containerNames []string) ([]ContainerPIDInfo, error)
GetContainerPIDsFromPod retrieves container process information for the specified pod. This is the recommended way to get container PIDs for most use cases.
type ContainerStatus ¶
type ContainerStatus struct {
ID string `json:"id"`
Metadata ContainerMetadata `json:"metadata"`
State string `json:"state"`
CreatedAt int64 `json:"createdAt"`
StartedAt int64 `json:"startedAt"`
FinishedAt int64 `json:"finishedAt"`
ExitCode int32 `json:"exitCode"`
Image ContainerImageRef `json:"image"`
ImageRef string `json:"imageRef"`
Reason string `json:"reason"`
Message string `json:"message"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
Mounts []ContainerMount `json:"mounts,omitempty"`
LogPath string `json:"logPath"`
}
ContainerStatus contains container status details.
type ContainersResponse ¶
type ContainersResponse struct {
Containers []ContainerInfo `json:"containers"`
}
ContainersResponse represents the response from crictl ps command.
type InspectResponse ¶
type InspectResponse struct {
Status ContainerStatus `json:"status"`
Info map[string]interface{} `json:"info"`
}
InspectResponse represents the response from crictl inspect command.
type PodInfo ¶
type PodInfo struct {
ID string `json:"id"`
Metadata PodMetadata `json:"metadata"`
State string `json:"state"`
CreatedAt int64 `json:"createdAt"`
Labels map[string]string `json:"labels,omitempty"`
}
PodInfo represents a pod in the CRI runtime.
type PodMetadata ¶
type PodMetadata struct {
Name string `json:"name"`
UID string `json:"uid"`
Namespace string `json:"namespace"`
Attempt uint32 `json:"attempt"`
}
PodMetadata contains pod metadata.
type PodsResponse ¶
type PodsResponse struct {
Items []PodInfo `json:"items"`
}
PodsResponse represents the response from crictl pods command.