scalar

package
v0.0.0-...-ac6a2c4 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsOldVersion

func IsOldVersion(oldVersion, newVersion string) bool

IsOldVersion is a very k8s specific check. TODO: make this an interface with a noop impl for Mesos. Check if the event has already been received. When we start k8s node and pod informers, we start getting events with a reference version. On the first sync up, all nodes in the system will send an "add" event to peloton On a subsequent list, (list being a time consuming operation), we may get older events. By caching the resource version in memory, we should be able to check for and reject older events. Kubernetes internally uses this same check to identify older events. As per their developer guidelines, it should be safe to do it here. Further reference: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency

Types

type HostEvent

type HostEvent struct {
	// contains filtered or unexported fields
}

HostEvent contains information about the host, event type and resource version for that event.

func BuildHostEventFromNode

func BuildHostEventFromNode(
	node *corev1.Node,
	e HostEventType,
) (*HostEvent, error)

BuildHostEventFromNode builds a host event from underlying k8s node object.

func BuildHostEventFromResource

func BuildHostEventFromResource(
	hostname string,
	available models.HostResources,
	capacity models.HostResources,
	e HostEventType,
) *HostEvent

BuildHostEventFromResource builds a host event from underlying resource

func (*HostEvent) GetEventType

func (h *HostEvent) GetEventType() HostEventType

GetEventType is helper function to get event type.

func (*HostEvent) GetHostInfo

func (h *HostEvent) GetHostInfo() *HostInfo

GetHostInfo is helper function to get host info.

type HostEventType

type HostEventType int

HostEventType describes the type of host event sent by plugin.

const (
	// AddHost event type.
	AddHost HostEventType = iota + 1
	// UpdateHostSpec event type.
	UpdateHostSpec
	// DeleteHost event type.
	DeleteHost
	// UpdateHostAvailableRes event type, used by mesos only
	UpdateHostAvailableRes
	//  UpdateAgent event type, used by mesos only
	UpdateAgent
)

type HostInfo

type HostInfo struct {
	// contains filtered or unexported fields
}

HostInfo contains the host specific information we receive from underlying scheduler (k8s or mesos).

func (*HostInfo) GetAvailable

func (h *HostInfo) GetAvailable() models.HostResources

GetAvailable is helper function to get available resources for the host.

func (*HostInfo) GetCapacity

func (h *HostInfo) GetCapacity() models.HostResources

GetCapacity is helper function to get capacity for the host.

func (*HostInfo) GetHostName

func (h *HostInfo) GetHostName() string

GetHostName is helper function to get name of the host.

func (*HostInfo) GetPodMap

func (h *HostInfo) GetPodMap() map[string]models.HostResources

GetPodMap is helper function to get pod map for the host.

func (*HostInfo) GetResourceVersion

func (h *HostInfo) GetResourceVersion() string

GetResourceVersion is helper function to get resource version.

type PodEvent

type PodEvent struct {
	// Peloton internal pod event protobuf.
	Event *pbpod.PodEvent
	// Type of pod event.
	EventType PodEventType
	// Event ID for the event. This should be used for de-duping the event stream.
	EventID string
}

PodEvent contains peloton pod event protobuf, event type and resource version for that event.

func BuildPodEventFromPod

func BuildPodEventFromPod(
	pod *corev1.Pod,
	e PodEventType,
) *PodEvent

type PodEventType

type PodEventType int

PodEventType describes the type of pod event sent by plugin.

const (
	// AddPod event type.
	AddPod PodEventType = iota + 1
	// UpdatePod event type.
	UpdatePod
	// DeletePod event type.
	DeletePod
)

Jump to

Keyboard shortcuts

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