scheduler

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Responsible for creating all resources for a lab. Pods, services, networks, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasDevices added in v0.1.4

func HasDevices(ld *pb.LessonDef) bool

Types

type Endpoint added in v0.1.4

type Endpoint interface {
	GetName() string
	GetImage() string
	GetPorts() []int32
}

Endpoint should be satisfied by Utility, Blackbox, and Device

type KubeLab

type KubeLab struct {
	Namespace          *corev1.Namespace
	CreateRequest      *LessonScheduleRequest // The request that originally resulted in this KubeLab
	Networks           map[string]*crd.NetworkAttachmentDefinition
	Pods               map[string]*corev1.Pod
	Services           map[string]*corev1.Service
	Ingresses          map[string]*v1beta1.Ingress
	LabConnections     map[string]string
	Status             pb.Status
	ReachableEndpoints []string // endpoint names
}

KubeLab is the collection of kubernetes resources that makes up a lab instance

func (*KubeLab) ToLiveLesson

func (kl *KubeLab) ToLiveLesson() *pb.LiveLesson

ToLiveLesson exports a KubeLab as a generic LiveLesson so the API can use it

type LessonScheduleRequest

type LessonScheduleRequest struct {
	LessonDef *pb.LessonDef
	Operation OperationType
	Uuid      string
	Stage     int32
	Created   time.Time
}

type LessonScheduleResult

type LessonScheduleResult struct {
	Success          bool
	Stage            int32
	LessonDef        *pb.LessonDef
	Operation        OperationType
	Message          string
	KubeLab          *KubeLab
	ProvisioningTime int
	Uuid             string
	GCLessons        []string
}

type LessonScheduler

type LessonScheduler struct {
	KubeConfig    *rest.Config
	Requests      chan *LessonScheduleRequest
	Results       chan *LessonScheduleResult
	LessonDefs    map[int32]*pb.LessonDef
	SyringeConfig *config.SyringeConfig
	GcWhiteList   map[string]*pb.Session
	GcWhiteListMu *sync.Mutex
}

func (*LessonScheduler) Start

func (ls *LessonScheduler) Start() error

Start is meant to be run as a goroutine. The "requests" channel will wait for new requests, attempt to schedule them, and put a results message on the "results" channel when finished (success or fail)

type OperationType

type OperationType int32
var (
	OperationType_CREATE OperationType = 0
	OperationType_MODIFY OperationType = 1
	OperationType_BOOP   OperationType = 2
	OperationType_GC     OperationType = 3
)

Jump to

Keyboard shortcuts

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