provider

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MutatePod

MutatePod is used to modify Pods requests before they arrive to the Virtual Kubelet Framework. This is because the frameworks drops pods whose containers involve "valueFrom = .status.podIP" semantics. Ref: https://github.com/Azure/AKS/issues/2427#issuecomment-1010354262

func NodeConditions

func NodeConditions(_ context.Context) []corev1.NodeCondition

NodeConditions creates a slice of node conditions representing a kubelet in perfect health. These four conditions are the ones which virtual-kubelet sets as Unknown when a Ping fails.

Types

type InitConfig

type InitConfig struct {
	InternalIP string
	DaemonPort int32

	BuildVersion string

	FSPollingInterval time.Duration

	RestConfig *rest.Config
}

InitConfig is the config passed to initialize a registered provider.

type VirtualK8S

type VirtualK8S struct {
	InitConfig

	Logger logr.Logger
	// contains filtered or unexported fields
}

VirtualK8S implements the virtual-kubelet provider interface and stores pods in memory.

func NewVirtualK8S

func NewVirtualK8S(config InitConfig) (*VirtualK8S, error)

NewVirtualK8S reads a kubeconfig file and sets up a client to interact with Slurm cluster. It is designed to restore missing state after a restart.

func (*VirtualK8S) ConfigureNode

func (v *VirtualK8S) ConfigureNode(ctx context.Context, node *corev1.Node)

ConfigureNode enables a provider to configure the node object that will be used for Kubernetes.

func (*VirtualK8S) CreatePod

func (v *VirtualK8S) CreatePod(ctx context.Context, pod *corev1.Pod) error

CreatePod takes a Kubernetes Pod and deploys it within the provider.

func (*VirtualK8S) DeletePod

func (v *VirtualK8S) DeletePod(ctx context.Context, pod *corev1.Pod) error

DeletePod takes a Kubernetes Pod and deletes it from the provider. Once a pod is deleted, the provider is expected to call the NotifyPods callback with a terminal pod status where all the containers are in a terminal state, as well as the pod. DeletePod may be called multiple times for the same pod.

func (*VirtualK8S) GetContainerLogs

func (v *VirtualK8S) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, opts vkapi.ContainerLogOpts) (io.ReadCloser, error)

GetContainerLogs retrieves the logs of a container by name from the provider.

func (*VirtualK8S) GetPod

func (v *VirtualK8S) GetPod(ctx context.Context, namespace, name string) (*corev1.Pod, error)

GetPod retrieves a pod by name from the provider (can be cached). The Pod returned is expected to be immutable, and may be accessed concurrently outside the calling goroutine. Therefore, it is recommended to return a version after DeepCopy.

func (*VirtualK8S) GetPodStatus

func (v *VirtualK8S) GetPodStatus(ctx context.Context, namespace, name string) (*corev1.PodStatus, error)

GetPodStatus retrieves the status of a pod by name from the provider. The PodStatus returned is expected to be immutable, and may be accessed concurrently outside the calling goroutine. Therefore, it is recommended to return a version after DeepCopy.

func (*VirtualK8S) GetPods

func (v *VirtualK8S) GetPods(ctx context.Context) ([]*corev1.Pod, error)

GetPods retrieves a list of all pods running on the provider (can be cached). The Pods returned are expected to be immutable, and may be accessed concurrently outside the calling goroutine. Therefore, it is recommended to return a version after DeepCopy.

func (*VirtualK8S) GetStatsSummary

func (v *VirtualK8S) GetStatsSummary(context.Context) (*statsv1alpha1.Summary, error)

func (*VirtualK8S) NewVirtualNode

func (v *VirtualK8S) NewVirtualNode(ctx context.Context, nodename string, taint *corev1.Taint) *corev1.Node

NewVirtualNode builds a kubernetes node object from a provider This is a temporary solution until node stuff actually split off from the provider interface itself.

func (*VirtualK8S) NodeAddresses

func (v *VirtualK8S) NodeAddresses(_ context.Context) []corev1.NodeAddress

func (*VirtualK8S) NodeDaemonEndpoints

func (v *VirtualK8S) NodeDaemonEndpoints(_ context.Context) corev1.NodeDaemonEndpoints

func (*VirtualK8S) NodeSystemInfo

func (v *VirtualK8S) NodeSystemInfo(_ context.Context) corev1.NodeSystemInfo

func (*VirtualK8S) NotifyPods

func (v *VirtualK8S) NotifyPods(ctx context.Context, f func(*corev1.Pod))

NotifyPods instructs the notifier to call the passed in function when the pod status changes. It should be called when a pod's status changes.

The provided pointer to a Pod is guaranteed to be used in a read-only fashion. The provided pod's PodStatus should be up-to-date when this function is called.

NotifyPods must not block the caller since it is only used to register the callback. The callback passed into `NotifyPods` may block when called.

func (*VirtualK8S) RunInContainer

func (v *VirtualK8S) RunInContainer(ctx context.Context, namespace, podName, containerName string, cmd []string, attach vkapi.AttachIO) error

RunInContainer executes a command in a container in the pod, copying data between in/out/err and the container's stdin/stdout/stderr.

func (*VirtualK8S) UpdatePod

func (v *VirtualK8S) UpdatePod(ctx context.Context, pod *corev1.Pod) error

UpdatePod takes a Kubernetes Pod and updates it within the provider.

Jump to

Keyboard shortcuts

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