Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove fields, RAW Capacity, Burst #130

Merged
merged 21 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ require (
github.com/imdario/mergo v0.3.12 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
Expand Down
115 changes: 1 addition & 114 deletions go.sum

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
"github.com/hobbyfarm/gargantua/pkg/authserver"
hfClientset "github.com/hobbyfarm/gargantua/pkg/client/clientset/versioned"
hfInformers "github.com/hobbyfarm/gargantua/pkg/client/informers/externalversions"
"github.com/hobbyfarm/gargantua/pkg/controllers/dynamicbindcontroller"
"github.com/hobbyfarm/gargantua/pkg/controllers/scheduledevent"
"github.com/hobbyfarm/gargantua/pkg/controllers/session"
"github.com/hobbyfarm/gargantua/pkg/controllers/tfpcontroller"
Expand Down Expand Up @@ -420,10 +419,6 @@ func bootStrapControllers(kubeClient *kubernetes.Clientset, hfClient *hfClientse
if err != nil {
return err
}
dynamicBindController, err := dynamicbindcontroller.NewDynamicBindController(hfClient, hfInformerFactory, gctx)
if err != nil {
return err
}

g.Go(func() error {
return sessionController.Run(stopCh)
Expand All @@ -445,10 +440,6 @@ func bootStrapControllers(kubeClient *kubernetes.Clientset, hfClient *hfClientse
return vmSetController.Run(stopCh)
})

g.Go(func() error {
return dynamicBindController.Run(stopCh)
})

g.Go(func() error {
return rbacControllerFactory.Start(ctx, 1)
})
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/hobbyfarm.io/v1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ScheduledEventList{},
&DynamicBindConfiguration{},
&DynamicBindConfigurationList{},
&DynamicBindRequest{},
&DynamicBindRequestList{},
&Progress{},
&ProgressList{},
)
Expand Down
63 changes: 0 additions & 63 deletions pkg/apis/hobbyfarm.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ import (
)

type VmStatus string
type CapacityMode string

const (
VmStatusRFP VmStatus = "readyforprovisioning"
VmStatusProvisioned VmStatus = "provisioned"
VmStatusRunning VmStatus = "running"
VmStatusTerminating VmStatus = "terminating"
CapacityModeRaw CapacityMode = "raw"
CapacityModeCount CapacityMode = "count"
)

// +genclient
Expand All @@ -35,7 +32,6 @@ type VirtualMachineList struct {
}

type VirtualMachineSpec struct {
Id string `json:"id"`
VirtualMachineTemplateId string `json:"vm_template_id"`
SshUsername string `json:"ssh_username"`
Protocol string `json:"protocol"`
Expand Down Expand Up @@ -77,7 +73,6 @@ type VirtualMachineClaimList struct {
}

type VirtualMachineClaimSpec struct {
Id string `json:"id"`
UserId string `json:"user"`
RestrictedBind bool `json:"restricted_bind"`
RestrictedBindValue string `json:"restricted_bind_value"`
Expand All @@ -89,7 +84,6 @@ type VirtualMachineClaimSpec struct {
type VirtualMachineClaimStatus struct {
BindMode string `json:"bind_mode"`
StaticBindAttempts int `json:"static_bind_attempts"`
DynamicBindRequestId string `json:"dynamic_bind_request_id"`
Bound bool `json:"bound"`
Ready bool `json:"ready"`
Tainted bool `json:"tainted"` // If tainted, we should delete the VM's underneath then delete ourself...
Expand Down Expand Up @@ -121,10 +115,8 @@ type VirtualMachineTemplateList struct {
// VM type is a genercized collection of information about a VM. this includes things like
// cpu, ram, disk, etc.
type VirtualMachineTemplateSpec struct {
Id string `json:"id"`
Name string `json:"name"` // 2x4, etc.
Image string `json:"image"` // ubuntu-18.04
Resources CMSStruct `json:"resources"`
ConfigMap map[string]string `json:"config_map"`
}

Expand All @@ -135,7 +127,6 @@ type Environment struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec EnvironmentSpec `json:"spec"`
Status EnvironmentStatus `json:"status"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand All @@ -157,23 +148,7 @@ type EnvironmentSpec struct {
EnvironmentSpecifics map[string]string `json:"environment_specifics"`
IPTranslationMap map[string]string `json:"ip_translation_map"`
WsEndpoint string `json:"ws_endpoint"`
CapacityMode CapacityMode `json:"capacity_mode"`
BurstCapable bool `json:"burst_capable"`
CountCapacity map[string]int `json:"count_capacity"`
Capacity CMSStruct `json:"capacity"`
BurstCountCapacity map[string]int `json:"burst_count_capacity"`
BurstCapacity CMSStruct `json:"burst_capacity"`
}

type EnvironmentStatus struct {
Used CMSStruct `json:"used"`
AvailableCount map[string]int `json:"available_count"`
}

type CMSStruct struct {
CPU int `json:"cpu"` // cores
Memory int `json:"memory"` // in MB
Storage int `json:"storage"` // in GB
}

// +genclient
Expand Down Expand Up @@ -234,7 +209,6 @@ type CourseList struct {
}

type CourseSpec struct {
Id string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Scenarios []string `json:"scenarios"`
Expand Down Expand Up @@ -265,7 +239,6 @@ type ScenarioList struct {
}

type ScenarioSpec struct {
Id string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Steps []ScenarioStep `json:"steps"`
Expand Down Expand Up @@ -301,7 +274,6 @@ type SessionList struct {
}

type SessionSpec struct {
Id string `json:"id"`
ScenarioId string `json:"scenario"`
CourseId string `json:"course"`
KeepCourseVM bool `json:"keep_course_vm"`
Expand Down Expand Up @@ -338,7 +310,6 @@ type ProgressList struct {
}

type ProgressSpec struct {
Id string `json:"id"`
CurrentStep int `json:"current_step"`
MaxStep int `json:"max_step"`
TotalStep int `json:"total_step"`
Expand Down Expand Up @@ -479,43 +450,9 @@ type DynamicBindConfigurationList struct {
// that there is adequate vm capacity, it will always choose the environment with the highest capacity before creating a dynamic VM.

type DynamicBindConfigurationSpec struct {
Id string `json:"id"`
Environment string `json:"environment"`
BaseName string `json:"base_name"`
RestrictedBind bool `json:"restricted_bind"`
RestrictedBindValue string `json:"restricted_bind_value"`
BurstCountCapacity map[string]int `json:"burst_count_capacity"`
BurstCapacity CMSStruct `json:"burst_capacity"`
}

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type DynamicBindRequest struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DynamicBindRequestSpec `json:"spec"`
Status DynamicBindRequestStatus `json:"status"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type DynamicBindRequestList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []DynamicBindRequest `json:"items"`
}

type DynamicBindRequestSpec struct {
Id string `json:"id"`
VirtualMachineClaim string `json:"vm_claim"`
Attempts int `json:"attempts"`
}

type DynamicBindRequestStatus struct {
CurrentAttempts int `json:"current_attempts"`
Expired bool `json:"expired"`
Fulfilled bool `json:"fulfilled"`
DynamicBindConfigurationId string `json:"dynamic_bind_configuration_id"`
VirtualMachineIds map[string]string `json:"virtual_machines_id"`
}
Loading