Documentation ¶
Index ¶
- Constants
- type ContainerParams
- type ContainersClient
- type DockerClient
- func (c *DockerClient) AttachToContainer(ctx context.Context, namespace, name, containerName string, ...) (err error)
- func (c *DockerClient) CreateContainer(ctx context.Context, params ContainerParams) (err error)
- func (c *DockerClient) ExecInContainer(ctx context.Context, namespace, name, containerName string, cmd []string, ...) (err error)
- func (c *DockerClient) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, ...) (in io.ReadCloser, err error)
- func (c *DockerClient) GetContainers(ctx context.Context, podNs, podName string) (containers []resource.Container, err error)
- func (c *DockerClient) GetContainersListResult(ctx context.Context) (map[k8stypes.NamespacedName][]resource.Container, error)
- func (c *DockerClient) IsContainerPresent(ctx context.Context, podNs, podName, containerName string) bool
- func (c *DockerClient) RemoveContainers(ctx context.Context, podNs, podName string, gracePeriod int64) (err error)
- type MacOSClient
- func (c *MacOSClient) CreateVirtualMachine(ctx context.Context, params VirtualMachineParams) (err error)
- func (c *MacOSClient) DeleteVirtualMachine(ctx context.Context, namespace string, name string, gracePeriod int64) (err error)
- func (c *MacOSClient) ExecInVirtualMachine(ctx context.Context, namespace, name string, cmd []string, attach api.AttachIO) (err error)
- func (c *MacOSClient) GetVirtualMachine(ctx context.Context, namespace string, name string) (i resource.MacOSVirtualMachine, err error)
- func (c *MacOSClient) GetVirtualMachineListResult(ctx context.Context) (map[types.NamespacedName]resource.MacOSVirtualMachine, error)
- type VirtualMachineParams
Constants ¶
const ( // ContainerNamePrefix is the prefix for container names that helps us identify containers managed by the virtual-kubelet. ContainerNamePrefix = "macos-vz" DefaultMinRetryDelay = 2 * time.Second // Default minimum delay between retries. DefaultMaxDelay = 60 * time.Second // Default maximum delay between retries. DefaultMaxAttempts = 5 // Default maximum number of retry attempts. DefaultFactor = 1.6 // Default factor to increase the delay between retries. DefaultJitter = 0.2 // Default jitter to add to delays. )
const ( // MaxVirtualMachines is the maximum number of virtual machines that can be created. // This is a kernel level limitation by Apple and is enforced within Virtualization.framework. MaxVirtualMachines = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerParams ¶
type ContainerParams struct {
PodNamespace, PodName string
Name string
Image string
ImagePullPolicy corev1.PullPolicy
Mounts []volumes.Mount
Env []corev1.EnvVar
Command []string
Args []string
WorkingDir string
TTY bool
Stdin bool
StdinOnce bool
PostStartAction *resource.ExecAction
}
ContainerParams is a struct that contains the parameters needed to create a container.
type ContainersClient ¶
type ContainersClient interface { CreateContainer(ctx context.Context, params ContainerParams) error RemoveContainers(ctx context.Context, podNs, podName string, gracePeriod int64) error GetContainers(ctx context.Context, podNs, podName string) ([]resource.Container, error) GetContainersListResult(ctx context.Context) (map[types.NamespacedName][]resource.Container, error) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, opts api.ContainerLogOpts) (io.ReadCloser, error) ExecInContainer(ctx context.Context, namespace, name, containerName string, cmd []string, attach api.AttachIO) error AttachToContainer(ctx context.Context, namespace, name, containerName string, attach api.AttachIO) error IsContainerPresent(ctx context.Context, podNs, podName, containerName string) bool }
ContainersClient is an interface that defines the methods that a ContainersClient implementation should provide. In the future, we may evaluate using containerd through colima or similar instead of the heavy docker client library.
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
DockerClient manages Docker containers for pods.
func NewDockerClient ¶
func NewDockerClient(ctx context.Context, client *dockercl.Client, eventRecorder event.EventRecorder) (c *DockerClient, err error)
NewDockerClient initializes a new ContainerClient for docker containers.
func (*DockerClient) AttachToContainer ¶
func (c *DockerClient) AttachToContainer(ctx context.Context, namespace, name, containerName string, attach api.AttachIO) (err error)
AttachToContainer attaches to a specific container of a pod.
func (*DockerClient) CreateContainer ¶
func (c *DockerClient) CreateContainer(ctx context.Context, params ContainerParams) (err error)
CreateContainer creates and starts a Docker container for a given pod.
func (*DockerClient) ExecInContainer ¶
func (c *DockerClient) ExecInContainer(ctx context.Context, namespace, name, containerName string, cmd []string, attach api.AttachIO) (err error)
ExecInContainer executes a command in a specific container of a pod.
func (*DockerClient) GetContainerLogs ¶
func (c *DockerClient) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, opts api.ContainerLogOpts) (in io.ReadCloser, err error)
GetContainerLogs retrieves the logs for a specific docker container.
func (*DockerClient) GetContainers ¶
func (c *DockerClient) GetContainers(ctx context.Context, podNs, podName string) (containers []resource.Container, err error)
GetContainers retrieves the container objects for a given pod namespace and name.
func (*DockerClient) GetContainersListResult ¶
func (c *DockerClient) GetContainersListResult(ctx context.Context) (map[k8stypes.NamespacedName][]resource.Container, error)
GetContainersListResult fetches the list of containers for all pods managed by the DockerClient.
func (*DockerClient) IsContainerPresent ¶
func (c *DockerClient) IsContainerPresent(ctx context.Context, podNs, podName, containerName string) bool
IsContainerPresent checks if a specific container is present within a given pod.
func (*DockerClient) RemoveContainers ¶
func (c *DockerClient) RemoveContainers(ctx context.Context, podNs, podName string, gracePeriod int64) (err error)
RemoveContainers removes all containers associated with a given pod.
type MacOSClient ¶
type MacOSClient struct {
// contains filtered or unexported fields
}
MacOSClient manages the lifecycle of macOS virtual machines.
func NewMacOSClient ¶
func NewMacOSClient(ctx context.Context, eventRecorder event.EventRecorder, networkInterfaceIdentifier, cachePath string) *MacOSClient
NewMacOSClient initializes a new MacOSClient instance.
func (*MacOSClient) CreateVirtualMachine ¶
func (c *MacOSClient) CreateVirtualMachine(ctx context.Context, params VirtualMachineParams) (err error)
CreateVirtualMachine creates a new virtual machine with the specified parameters.
func (*MacOSClient) DeleteVirtualMachine ¶
func (c *MacOSClient) DeleteVirtualMachine(ctx context.Context, namespace string, name string, gracePeriod int64) (err error)
DeleteVirtualMachine stops and deletes the specified virtual machine.
func (*MacOSClient) ExecInVirtualMachine ¶
func (c *MacOSClient) ExecInVirtualMachine(ctx context.Context, namespace, name string, cmd []string, attach api.AttachIO) (err error)
ExecInVirtualMachine executes a command inside a specified virtual machine.
func (*MacOSClient) GetVirtualMachine ¶
func (c *MacOSClient) GetVirtualMachine(ctx context.Context, namespace string, name string) (i resource.MacOSVirtualMachine, err error)
GetVirtualMachine retrieves the specified virtual machine.
func (*MacOSClient) GetVirtualMachineListResult ¶
func (c *MacOSClient) GetVirtualMachineListResult(ctx context.Context) (map[types.NamespacedName]resource.MacOSVirtualMachine, error)
GetVirtualMachineListResult retrieves all virtual machines managed by the client.
type VirtualMachineParams ¶
type VirtualMachineParams struct { UID string Image string Namespace string Name string ContainerName string CPU uint MemorySize uint64 Mounts []volumes.Mount Env []corev1.EnvVar PostStartAction *resource.ExecAction IgnoreImageCache bool }
VirtualMachineParams encapsulates the parameters required for creating a virtual machine.