Documentation
¶
Overview ¶
Package containerd tracks the current containerd status.
Index ¶
- Constants
- func CheckCRIORunning(ctx context.Context) bool
- func CheckContainerdInstalled() bool
- func CheckContainerdRunning(ctx context.Context) bool
- func CheckContainerdRunningAt(ctx context.Context, endpoint string) bool
- func CheckServiceActiveWithCommand(ctx context.Context, command string) (bool, error)
- func CheckSocketExists() bool
- func GetVersion(ctx context.Context, endpoint string) (string, error)
- func GetVersionFromCli(ctx context.Context) (string, error)
- func IsErrUnimplemented(err error) bool
- func New(gpudInstance *components.GPUdInstance) (components.Component, error)
- type PodSandbox
- type PodSandboxContainerStatus
Constants ¶
const ( // DefaultContainerRuntimeEndpoint is the default CRI socket for containerd. DefaultContainerRuntimeEndpoint = configcommon.DefaultContainerdEndpoint // DefaultCRIOEndpoint is the default CRI socket for CRI-O, which is also // the endpoint kubelet uses for CRI-O runtimes. Uses /run (not /var/run) to // match the containerd convention above and the DaemonSet's hostPath mount; // on the host /var/run is a symlink to /run. DefaultCRIOEndpoint = "unix:///run/crio/crio.sock" )
const (
Name = "containerd"
)
Name is the ID of the containerd component.
Variables ¶
This section is empty.
Functions ¶
func CheckCRIORunning ¶ added in v0.13.0
CheckCRIORunning reports whether CRI-O answers a real CRI connection on its default endpoint.
The containerd component uses this to tell "containerd socket missing because CRI-O runs the node" (expected, healthy) apart from "containerd socket missing on a containerd node" (a real failure). It dials instead of doing a bare os.Stat so that a stale socket left behind by a crashed CRI-O cannot make a containerd node look like a CRI-O node and mask a genuine containerd outage.
func CheckContainerdInstalled ¶ added in v0.9.0
func CheckContainerdInstalled() bool
CheckContainerdInstalled returns true if the containerd binary is available in PATH.
func CheckContainerdRunning ¶ added in v0.9.0
CheckContainerdRunning reports whether containerd is reachable via its default CRI endpoint.
func CheckContainerdRunningAt ¶ added in v0.13.0
CheckContainerdRunningAt probes only the selected endpoint; no runtime fallback.
func CheckServiceActiveWithCommand ¶ added in v0.12.2
CheckServiceActiveWithCommand runs the given command and reports whether the containerd service is active based on its exit code (0 = active). It overrides the default in-namespace systemd.IsActive check, e.g. by wrapping "systemctl is-active containerd" with nsenter so the check queries the host's service manager from inside a container. A non-zero exit means "not active" (not an error); only a failure to execute the command itself returns an error.
func CheckSocketExists ¶ added in v0.9.0
func CheckSocketExists() bool
CheckSocketExists reports whether the default containerd socket exists.
func GetVersion ¶ added in v0.9.0
GetVersion gets the version of the containerd runtime.
func GetVersionFromCli ¶ added in v0.9.0
GetVersionFromCli reads the containerd version from the command "containerd --version". e.g., "containerd containerd.io 1.7.25 bcc810d6b9066471b0b6fa75f557a15a1cbf31bb"
func IsErrUnimplemented ¶ added in v0.9.0
IsErrUnimplemented checks if the error is due to the unimplemented service. e.g., rpc error: code = Unimplemented desc = unknown service runtime.v1.RuntimeService
func New ¶
func New(gpudInstance *components.GPUdInstance) (components.Component, error)
New creates a containerd component.
Types ¶
type PodSandbox ¶ added in v0.9.0
type PodSandbox struct {
// RuntimeHandler is the resolved CRI handler, not the Kubernetes RuntimeClass name.
RuntimeHandler string `json:"runtime_handler,omitempty"`
ID string `json:"id,omitempty"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name,omitempty"`
// Creation time of the container in nanoseconds.
CreatedAt int64 `json:"created_at,omitempty"`
// State of the PodSandbox.
// e.g., "SANDBOX_READY" or "SANDBOX_NOTREADY".
// ref. https://pkg.go.dev/k8s.io/cri-api/pkg/apis/runtime/v1#PodSandboxState
State string `json:"state,omitempty"`
Containers []PodSandboxContainerStatus `json:"containers,omitempty"`
}
PodSandbox represents the pod information fetched from the local container runtime. Simplified version of k8s.io/cri-api/pkg/apis/runtime/v1.PodSandbox. ref. https://pkg.go.dev/k8s.io/cri-api/pkg/apis/runtime/v1#ListPodSandboxResponse
func ListAllSandboxes ¶ added in v0.9.0
func ListAllSandboxes(ctx context.Context, endpoint string) ([]PodSandbox, error)
ListAllSandboxes lists all sandboxes from the containerd runtime.
type PodSandboxContainerStatus ¶ added in v0.9.0
type PodSandboxContainerStatus struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Image string `json:"image,omitempty"`
// Creation time of the container in nanoseconds.
CreatedAt int64 `json:"created_at,omitempty"`
// State of the container.
// e.g., "CONTAINER_CREATED", "CONTAINER_RUNNING", "CONTAINER_EXITED", "CONTAINER_UNKNOWN".
// ref. https://pkg.go.dev/k8s.io/cri-api/pkg/apis/runtime/v1#ContainerState
State string `json:"state,omitempty"`
}
PodSandboxContainerStatus is the simplified CRI container status attached to a sandbox. ref. https://pkg.go.dev/k8s.io/cri-api/pkg/apis/runtime/v1#ContainerStatus