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 Ingresses map[string]*v1beta1.Ingress Status pb.Status CurrentStage int32 HealthyTests int TotalTests int }
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
func (*KubeLab) ToProtoKubeLab ¶ added in v0.3.0
ToProtoKubeLab is a converter function that transforms a native KubeLab struct instance into a protobuf-based KubeLab instance. Not all fields can be modeled in protobuf, so this function mostly just uses the name of Kubernetes objects in lieu of the actual object.
type LessonHealthCheck ¶ added in v0.3.1
type LessonHealthCheck struct{}
type LessonHealthChecker ¶ added in v0.3.1
type LessonHealthChecker interface {
// contains filtered or unexported methods
}
LessonHealthChecker describes a struct which offers a variety of reachability tests for lesson endpoints.
type LessonScheduleRequest ¶
type LessonScheduleResult ¶
type LessonScheduler ¶
type LessonScheduler struct { KubeConfig *rest.Config Requests chan *LessonScheduleRequest Results chan *LessonScheduleResult Curriculum *pb.Curriculum SyringeConfig *config.SyringeConfig GcWhiteList map[string]*pb.Session GcWhiteListMu *sync.Mutex KubeLabs map[string]*KubeLab KubeLabsMu *sync.Mutex HealthChecker LessonHealthChecker // Allows us to disable GC for testing. Production code should leave this at // false DisableGC bool // Client for interacting with normal Kubernetes resources Client kubernetes.Interface // Client for creating CRD defintions ClientExt kubernetesExt.Interface // Client for creating instances of our network CRD ClientCrd kubernetesCrd.Interface BuildInfo map[string]string }
func (*LessonScheduler) PurgeOldLessons ¶ added in v0.3.2
func (ls *LessonScheduler) PurgeOldLessons() ([]string, error)
Lesson garbage-collector
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 NetworkCrdClient ¶ added in v0.3.1
type NetworkCrdClient interface { UpdateNamespace(string) Create(obj *networkcrd.NetworkAttachmentDefinition) (*networkcrd.NetworkAttachmentDefinition, error) Update(obj *networkcrd.NetworkAttachmentDefinition) (*networkcrd.NetworkAttachmentDefinition, error) Delete(name string, options *meta_v1.DeleteOptions) error Get(name string) (*networkcrd.NetworkAttachmentDefinition, error) List(opts meta_v1.ListOptions) (*networkcrd.NetworkList, error) }
NetworkCrdClient is an interface for the client for our custom network CRD. Allows for injection of mocks at test time.
type OperationType ¶
type OperationType int32
var ( OperationType_CREATE OperationType = 1 OperationType_DELETE OperationType = 2 OperationType_MODIFY OperationType = 3 OperationType_BOOP OperationType = 4 OperationType_VERIFY OperationType = 5 )