scheduler

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2018 License: Apache-2.0 Imports: 25 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

This section is empty.

Types

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
	LabConnections map[string]string
	NetPolicy      *netv1.NetworkPolicy
}

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 *def.LessonDefinition
	Operation OperationType
	Uuid      string
	Session   string
	Stage     int32
}

type LessonScheduleResult

type LessonScheduleResult struct {
	Success   bool
	Stage     int32
	LessonDef *def.LessonDefinition
	Operation OperationType
	Message   string
	KubeLab   *KubeLab
	Uuid      string
	Session   string
	GCLessons []string
}

type LessonScheduler

type LessonScheduler struct {
	KubeConfig    *rest.Config
	Requests      chan *LessonScheduleRequest
	Results       chan *LessonScheduleResult
	LessonDefs    map[int32]*def.LessonDefinition
	SyringeConfig *config.SyringeConfig
}

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_DELETE OperationType = 1
	OperationType_MODIFY OperationType = 2
	OperationType_BOOP   OperationType = 3
	OperationType_GC     OperationType = 4
)

Jump to

Keyboard shortcuts

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