pod

package
Version: v0.0.0-...-4cca708 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 86 Imported by: 0

Documentation

Overview

Package pod

Index

Constants

View Source
const (
	PathParamPodName   = "name"
	PathParamPodUID    = "uid"
	PathParamContainer = "container"
)

PathParams http path var

Variables

This section is empty.

Functions

This section is empty.

Types

type JobScheduleFunc

type JobScheduleFunc func(action queue.JobAction, oldPod, newPod *corev1.Pod) error

type Manager

type Manager struct {
	*manager.BaseManager

	// storage related funcs
	PrepareStorage               func(pod *corev1.Pod, volumeInUse []corev1.UniqueVolumeName) error
	CleanupStorage               func(pod *corev1.Pod) error
	GetPersistentVolumeMountPath func(podUID types.UID, pvName string) string
	// contains filtered or unexported fields
}

Manager the pod manager, controls pod workload assignment and pod command execution

func NewManager

func NewManager(
	parentCtx context.Context,
	name, hostIP string,
	client kubeclient.Interface,
	networkManager *network.Manager,
	connectivityManager connectivity.Manager,
	options *Options,
) *Manager

NewManager creates a new pod manager for virtual node

func (*Manager) Close

func (m *Manager) Close()

Close pod manager

func (*Manager) CreateDevicePod

func (m *Manager) CreateDevicePod(pod *corev1.Pod) error

CreateDevicePod handle both pod resource resolution and create pod in edge device nolint:gocyclo

func (*Manager) DeleteDevicePod

func (m *Manager) DeleteDevicePod(podUID types.UID) error

DeleteDevicePod delete pod in edge device

func (*Manager) HandleGetPods

func (m *Manager) HandleGetPods(w http.ResponseWriter, r *http.Request)

func (*Manager) HandleGetRunningPods

func (m *Manager) HandleGetRunningPods(w http.ResponseWriter, r *http.Request)

func (*Manager) HandleHostLog

func (m *Manager) HandleHostLog(w http.ResponseWriter, r *http.Request)

func (*Manager) HandlePodAttach

func (m *Manager) HandlePodAttach(w http.ResponseWriter, r *http.Request)

HandlePodAttach proxy http based kubectl attach command to edge device

func (*Manager) HandlePodExec

func (m *Manager) HandlePodExec(w http.ResponseWriter, r *http.Request)

HandlePodExec proxy http based kubectl exec command to edge device

func (*Manager) HandlePodLog

func (m *Manager) HandlePodLog(w http.ResponseWriter, r *http.Request)

HandlePodLog proxy http based kubectl logs command to edge device

func (*Manager) HandlePodPortForward

func (m *Manager) HandlePodPortForward(w http.ResponseWriter, r *http.Request)

HandlePodPortForward proxy http based kubectl port-forward command to edge device

func (*Manager) KubePodManagerForVolumeManager

func (m *Manager) KubePodManagerForVolumeManager() pod.Manager

func (*Manager) KubePodStatusProviderForVolumeManager

func (m *Manager) KubePodStatusProviderForVolumeManager() storage.PodStateProvider

func (*Manager) KubeRuntimeForVolumeManager

func (m *Manager) KubeRuntimeForVolumeManager() kubecontainer.Runtime

func (*Manager) SchedulePodJob

func (m *Manager) SchedulePodJob(action queue.JobAction, oldPod, newPod *corev1.Pod) error

func (*Manager) Start

func (m *Manager) Start() error

Start pod manager

func (*Manager) StorageEnabled

func (m *Manager) StorageEnabled() bool

func (*Manager) SyncDevicePods

func (m *Manager) SyncDevicePods() error

SyncDevicePods sync all pods in device with Kubernetes cluster

func (*Manager) UpdateMirrorPod

func (m *Manager) UpdateMirrorPod(
	pod *corev1.Pod,
	devicePodStatus *runtimepb.PodStatusMsg,
	forInitContainers bool,
) error

UpdateMirrorPod update Kubernetes pod object status according to device pod status

func (*Manager) UpdatePodStatus

func (m *Manager) UpdatePodStatus(pod *corev1.Pod) (*corev1.Pod, error)

UpdatePodStatus update podStatus and store the latest cache

type Options

type Options struct {
	Config        *conf.VirtualnodePodConfig
	GetNode       func() *corev1.Node
	GetPod        func(name string) *corev1.Pod
	GetConfigMap  func(name string) *corev1.ConfigMap
	GetSecret     func(name string) *corev1.Secret
	ListServices  func() []*corev1.Service
	EventRecorder record.EventRecorder

	GetVirtualPod          func() *corev1.Pod
	UpdateVirtualPodStatus func(*corev1.Pod)

	// device interaction
	OperatePeripheral        func(peripheralName, operationName string, data []byte, out io.Writer) error
	CollectPeripheralMetrics func(peripheralName string) error
}

Jump to

Keyboard shortcuts

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