Documentation
¶
Index ¶
- Constants
- Variables
- type Activity
- type AllocatedGpu
- type ApiKey
- type ApiKeyCreateParams
- type App
- type AuthParams
- type CreateSnapshotParams
- type CustomDomain
- type Deployment
- func (deployment *Deployment) BeingCreated() bool
- func (deployment *Deployment) BeingDeleted() bool
- func (deployment *Deployment) DoingActivity(activity string) bool
- func (deployment *Deployment) GetMainApp() *App
- func (deployment *Deployment) GetURL(externalPort *int) *string
- func (deployment *Deployment) Ready() bool
- func (deployment *Deployment) SetMainApp(app *App)
- func (deployment *Deployment) ToDTO(smURL *string, externalPort *int, teams []string) body.DeploymentRead
- type DeploymentCreateParams
- type DeploymentEnv
- type DeploymentError
- type DeploymentEvent
- type DeploymentGPU
- type DeploymentHarbor
- type DeploymentK8s
- func (k *DeploymentK8s) DeleteDeployment(name string)
- func (k *DeploymentK8s) DeleteHPA(name string)
- func (k *DeploymentK8s) DeleteIngress(name string)
- func (k *DeploymentK8s) DeletePV(name string)
- func (k *DeploymentK8s) DeletePVC(name string)
- func (k *DeploymentK8s) DeleteSecret(name string)
- func (k *DeploymentK8s) DeleteService(name string)
- func (k *DeploymentK8s) GetDeployment(name string) *k8sModels.DeploymentPublic
- func (k *DeploymentK8s) GetDeploymentMap() map[string]k8sModels.DeploymentPublic
- func (k *DeploymentK8s) GetHPA(name string) *k8sModels.HpaPublic
- func (k *DeploymentK8s) GetHpaMap() map[string]k8sModels.HpaPublic
- func (k *DeploymentK8s) GetIngress(name string) *k8sModels.IngressPublic
- func (k *DeploymentK8s) GetIngressMap() map[string]k8sModels.IngressPublic
- func (k *DeploymentK8s) GetNamespace() *k8sModels.NamespacePublic
- func (k *DeploymentK8s) GetNetworkPolicy(name string) *k8sModels.NetworkPolicyPublic
- func (k *DeploymentK8s) GetNetworkPolicyMap() map[string]k8sModels.NetworkPolicyPublic
- func (k *DeploymentK8s) GetPV(name string) *k8sModels.PvPublic
- func (k *DeploymentK8s) GetPVC(name string) *k8sModels.PvcPublic
- func (k *DeploymentK8s) GetPvMap() map[string]k8sModels.PvPublic
- func (k *DeploymentK8s) GetPvcMap() map[string]k8sModels.PvcPublic
- func (k *DeploymentK8s) GetSecret(name string) *k8sModels.SecretPublic
- func (k *DeploymentK8s) GetSecretMap() map[string]k8sModels.SecretPublic
- func (k *DeploymentK8s) GetService(name string) *k8sModels.ServicePublic
- func (k *DeploymentK8s) GetServiceMap() map[string]k8sModels.ServicePublic
- type DeploymentStatus
- type DeploymentSubsystems
- type DeploymentUpdateOwnerParams
- type DeploymentUpdateParams
- type DeploymentUsage
- type DeploymentVolume
- type Discover
- type Docker
- type EffectiveRole
- type Event
- type EventCreateParams
- type GithubActionConfig
- type GpuClaim
- type GpuClaimConsumer
- type GpuClaimCreateParams
- type GpuClaimK8s
- type GpuClaimStatus
- type GpuClaimStatusPhase
- type GpuClaimSubsystems
- type GpuClaimUpdateParams
- type GpuDeviceConfiguration
- type GpuGroup
- type GpuLease
- type GpuLeaseCreateParams
- type GpuLeaseUpdateParams
- type Gravatar
- type Host
- type HttpProxyCreateParams
- type HttpProxyUpdateParams
- type InitContainer
- type Job
- type JobUpdateParams
- type Jobs
- type Log
- type Notification
- type NotificationCreateParams
- type On
- type Permissions
- type PodDeleted
- type Port
- type PortCreateParams
- type PortHttpProxy
- type PortUpdateParams
- type PublicKey
- type Push
- type Quotas
- type ReplicaStatus
- type RequestAllocationMode
- type RequestedGpu
- type RequestedGpuCreate
- type ResourceMigration
- type ResourceMigrationCreateParams
- type ResourceMigrationUpdateOwner
- type ResourceMigrationUpdateOwnerParams
- type ResourceMigrationUpdateParams
- type Role
- type SM
- type SmCreateParams
- type SmJob
- type SmK8s
- func (k *SmK8s) DeleteDeployment(name string)
- func (k *SmK8s) DeleteIngress(name string)
- func (k *SmK8s) DeletePV(name string)
- func (k *SmK8s) DeletePVC(name string)
- func (k *SmK8s) DeleteService(name string)
- func (k *SmK8s) GetDeployment(name string) *k8sModels.DeploymentPublic
- func (k *SmK8s) GetDeploymentMap() map[string]k8sModels.DeploymentPublic
- func (k *SmK8s) GetIngress(name string) *k8sModels.IngressPublic
- func (k *SmK8s) GetIngressMap() map[string]k8sModels.IngressPublic
- func (k *SmK8s) GetNamespace() *k8sModels.NamespacePublic
- func (k *SmK8s) GetPV(name string) *k8sModels.PvPublic
- func (k *SmK8s) GetPVC(name string) *k8sModels.PvcPublic
- func (k *SmK8s) GetPvMap() map[string]k8sModels.PvPublic
- func (k *SmK8s) GetPvcMap() map[string]k8sModels.PvcPublic
- func (k *SmK8s) GetService(name string) *k8sModels.ServicePublic
- func (k *SmK8s) GetServiceMap() map[string]k8sModels.ServicePublic
- type SmSubsystems
- type SmVolume
- type Snapshot
- type SnapshotV2
- type Source
- type Steps
- type Subsystems
- type Team
- func (t *Team) AddMember(member TeamMember)
- func (t *Team) AddResource(resource TeamResource)
- func (t *Team) GetID() string
- func (t *Team) GetMember(id string) *TeamMember
- func (t *Team) GetMemberMap() map[string]TeamMember
- func (t *Team) GetResource(id string) *TeamResource
- func (t *Team) GetResourceMap() map[string]TeamResource
- func (t *Team) HasMember(id string) bool
- func (t *Team) HasResource(id string) bool
- func (t *Team) RemoveMember(id string)
- func (t *Team) RemoveResource(id string)
- func (t *Team) ToDTO(getMember func(*TeamMember) *body.TeamMember, ...) body.TeamRead
- type TeamCreateParams
- type TeamJoinParams
- type TeamMember
- type TeamResource
- type TeamUpdateParams
- type User
- type UserData
- type UserSynchronizeParams
- type UserUpdateParams
- type UserUsage
- type VM
- func (vm *VM) BeingCreated() bool
- func (vm *VM) BeingDeleted() bool
- func (vm *VM) DoingActivity(activity string) bool
- func (vm *VM) DoingOneOfActivities(activities []string) bool
- func (vm *VM) GetExternalPort(privatePort int, protocol string) *int
- func (vm *VM) GetHttpProxyURL(name string, externalPort *int) *string
- func (vm *VM) Ready() bool
- func (vm *VM) ToDTOv2(gpuLease *GpuLease, teams []string, externalPort *int, ...) body.VmRead
- type VmActionParams
- type VmCreateParams
- type VmHost
- type VmK8s
- func (k8s *VmK8s) GetDeployment(name string) *k8sModels.DeploymentPublic
- func (k8s *VmK8s) GetDeploymentMap() map[string]k8sModels.DeploymentPublic
- func (k8s *VmK8s) GetIngress(name string) *k8sModels.IngressPublic
- func (k8s *VmK8s) GetIngressMap() map[string]k8sModels.IngressPublic
- func (k8s *VmK8s) GetNetworkPolicy(name string) *k8sModels.NetworkPolicyPublic
- func (k8s *VmK8s) GetNetworkPolicyMap() map[string]k8sModels.NetworkPolicyPublic
- func (k8s *VmK8s) GetPV(name string) *k8sModels.PvPublic
- func (k8s *VmK8s) GetPVC(name string) *k8sModels.PvcPublic
- func (k8s *VmK8s) GetPvMap() map[string]k8sModels.PvPublic
- func (k8s *VmK8s) GetPvcMap() map[string]k8sModels.PvcPublic
- func (k8s *VmK8s) GetSecret(name string) *k8sModels.SecretPublic
- func (k8s *VmK8s) GetSecretMap() map[string]k8sModels.SecretPublic
- func (k8s *VmK8s) GetService(name string) *k8sModels.ServicePublic
- func (k8s *VmK8s) GetServiceMap() map[string]k8sModels.ServicePublic
- func (k8s *VmK8s) GetVmSnapshotByID(id string) *k8sModels.VmSnapshotPublic
- func (k8s *VmK8s) GetVmSnapshotByName(name string) *k8sModels.VmSnapshotPublic
- func (k8s *VmK8s) GetVmSnapshotMap() map[string]k8sModels.VmSnapshotPublic
- type VmPort
- type VmPortLease
- type VmSpecs
- type VmStatus
- type VmUpdateOwnerParams
- type VmUpdateParams
- type VmUsage
- type VmiStatus
- type With
- type WorkerStatus
- type Zone
Constants ¶
const ( // ActivityBeingCreated is used when a model is being created. ActivityBeingCreated = "beingCreated" // ActivityBeingDeleted is used when a model is being deleted. ActivityBeingDeleted = "beingDeleted" // ActivityUpdating is used when a model is being updated. ActivityUpdating = "updating" // ActivityRestarting is used when a model is being restarted. ActivityRestarting = "restarting" // ActivityBuilding is used when a model is being built. ActivityBuilding = "building" // ActivityRepairing is used when a model is being repaired. ActivityRepairing = "repairing" )
const ( // CustomDomainStatusPending is the status of a custom domain that is pending verification. CustomDomainStatusPending = "pending" // CustomDomainStatusVerificationFailed is the status of a custom domain that failed verification. // This is either caused by the DNS record not being set or the DNS record not being propagated yet. CustomDomainStatusVerificationFailed = "verificationFailed" // CustomDomainStatusActive is the status of a custom domain that is active, // i.e., the DNS record is set and propagated. CustomDomainStatusActive = "active" )
const ( // DeploymentTypeCustom is a deployment that builds its own image, e.g., with a Dockerfile. DeploymentTypeCustom = "custom" // DeploymentTypePrebuilt is a deployment that uses a prebuilt image, such as nginx:latest. DeploymentTypePrebuilt = "prebuilt" // LogSourcePod is a log source for a pod in Kubernetes. LogSourcePod = "pod" // LogSourceDeployment is a log source for a deployment in go-deploy. LogSourceDeployment = "deployment" // LogSourceBuild is a log source for a build in GitLab CI. LogSourceBuild = "build" // VisibilityPublic is a public app. VisibilityPublic = "public" // VisibilityPrivate is a private app. VisibilityPrivate = "private" // VisibilityAuth is an app that requires authentication. VisibilityAuth = "auth" )
const ( // JobCreateVM is used when creating a VM. JobCreateVM = "createVm" // JobDeleteVM is used when deleting a VM. JobDeleteVM = "deleteVm" // JobUpdateVM is used when updating a VM. JobUpdateVM = "updateVm" // JobUpdateVmOwner is used when updating a VM's owner. JobUpdateVmOwner = "updateVmOwner" // JobRepairVM is used when repairing a VM. JobRepairVM = "repairVm" // JobCreateGpuLease is used when creating a GPU lease for a VM. JobCreateGpuLease = "createGpuLease" // JobUpdateGpuLease is used when updating a GPU lease for a VM. JobUpdateGpuLease = "updateGpuLease" // JobDeleteGpuLease is used when deleting a GPU lease for a VM. JobDeleteGpuLease = "deleteGpuLease" // JobCreateSystemVmSnapshot is used when creating a snapshot requested by the system. // This is separate from JobCreateVmUserSnapshot because the system can create any number of snapshots. JobCreateSystemVmSnapshot = "createSystemSnapshot" // JobCreateVmUserSnapshot is used when creating a snapshot requested by a user. // This is separate from JobCreateSystemVmSnapshot because the system can create any number of snapshots. JobCreateVmUserSnapshot = "createUserSnapshot" // JobDeleteVmSnapshot is used when deleting a snapshot. JobDeleteVmSnapshot = "deleteSnapshot" // JobDoVmAction is used when doing an action on a VM. JobDoVmAction = "doVmAction" // JobCreateDeployment is used when creating a deployment. JobCreateDeployment = "createDeployment" // JobDeleteDeployment is used when deleting a deployment. JobDeleteDeployment = "deleteDeployment" // JobUpdateDeployment is used when updating a deployment. JobUpdateDeployment = "updateDeployment" // JobUpdateDeploymentOwner is used when updating a deployment's owner. JobUpdateDeploymentOwner = "updateDeploymentOwner" // JobRepairDeployment is used when repairing a deployment. JobRepairDeployment = "repairDeployment" // JobCreateSM is used when creating a storage manager. JobCreateSM = "createSm" // JobDeleteSM is used when deleting a storage manager. JobDeleteSM = "deleteSm" // JobRepairSM is used when repairing a storage manager. JobRepairSM = "repairSm" // JobCreateGpuClaim is used when creating a gpu claim. JobCreateGpuClaim = "createGpuClaim" // JobCreateGpuClaim is used when deleting a gpu claim. JobDeleteGpuClaim = "deleteGpuClaim" // JobUpdateGpuClaim is used when updating a gpu claim JobUpdateGpuClaim = "updateGpuClaim" )
const ( // JobStatusPending is used when a job is pending and waiting to be run. JobStatusPending = "pending" // JobStatusRunning is used when a job is running. JobStatusRunning = "running" // JobStatusCompleted is used when a job is completed. JobStatusCompleted = "completed" // JobStatusFailed is used when a job has failed. JobStatusFailed = "failed" // JobStatusTerminated is used when a job has been terminated. JobStatusTerminated = "terminated" )
const ( // NotificationTeamInvite is used for team invite notifications. NotificationTeamInvite = "teamInvite" // NotificationResourceTransfer is used for resource migration notifications. NotificationResourceTransfer = "resourceTransfer" )
const ( ResourceTypeDeployment = "deployment" ResourceTypeVM = "vm" ResourceTypeSM = "sm" ResourceTypeTeam = "team" )
const ( ResourceMigrationTypeUpdateOwner = "updateOwner" ResourceMigrationStatusPending = "pending" ResourceMigrationStatusAccepted = "accepted" )
const ( // TeamMemberRoleAdmin is the role used for admin members in a team. // This is currently not used, and every member is an admin. TeamMemberRoleAdmin = "admin" // TeamMemberStatusInvited is the status used for users that have been invited to a team. TeamMemberStatusInvited = "invited" // TeamMemberStatusJoined is the status used for users that have joined a team. TeamMemberStatusJoined = "joined" )
const ( TestAdminUserID = "955f0f87-37fd-4792-90eb-9bf6989e698a" TestPowerUserID = "955f0f87-37fd-4792-90eb-9bf6989e698b" TestDefaultUserID = "955f0f87-37fd-4792-90eb-9bf6989e698c" TestAdminUserApiKey = "test-api-key-admin" TestPowerUserApiKey = "test-api-key-power" TestDefaultUserApiKey = "test-api-key-default" )
const ( ActionStart = "start" ActionStop = "stop" ActionRestart = "restart" ActionRestartIfRunning = "restartIfRunning" )
const (
NLogsCache = 100
)
const (
// TypeHttpRequest is the event type of HTTP requests.
TypeHttpRequest = "httpRequest"
)
Variables ¶
var ( ErrUnknownParameterImplType = errors.New("unknown underlying opaque GPU config type") ErrCouldNotInferDriver = errors.New("could not infer driver") )
var EmptyReplicaStatus = &ReplicaStatus{}
var FetchGravatarInterval = 10 * time.Minute
FetchGravatarInterval is the interval at which we fetch the gravatar image for a user. This is done to prevent fetching the image on every request.
Functions ¶
This section is empty.
Types ¶
type AllocatedGpu ¶
type AllocatedGpu struct {
Pool string `bson:"pool,omitempty"`
Device string `bson:"device,omitempty"`
AdminAccess bool `bson:"adminAccess,omitempty"`
}
AllocatedGpu represents a concrete allocated GPU or GPU share.
type ApiKey ¶
type ApiKey struct {
Name string `bson:"name"`
Key string `bson:"key"`
CreatedAt time.Time `bson:"createdAt"`
ExpiresAt time.Time `bson:"expiresAt"`
}
func (*ApiKey) ToDTO ¶
func (apiKey *ApiKey) ToDTO() body.ApiKeyCreated
type ApiKeyCreateParams ¶
type ApiKeyCreateParams struct {
Name string `json:"name"`
Key string `json:"key"`
ExpiresAt time.Time `json:"expiresAt"`
}
func (ApiKeyCreateParams) FromDTO ¶
func (apiKey ApiKeyCreateParams) FromDTO(dto *body.ApiKeyCreate, key string) *ApiKeyCreateParams
type App ¶
type App struct {
Name string `bson:"name"`
CpuCores float64 `bson:"cpuCores,omitempty"`
RAM float64 `bson:"ram,omitempty"`
Replicas int `bson:"replicas"`
GPUs []DeploymentGPU `bson:"gpus,omitempty"`
Image string `bson:"image"`
InternalPort int `bson:"internalPort"`
InternalPorts []int `bson:"internalPorts"`
Envs []DeploymentEnv `bson:"envs"`
Volumes []DeploymentVolume `bson:"volumes"`
Visibility string `bson:"visibility"`
// Deprecated: use Visibility instead.
Private bool `bson:"private"`
Args []string `bson:"args"`
InitCommands []string `bson:"initCommands"`
CustomDomain *CustomDomain `bson:"customDomain"`
// ReplicaStatus is a group of fields that describe the status of the replicas.
// It is only set for apps that has status update.
ReplicaStatus *ReplicaStatus `bson:"replicaStatus,omitempty"`
PingPath string `bson:"pingPath"`
PingResult int `bson:"pingResult"`
}
type AuthParams ¶
type CreateSnapshotParams ¶
type CreateSnapshotParams struct {
Name string `bson:"name"`
UserCreated bool `bson:"userCreated"`
Overwrite bool `bson:"overwrite"`
}
func (*CreateSnapshotParams) FromDTOv2 ¶
func (sc *CreateSnapshotParams) FromDTOv2(dto *body.VmSnapshotCreate)
FromDTOv2 converts a body.VmSnapshotCreate to a CreateSnapshotParams.
type CustomDomain ¶
type Deployment ¶
type Deployment struct {
ID string `bson:"id"`
Name string `bson:"name"`
Type string `bson:"type"`
OwnerID string `bson:"ownerId"`
Zone string `bson:"zone"`
CreatedAt time.Time `bson:"createdAt"`
UpdatedAt time.Time `bson:"updatedAt"`
RepairedAt time.Time `bson:"repairedAt"`
RestartedAt time.Time `bson:"restartedAt"`
DeletedAt time.Time `bson:"deletedAt"`
AccessedAt time.Time `bson:"accessedAt"`
NeverStale bool `bson:"neverStale"`
Activities map[string]Activity `bson:"activities"`
Apps map[string]App `bson:"apps"`
Subsystems DeploymentSubsystems `bson:"subsystems"`
Logs []Log `bson:"logs"`
Status string `bson:"status"`
// Error is set if there is an error with the deployment.
// The error is not cleared until the deployment is in a healthy state.
Error *DeploymentError `bson:"error,omitempty"`
}
func (*Deployment) BeingCreated ¶
func (deployment *Deployment) BeingCreated() bool
BeingCreated returns true if the deployment is being created.
func (*Deployment) BeingDeleted ¶
func (deployment *Deployment) BeingDeleted() bool
BeingDeleted returns true if the deployment is being deleted.
func (*Deployment) DoingActivity ¶
func (deployment *Deployment) DoingActivity(activity string) bool
DoingActivity returns true if the deployment is doing the given activity.
func (*Deployment) GetMainApp ¶
func (deployment *Deployment) GetMainApp() *App
GetMainApp returns the main app of the deployment. If the app does not exist, it will panic.
func (*Deployment) GetURL ¶
func (deployment *Deployment) GetURL(externalPort *int) *string
GetURL returns the URL of the deployment. If the K8s ingress does not exist, it will return nil, or if the ingress does not have a host, it will return nil.
func (*Deployment) Ready ¶
func (deployment *Deployment) Ready() bool
Ready returns true if the deployment is not being created or deleted.
func (*Deployment) SetMainApp ¶
func (deployment *Deployment) SetMainApp(app *App)
SetMainApp sets the main app of the deployment. If the app map is nil, it will be initialized before setting the app.
func (*Deployment) ToDTO ¶
func (deployment *Deployment) ToDTO(smURL *string, externalPort *int, teams []string) body.DeploymentRead
ToDTO converts a Deployment to a body.DeploymentRead DTO.
type DeploymentCreateParams ¶
type DeploymentCreateParams struct {
Name string
Type string
CpuCores float64
RAM float64
Replicas int
GPUs []DeploymentGPU
Image string
InternalPort int
InternalPorts []int
Envs []DeploymentEnv
Volumes []DeploymentVolume
InitCommands []string
Args []string
PingPath string
CustomDomain *string
Visibility string
NeverStale bool
Zone string
}
func (*DeploymentCreateParams) FromDTO ¶
func (p *DeploymentCreateParams) FromDTO(dto *body.DeploymentCreate, fallbackZone, fallbackImage string, fallbackPort int)
FromDTO converts body.DeploymentCreate DTO to DeploymentCreateParams.
type DeploymentEnv ¶
type DeploymentError ¶
type DeploymentEvent ¶
type DeploymentGPU ¶
type DeploymentHarbor ¶
type DeploymentHarbor struct {
Project harborModels.ProjectPublic `bson:"project"`
Robot harborModels.RobotPublic `bson:"robot"`
Repository harborModels.RepositoryPublic `bson:"repository"`
Webhook harborModels.WebhookPublic `bson:"webhook"`
Placeholder bool `bson:"placeholder"`
}
type DeploymentK8s ¶
type DeploymentK8s struct {
Namespace k8sModels.NamespacePublic `bson:"namespace"`
DeploymentMap map[string]k8sModels.DeploymentPublic `bson:"deploymentMap,omitempty"`
ServiceMap map[string]k8sModels.ServicePublic `bson:"serviceMap,omitempty"`
IngressMap map[string]k8sModels.IngressPublic `bson:"ingressMap,omitempty"`
PvMap map[string]k8sModels.PvPublic `bson:"pvMap,omitempty"`
PvcMap map[string]k8sModels.PvcPublic `bson:"pvcMap,omitempty"`
SecretMap map[string]k8sModels.SecretPublic `bson:"secretMap,omitempty"`
HpaMap map[string]k8sModels.HpaPublic `bson:"hpaMap,omitempty"`
NetworkPolicyMap map[string]k8sModels.NetworkPolicyPublic `bson:"networkPolicyMap,omitempty"`
}
func (*DeploymentK8s) DeleteDeployment ¶
func (k *DeploymentK8s) DeleteDeployment(name string)
DeleteDeployment deletes the deployment from the DeploymentMap with the given name. It uses GetDeploymentMap to get the map to avoid nil pointer dereferences.
func (*DeploymentK8s) DeleteHPA ¶
func (k *DeploymentK8s) DeleteHPA(name string)
DeleteHPA deletes the HPA from the HpaMap with the given name. It uses GetHpaMap to get the map to avoid nil pointer dereferences.
func (*DeploymentK8s) DeleteIngress ¶
func (k *DeploymentK8s) DeleteIngress(name string)
DeleteIngress deletes the ingress from the IngressMap with the given name. It uses GetIngressMap to get the map to avoid nil pointer dereferences.
func (*DeploymentK8s) DeletePV ¶
func (k *DeploymentK8s) DeletePV(name string)
DeletePV deletes the PV from the PvMap with the given name. It uses GetPvMap to get the map to avoid nil pointer dereferences.
func (*DeploymentK8s) DeletePVC ¶
func (k *DeploymentK8s) DeletePVC(name string)
DeletePVC deletes the PVC from the PvcMap with the given name. It uses GetPvcMap to get the map to avoid nil pointer dereferences.
func (*DeploymentK8s) DeleteSecret ¶
func (k *DeploymentK8s) DeleteSecret(name string)
DeleteSecret deletes the secret from the SecretMap with the given name. It uses GetSecretMap to get the map to avoid nil pointer dereferences.
func (*DeploymentK8s) DeleteService ¶
func (k *DeploymentK8s) DeleteService(name string)
DeleteService deletes the service from the ServiceMap with the given name. It uses GetServiceMap to get the map to avoid nil pointer dereferences.
func (*DeploymentK8s) GetDeployment ¶
func (k *DeploymentK8s) GetDeployment(name string) *k8sModels.DeploymentPublic
GetDeployment returns the deployment with the given name. If a deployment with the given name does not exist, nil will be returned.
func (*DeploymentK8s) GetDeploymentMap ¶
func (k *DeploymentK8s) GetDeploymentMap() map[string]k8sModels.DeploymentPublic
GetDeploymentMap returns the deployment map of the deployment. If the map is nil, it will be initialized before returning.
func (*DeploymentK8s) GetHPA ¶
func (k *DeploymentK8s) GetHPA(name string) *k8sModels.HpaPublic
GetHPA returns the HPA with the given name. If a HPA with the given name does not exist, nil will be returned.
func (*DeploymentK8s) GetHpaMap ¶
func (k *DeploymentK8s) GetHpaMap() map[string]k8sModels.HpaPublic
GetHpaMap returns the hpa map of the deployment. If the map is nil, it will be initialized before returning.
func (*DeploymentK8s) GetIngress ¶
func (k *DeploymentK8s) GetIngress(name string) *k8sModels.IngressPublic
GetIngress returns the ingress with the given name. If an ingress with the given name does not exist, nil will be returned.
func (*DeploymentK8s) GetIngressMap ¶
func (k *DeploymentK8s) GetIngressMap() map[string]k8sModels.IngressPublic
GetIngressMap returns the ingress map of the deployment. If the map is nil, it will be initialized before returning.
func (*DeploymentK8s) GetNamespace ¶
func (k *DeploymentK8s) GetNamespace() *k8sModels.NamespacePublic
GetNamespace returns the namespace of the deployment.
func (*DeploymentK8s) GetNetworkPolicy ¶
func (k *DeploymentK8s) GetNetworkPolicy(name string) *k8sModels.NetworkPolicyPublic
GetNetworkPolicy returns the network policy with the given name. If a network policy with the given name does not exist, nil will be returned.
func (*DeploymentK8s) GetNetworkPolicyMap ¶
func (k *DeploymentK8s) GetNetworkPolicyMap() map[string]k8sModels.NetworkPolicyPublic
GetNetworkPolicyMap returns the network policy map of the deployment. If the map is nil, it will be initialized before returning.
func (*DeploymentK8s) GetPV ¶
func (k *DeploymentK8s) GetPV(name string) *k8sModels.PvPublic
GetPV returns the PV with the given name. If a PV with the given name does not exist, nil will be returned.
func (*DeploymentK8s) GetPVC ¶
func (k *DeploymentK8s) GetPVC(name string) *k8sModels.PvcPublic
GetPVC returns the PVC with the given name. If a PVC with the given name does not exist, nil will be returned.
func (*DeploymentK8s) GetPvMap ¶
func (k *DeploymentK8s) GetPvMap() map[string]k8sModels.PvPublic
GetPvMap returns the pv map of the deployment. If the map is nil, it will be initialized before returning.
func (*DeploymentK8s) GetPvcMap ¶
func (k *DeploymentK8s) GetPvcMap() map[string]k8sModels.PvcPublic
GetPvcMap returns the pvc map of the deployment. If the map is nil, it will be initialized before returning.
func (*DeploymentK8s) GetSecret ¶
func (k *DeploymentK8s) GetSecret(name string) *k8sModels.SecretPublic
GetSecret returns the secret with the given name. If a secret with the given name does not exist, nil will be returned.
func (*DeploymentK8s) GetSecretMap ¶
func (k *DeploymentK8s) GetSecretMap() map[string]k8sModels.SecretPublic
GetSecretMap returns the secret map of the deployment. If the map is nil, it will be initialized before returning.
func (*DeploymentK8s) GetService ¶
func (k *DeploymentK8s) GetService(name string) *k8sModels.ServicePublic
GetService returns the service with the given name. If a service with the given name does not exist, nil will be returned.
func (*DeploymentK8s) GetServiceMap ¶
func (k *DeploymentK8s) GetServiceMap() map[string]k8sModels.ServicePublic
GetServiceMap returns the service map of the deployment. If the map is nil, it will be initialized before returning.
type DeploymentStatus ¶
type DeploymentSubsystems ¶
type DeploymentSubsystems struct {
K8s DeploymentK8s `bson:"k8s"`
Harbor DeploymentHarbor `bson:"harbor"`
}
type DeploymentUpdateParams ¶
type DeploymentUpdateParams struct {
Name *string
OwnerID *string
CpuCores *float64
RAM *float64
GPUs *[]DeploymentGPU
Envs *[]DeploymentEnv
InternalPort *int
InternalPorts *[]int
Volumes *[]DeploymentVolume
InitCommands *[]string
Args *[]string
CustomDomain *string
Image *string
PingPath *string
Replicas *int
Visibility *string
NeverStale *bool
}
func (*DeploymentUpdateParams) FromDTO ¶
func (p *DeploymentUpdateParams) FromDTO(dto *body.DeploymentUpdate, deploymentType string)
FromDTO converts body.DeploymentUpdate DTO to DeploymentUpdateParams.
type DeploymentUsage ¶
type DeploymentVolume ¶
type EffectiveRole ¶
type Event ¶
type Event struct {
ID string `bson:"id"`
Type string `bson:"type"`
CreatedAt time.Time `bson:"createdAt"`
// Source is the source of an event, meaning from where the event originated.
Source *Source `bson:"source,omitempty"`
// Metadata contains any data related to the event.
Metadata map[string]interface{} `bson:"metadata,omitempty"`
}
type EventCreateParams ¶
type GithubActionConfig ¶
type GpuClaim ¶
type GpuClaim struct {
ID string `bson:"id"`
Name string `bson:"name"`
Zone string `bson:"zone"`
// Requested contains all requested GPU configurations by key request.Name
// this key is the key that users will request for
Requested map[string]RequestedGpu `bson:"requested"`
// Allocated contains the GPUs that have been successfully bound/allocated
Allocated map[string][]AllocatedGpu `bson:"allocated,omitempty"`
// Consumers are the workloads currently using this claim
Consumers []GpuClaimConsumer `bson:"consumers,omitempty"`
// Status reflects the reconciliation and/or lifecycle state
Status *GpuClaimStatus `bson:"status,omitempty"`
// LastError holds the last reconciliation or provisioning error
LastError error `bson:"lastError,omitempty"`
// The roles that are allowed to use this GpuClaim
// Empty means all roles
AllowedRoles []string `bson:"allowedRoles,omitempty"`
Activities map[string]Activity `bson:"activities"`
Subsystems GpuClaimSubsystems `bson:"subsystems"`
CreatedAt time.Time `bson:"createdAt"`
UpdatedAt *time.Time `bson:"updatedAt,omitempty"`
}
GpuClaim represents a DRA-style claim for one or more GPUs that can be requested and consumed by deployments or workloads.
func (*GpuClaim) DoingActivity ¶
DoingActivity returns true if the gpuClaim is doing the given activity.
func (GpuClaim) ToBriefDTO ¶
func (g GpuClaim) ToBriefDTO() body.GpuClaimRead
func (GpuClaim) ToDTO ¶
func (g GpuClaim) ToDTO() body.GpuClaimRead
type GpuClaimConsumer ¶
type GpuClaimConsumer struct {
APIGroup string `bson:"apiGroup,omitempty"`
Resource string `bson:"resource,omitempty"`
Name string `bson:"name,omitempty"`
UID string `bson:"uid,omitempty"`
}
GpuClaimConsumer describes a workload (Pod/Deployment/etc.) consuming this GPU claim.
type GpuClaimCreateParams ¶
type GpuClaimCreateParams struct {
Name string `json:"name" bson:"name"`
Zone string `json:"zone" bson:"zone"`
Requested []RequestedGpuCreate `json:"requested" bson:"requested"`
AllowedRoles []string `bson:"allowedRoles,omitempty"`
}
type GpuClaimK8s ¶
type GpuClaimK8s struct {
Namespace k8sModels.NamespacePublic `bson:"namespace"`
ResourceClaimMap map[string]k8sModels.ResourceClaimPublic `bson:"resourceClaimMap,omitempty"`
}
func (*GpuClaimK8s) GetNamespace ¶
func (k *GpuClaimK8s) GetNamespace() *k8sModels.NamespacePublic
GetNamespace returns the namespace of the resourceClaim.
type GpuClaimStatus ¶
type GpuClaimStatus struct {
Phase GpuClaimStatusPhase `bson:"phase,omitempty"` // e.g. pending, bound, released, failed
Message string `bson:"message,omitempty"`
UpdatedAt *time.Time `bson:"updatedAt,omitempty"`
LastSynced *time.Time `bson:"lastSynced,omitempty"`
}
GpuClaimStatus represents runtime state and metadata about allocation progress.
type GpuClaimStatusPhase ¶
type GpuClaimStatusPhase string
const ( GpuClaimStatusPhase_Unknown GpuClaimStatusPhase = "" GpuClaimStatusPhase_Pending GpuClaimStatusPhase = "pending" GpuClaimStatusPhase_Bound GpuClaimStatusPhase = "bound" GpuClaimStatusPhase_Failed GpuClaimStatusPhase = "failed" )
type GpuClaimSubsystems ¶
type GpuClaimSubsystems struct {
K8s GpuClaimK8s `bson:"k8s"`
}
type GpuClaimUpdateParams ¶
type GpuClaimUpdateParams struct {
Name *string `json:"name" bson:"name"`
Zone *string `json:"zone" bson:"zone"`
Requested *[]RequestedGpuCreate `json:"requested" bson:"requested"`
AllowedRoles *[]string `bson:"allowedRoles,omitempty"`
}
type GpuDeviceConfiguration ¶
type GpuDeviceConfiguration struct {
Driver string `bson:"driver"`
Parameters dra.OpaqueParams `bson:"parameters,omitempty"`
}
GpuDeviceConfiguration holds the DRA opaque driver parameters and metadata.
func (GpuDeviceConfiguration) InferDriver ¶
func (g GpuDeviceConfiguration) InferDriver() (string, error)
InferDriver attempts to infer the GPU driver based on the OpaqueParams implementation.
func (GpuDeviceConfiguration) MarshalBSON ¶
func (cfg GpuDeviceConfiguration) MarshalBSON() ([]byte, error)
func (*GpuDeviceConfiguration) UnmarshalBSON ¶
func (cfg *GpuDeviceConfiguration) UnmarshalBSON(data []byte) error
type GpuGroup ¶
type GpuGroup struct {
// ID is just a hash of the name and zone to avoid any special characters in the name
// To generate it use:
//
// utils.HashStringAlphanumericLower(fmt.Sprintf("%s-%s", Name, Zone)
ID string `bson:"id"`
// Name is the unique name for a group of GPUs.
// This is used when attaching GPUs to a VM to create a host-agnostic identifier
//
// The name should be RFC1035 compliant, and is normally vendor/model, such as "nvidia/tesla-t4"
Name string `bson:"name"`
DisplayName string `bson:"displayName"`
Zone string `bson:"zone"`
Total int `bson:"total"`
Vendor string `bson:"vendor"`
VendorID string `bson:"vendorId"`
DeviceID string `bson:"deviceId"`
}
GpuGroup represents a group of GPUs for VM v2
type GpuLease ¶
type GpuLease struct {
ID string `bson:"id"`
GpuGroupID string `bson:"gpuGroupId"`
UserID string `bson:"userId"`
// VmID is set to attach the lease to a VM.
// If the lease is not attached to a VM, this field is nil.
VmID *string `bson:"vmId"`
LeaseDuration float64 `bson:"leaseDuration"`
ActivatedAt *time.Time `bson:"activatedAt,omitempty"`
AssignedAt *time.Time `bson:"assignedAt,omitempty"`
ExpiredAt *time.Time `bson:"expiredAt,omitempty"`
CreatedAt time.Time `bson:"createdAt"`
}
func (*GpuLease) IsActive ¶
IsActive returns true if the lease is active. An active lease is subject to be expired.
type GpuLeaseCreateParams ¶
func (GpuLeaseCreateParams) FromDTO ¶
func (g GpuLeaseCreateParams) FromDTO(dto *body.GpuLeaseCreate) GpuLeaseCreateParams
FromDTO converts body.GpuLeaseCreate DTO to GpuLeaseCreateParams.
type GpuLeaseUpdateParams ¶
func (GpuLeaseUpdateParams) FromDTO ¶
func (p GpuLeaseUpdateParams) FromDTO(dto *body.GpuLeaseUpdate) *GpuLeaseUpdateParams
FromDTO converts body.GpuLeaseUpdate DTO to GpuLeaseUpdateParams.
type Gravatar ¶
type Gravatar struct {
// URL is the URL to the gravatar image.
// If the URL is nil, the gravatar image has not been fetched yet, or the
// user does not have a gravatar image.
URL *string `bson:"url"`
FetchedAt time.Time `bson:"fetchedAt"`
}
func CreateEmptyGravatar ¶
func CreateEmptyGravatar() Gravatar
type Host ¶
type Host struct {
Name string `json:"name" bson:"name"`
DisplayName string `json:"displayName" bson:"displayName"`
Zone string `json:"zone" bson:"zone"`
IP string `json:"ip" bson:"ip"`
Port int `json:"port" bson:"port"`
Enabled bool `json:"enabled" bson:"enabled"`
// Schedulable is used to determine if a host is available for scheduling.
// If a host is not schedulable, it will not be used for scheduling and if it has any GPUs, they won't be synchronized.
// It is merely a synchronized state with the Kubernetes cluster to respect the host's state, such as when cordoning a node.
Schedulable bool `json:"schedulable" bson:"schedulable"`
DeactivatedUntil *time.Time `json:"deactivatedUntil,omitempty" bson:"deactivatedUntil,omitempty"`
LastSeenAt time.Time `json:"lastSeenAt" bson:"lastSeenAt"`
RegisteredAt time.Time `json:"registeredAt" bson:"registeredAt"`
}
func NewHostByParams ¶
func NewHostByParams(params *body.HostRegisterParams) *Host
func (*Host) ToVerboseDTO ¶
func (host *Host) ToVerboseDTO() body.HostVerboseRead
type HttpProxyCreateParams ¶
type HttpProxyUpdateParams ¶
type InitContainer ¶
type Job ¶
type Job struct {
ID string `bson:"id"`
UserID string `bson:"userId"`
Type string `bson:"type"`
Args map[string]interface{} `bson:"args"`
Version string `bson:"version"`
CreatedAt time.Time `bson:"createdAt"`
LastRunAt time.Time `bson:"lastRunAt,omitempty"`
FinishedAt time.Time `bson:"finishedAt,omitempty"`
RunAfter time.Time `bson:"runAfter,omitempty"`
Attempts int `bson:"attempts"`
Status string `bson:"status" `
ErrorLogs []string `bson:"errorLogs" `
}
type JobUpdateParams ¶
type JobUpdateParams struct {
Status *string `bson:"status" json:"status"`
}
func (*JobUpdateParams) FromDTO ¶
func (params *JobUpdateParams) FromDTO(jobUpdateDTO *body.JobUpdate)
type Notification ¶
type Notification struct {
ID string `bson:"id"`
UserID string `bson:"userId"`
Type string `bson:"type"`
Content map[string]interface{} `bson:"content"`
CreatedAt time.Time `bson:"createdAt"`
ReadAt time.Time `bson:"readAt,omitempty"`
ToastedAt time.Time `bson:"toastedAt,omitempty"`
CompletedAt time.Time `bson:"completedAt,omitempty"`
DeletedAt time.Time `bson:"deletedAt,omitempty"`
}
func (*Notification) ToDTO ¶
func (notification *Notification) ToDTO() body.NotificationRead
ToDTO converts a Notification to a body.NotificationRead DTO.
type On ¶
type On struct {
Push Push `yaml:"push"`
WorkflowDispatch struct{} `yaml:"workflow_dispatch"`
}
type Permissions ¶
type Permissions struct {
ChooseZone bool `yaml:"chooseZone" structs:"chooseZone"`
ChooseGPU bool `yaml:"chooseGpu" structs:"chooseGpu"`
UseCustomDomains bool `yaml:"useCustomDomains" structs:"useCustomDomains"`
UseGPUs bool `yaml:"useGpus" structs:"useGpus"`
UsePrivilegedGPUs bool `yaml:"usePrivilegedGpus" structs:"usePrivilegedGpus"`
// If non nil then use explicit value, if nil then we allow use of vms (for backward compatibilty).
// Only checked when creating a new VM, if a user already has a VM then we allow them to update it.
UseVms *bool `yaml:"useVms,omitempty" structs:"useVms,omitempty"`
}
type PodDeleted ¶
type Port ¶
type Port struct {
Name string `bson:"name"`
Port int `bson:"port"`
Protocol string `bson:"protocol"`
HttpProxy *PortHttpProxy `bson:"httpProxy,omitempty"`
}
type PortCreateParams ¶
type PortCreateParams struct {
Name string
Port int
Protocol string
HttpProxy *HttpProxyCreateParams
}
type PortHttpProxy ¶
type PortHttpProxy struct {
Name string `bson:"name,omitempty"`
CustomDomain *CustomDomain `bson:"customDomain,omitempty"`
}
type PortUpdateParams ¶
type PortUpdateParams struct {
Name string
Port int
Protocol string
HttpProxy *HttpProxyUpdateParams
}
type Quotas ¶
type Quotas struct {
CpuCores float64 `yaml:"cpuCores" structs:"cpuCores"`
RAM float64 `yaml:"ram" structs:"ram"`
DiskSize float64 `yaml:"diskSize" structs:"diskSize"`
Snapshots int `yaml:"snapshots" structs:"snapshots"`
GpuLeaseDuration float64 `yaml:"gpuLeaseDuration" structs:"gpuLeaseDuration"` // in hours
Gpus int `yaml:"gpus" structs:"gpus"`
}
type ReplicaStatus ¶
type ReplicaStatus struct {
// DesiredReplicas is the number of replicas that the deployment should have.
DesiredReplicas int `bson:"desiredReplicas"`
// ReadyReplicas is the number of replicas that are ready.
ReadyReplicas int `bson:"readyReplicas"`
// AvailableReplicas is the number of replicas that are available.
AvailableReplicas int `bson:"availableReplicas"`
UnavailableReplicas int `bson:"unavailableReplicas"`
}
type RequestAllocationMode ¶
type RequestAllocationMode string
RequestAllocationMode defines how GPUs should be allocated.
const ( RequestAllocationMode_None RequestAllocationMode = "" RequestAllocationMode_All RequestAllocationMode = "All" RequestAllocationMode_ExactCount RequestAllocationMode = "ExactCount" )
type RequestedGpu ¶
type RequestedGpu struct {
AllocationMode RequestAllocationMode `bson:"allocationMode"`
Capacity map[string]string `bson:"capacity,omitempty"` // e.g. memory: "16Gi"
Count *int64 `bson:"count,omitempty"`
DeviceClassName string `bson:"deviceClassName"`
Selectors []string `bson:"selectors,omitempty"`
Config *GpuDeviceConfiguration `bson:"config,omitempty"`
}
RequestedGpu describes the desired GPU configuration a workload requests.
type RequestedGpuCreate ¶
type RequestedGpuCreate struct {
RequestedGpu `mapstructure:",squash" json:",inline" bson:",inline"`
Name string `json:"name" bson:"name"`
}
type ResourceMigration ¶
type ResourceMigration struct {
ID string `bson:"id"`
ResourceID string `bson:"resourceId"`
UserID string `bson:"userId"`
Type string `bson:"type"`
ResourceType string `bson:"resourceType"`
Status string `bson:"status"`
Code *string `bson:"code"`
CreatedAt time.Time `bson:"createdAt"`
DeletedAt *time.Time `bson:"deletedAt,omitempty"`
UpdateOwner *ResourceMigrationUpdateOwner `bson:"updateOwner,omitempty"`
}
func (*ResourceMigration) ToDTO ¶
func (r *ResourceMigration) ToDTO() body.ResourceMigrationRead
ToDTO returns the resource migration to a body.ResourceMigrationDTO
type ResourceMigrationUpdateParams ¶
type ResourceMigrationUpdateParams struct {
Status string `bson:"status"`
}
func (ResourceMigrationUpdateParams) FromDTO ¶
func (r ResourceMigrationUpdateParams) FromDTO(dto *body.ResourceMigrationUpdate) *ResourceMigrationUpdateParams
type Role ¶
type Role struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
IamGroup string `yaml:"iamGroup"`
Permissions Permissions `yaml:"permissions"`
Quotas Quotas `yaml:"quotas"`
}
type SM ¶
type SM struct {
ID string `bson:"id"`
OwnerID string `bson:"ownerId"`
Zone string `bson:"zone"`
CreatedAt time.Time `bson:"createdAt"`
RepairedAt time.Time `bson:"repairedAt"`
DeletedAt time.Time `bson:"deletedAt"`
Activities map[string]Activity `bson:"activities"`
Subsystems SmSubsystems `bson:"subsystems"`
}
func (*SM) DoingActivity ¶
DoingActivity returns true if the deployment is doing the given activity.
type SmCreateParams ¶
type SmCreateParams struct {
Zone string `json:"zone" bson:"zone"`
}
type SmK8s ¶
type SmK8s struct {
Namespace k8sModels.NamespacePublic `bson:"namespace"`
DeploymentMap map[string]k8sModels.DeploymentPublic `bson:"deploymentMap,omitempty"`
ServiceMap map[string]k8sModels.ServicePublic `bson:"serviceMap,omitempty"`
IngressMap map[string]k8sModels.IngressPublic `bson:"ingressMap,omitempty"`
PvMap map[string]k8sModels.PvPublic `bson:"pvMap,omitempty"`
PvcMap map[string]k8sModels.PvcPublic `bson:"pvcMap,omitempty"`
}
func (*SmK8s) DeleteDeployment ¶
DeleteDeployment deletes the deployment from the DeploymentMap with the given name. It uses GetDeploymentMap to get the map to avoid nil pointer dereferences.
func (*SmK8s) DeleteIngress ¶
DeleteIngress deletes the ingress from the IngressMap with the given name. It uses GetIngressMap to get the map to avoid nil pointer dereferences.
func (*SmK8s) DeletePV ¶
DeletePV deletes the PV from the PvMap with the given name. It uses GetPvMap to get the map to avoid nil pointer dereferences.
func (*SmK8s) DeletePVC ¶
DeletePVC deletes the PVC from the PvcMap with the given name. It uses GetPvcMap to get the map to avoid nil pointer dereferences.
func (*SmK8s) DeleteService ¶
DeleteService deletes the service from the ServiceMap with the given name. It uses GetServiceMap to get the map to avoid nil pointer dereferences.
func (*SmK8s) GetDeployment ¶
func (k *SmK8s) GetDeployment(name string) *k8sModels.DeploymentPublic
GetDeployment returns the deployment with the given name. If a deployment with the given name does not exist, nil will be returned.
func (*SmK8s) GetDeploymentMap ¶
func (k *SmK8s) GetDeploymentMap() map[string]k8sModels.DeploymentPublic
GetDeploymentMap returns the deployment map of the deployment. If the map is nil, it will be initialized before returning.
func (*SmK8s) GetIngress ¶
func (k *SmK8s) GetIngress(name string) *k8sModels.IngressPublic
GetIngress returns the ingress with the given name. If an ingress with the given name does not exist, nil will be returned.
func (*SmK8s) GetIngressMap ¶
func (k *SmK8s) GetIngressMap() map[string]k8sModels.IngressPublic
GetIngressMap returns the ingress map of the deployment. If the map is nil, it will be initialized before returning.
func (*SmK8s) GetNamespace ¶
func (k *SmK8s) GetNamespace() *k8sModels.NamespacePublic
GetNamespace returns the namespace of the deployment.
func (*SmK8s) GetPV ¶
GetPV returns the PV with the given name. If a PV with the given name does not exist, nil will be returned.
func (*SmK8s) GetPVC ¶
GetPVC returns the PVC with the given name. If a PVC with the given name does not exist, nil will be returned.
func (*SmK8s) GetPvMap ¶
GetPvMap returns the pv map of the deployment. If the map is nil, it will be initialized before returning.
func (*SmK8s) GetPvcMap ¶
GetPvcMap returns the pvc map of the deployment. If the map is nil, it will be initialized before returning.
func (*SmK8s) GetService ¶
func (k *SmK8s) GetService(name string) *k8sModels.ServicePublic
GetService returns the service with the given name. If a service with the given name does not exist, nil will be returned.
func (*SmK8s) GetServiceMap ¶
func (k *SmK8s) GetServiceMap() map[string]k8sModels.ServicePublic
GetServiceMap returns the service map of the deployment. If the map is nil, it will be initialized before returning.
type SmSubsystems ¶
type SmSubsystems struct {
K8s DeploymentK8s `bson:"k8s"`
Harbor DeploymentHarbor `bson:"harbor"`
}
type SnapshotV2 ¶
func (*SnapshotV2) ToDTOv2 ¶
func (sc *SnapshotV2) ToDTOv2() body.VmSnapshotRead
ToDTOv2 converts a Snapshot to a body.VmSnapshotRead.
type Subsystems ¶
type Subsystems struct {
K8s VmK8s `bson:"k8s"`
}
type Team ¶
type Team struct {
ID string `bson:"id"`
Name string `bson:"name"`
Description string `bson:"description"`
OwnerID string `bson:"ownerId"`
CreatedAt time.Time `bson:"createdAt"`
UpdatedAt time.Time `bson:"updatedAt"`
ResourceMap map[string]TeamResource `bson:"resourceMap"`
MemberMap map[string]TeamMember `bson:"memberMap"`
}
func (*Team) AddMember ¶
func (t *Team) AddMember(member TeamMember)
func (*Team) AddResource ¶
func (t *Team) AddResource(resource TeamResource)
func (*Team) GetMember ¶
func (t *Team) GetMember(id string) *TeamMember
func (*Team) GetMemberMap ¶
func (t *Team) GetMemberMap() map[string]TeamMember
func (*Team) GetResource ¶
func (t *Team) GetResource(id string) *TeamResource
func (*Team) GetResourceMap ¶
func (t *Team) GetResourceMap() map[string]TeamResource
func (*Team) HasResource ¶
func (*Team) RemoveMember ¶
func (*Team) RemoveResource ¶
func (*Team) ToDTO ¶
func (t *Team) ToDTO(getMember func(*TeamMember) *body.TeamMember, getResourceName func(*TeamResource) *string) body.TeamRead
ToDTO converts a Team to a body.TeamRead DTO.
type TeamCreateParams ¶
type TeamCreateParams struct {
Name string
Description string
ResourceMap map[string]TeamResource
MemberMap map[string]TeamMember
}
func (*TeamCreateParams) FromDTO ¶
func (params *TeamCreateParams) FromDTO(teamCreateDTO *body.TeamCreate, ownerID string, getResourceFunc func(string) *TeamResource, getMemberFunc func(*body.TeamMemberCreate) *TeamMember)
FromDTO converts a body.TeamCreate DTO to a NotificationCreateParams.
type TeamJoinParams ¶
type TeamJoinParams struct {
InvitationCode string
}
func (*TeamJoinParams) FromDTO ¶
func (params *TeamJoinParams) FromDTO(teamJoinDTO *body.TeamJoin)
FromDTO converts a body.TeamJoin DTO to a JoinParams.
type TeamMember ¶
type TeamResource ¶
type TeamUpdateParams ¶
type TeamUpdateParams struct {
Name *string
Description *string
MemberMap *map[string]TeamMember
ResourceMap *map[string]TeamResource
}
func (*TeamUpdateParams) FromDTO ¶
func (params *TeamUpdateParams) FromDTO(teamUpdateDTO *body.TeamUpdate, owner *TeamMember, getResourceFunc func(string) *TeamResource, getMemberFunc func(*body.TeamMemberUpdate) *TeamMember)
FromDTO converts a body.TeamUpdate DTO to an UpdateParams.
type User ¶
type User struct {
ID string `bson:"id"`
Username string `bson:"username"`
FirstName string `bson:"firstName"`
LastName string `bson:"lastName"`
Email string `bson:"email"`
Gravatar Gravatar `bson:"gravatar"`
IsAdmin bool `bson:"isAdmin"`
EffectiveRole EffectiveRole `bson:"effectiveRole"`
PublicKeys []PublicKey `bson:"publicKeys,omitempty"`
ApiKeys []ApiKey `bson:"apiKeys,omitempty"`
UserData []UserData `bson:"userData,omitempty"`
LastAuthenticatedAt time.Time `bson:"lastAuthenticatedAt"`
}
type UserSynchronizeParams ¶
type UserUpdateParams ¶
func (UserUpdateParams) FromDTO ¶
func (params UserUpdateParams) FromDTO(userUpdateDTO *body.UserUpdate, currentApiKeys []ApiKey) UserUpdateParams
FromDTO converts a body.UserUpdate DTO to a UserUpdateParams.
type UserUsage ¶
type VM ¶
type VM struct {
ID string `bson:"id"`
Name string `bson:"name"`
Version string `bson:"version"`
Zone string `bson:"zone"`
OwnerID string `bson:"ownerId"`
CreatedAt time.Time `bson:"createdAt"`
UpdatedAt time.Time `bson:"updatedAt,omitempty"`
RepairedAt time.Time `bson:"repairedAt,omitempty"`
DeletedAt time.Time `bson:"deletedAt,omitempty"`
AccessedAt time.Time `bson:"accessedAt"`
NeverStale bool `bson:"neverStale"`
SshPublicKey string `bson:"sshPublicKey"`
PortMap map[string]Port `bson:"portMap"`
Specs VmSpecs `bson:"specs"`
Subsystems Subsystems `bson:"subsystems"`
Activities map[string]Activity `bson:"activities"`
// Host is the host where the VM is running
// It is set by the status updater worker
Host *VmHost `bson:"host,omitempty"`
// Status is the current status of a VM instance
// It is set by the status updater worker
Status string `bson:"status"`
}
func (*VM) BeingCreated ¶
func (*VM) BeingDeleted ¶
func (*VM) DoingActivity ¶
func (*VM) DoingOneOfActivities ¶
func (*VM) GetHttpProxyURL ¶
GetHttpProxyURL returns the URL of a VM's HTTP proxy. If the K8s ingress does not exist, it will return nil, or if the ingress does not have a host, it will return nil.
type VmActionParams ¶
type VmActionParams struct {
Action string
}
func (VmActionParams) FromDTOv2 ¶
func (p VmActionParams) FromDTOv2(dto *body.VmActionCreate) VmActionParams
FromDTOv2 converts a dto.Action to a VmActionParams.
type VmCreateParams ¶
type VmCreateParams struct {
Name string
Zone string
SshPublicKey string
PortMap map[string]PortCreateParams
CpuCores int
RAM int
DiskSize int
NeverStale bool
}
func (VmCreateParams) FromDTOv2 ¶
func (p VmCreateParams) FromDTOv2(dto *body.VmCreate, fallbackZone *string) VmCreateParams
FromDTOv2 converts a body.VmCreate to a NotificationCreateParams.
type VmK8s ¶
type VmK8s struct {
Namespace k8sModels.NamespacePublic `bson:"namespace"`
DeploymentMap map[string]k8sModels.DeploymentPublic `bson:"deploymentMap,omitempty"`
ServiceMap map[string]k8sModels.ServicePublic `bson:"serviceMap,omitempty"`
IngressMap map[string]k8sModels.IngressPublic `bson:"ingressMap,omitempty"`
SecretMap map[string]k8sModels.SecretPublic `bson:"secretMap,omitempty"`
NetworkPolicyMap map[string]k8sModels.NetworkPolicyPublic `bson:"networkPolicyMap,omitempty"`
// Deprecated: VmMap is deprecated and will be removed in a future release
// Use the VM field instead
VmMap map[string]k8sModels.VmPublic `bson:"vmMap,omitempty"`
VM k8sModels.VmPublic `bson:"vm"`
PvcMap map[string]k8sModels.PvcPublic `bson:"pvcMap,omitempty"`
PvMap map[string]k8sModels.PvPublic `bson:"pvMap,omitempty"`
VmSnapshotMap map[string]k8sModels.VmSnapshotPublic `bson:"vmSnapshotMap,omitempty"`
}
func (*VmK8s) GetDeployment ¶
func (k8s *VmK8s) GetDeployment(name string) *k8sModels.DeploymentPublic
GetDeployment returns the deployment of the VM. If the deployment does not exist, nil is returned
func (*VmK8s) GetDeploymentMap ¶
func (k8s *VmK8s) GetDeploymentMap() map[string]k8sModels.DeploymentPublic
GetDeploymentMap returns the deployment map of the VM. If the map is nil, it will be initialized before returning
func (*VmK8s) GetIngress ¶
func (k8s *VmK8s) GetIngress(name string) *k8sModels.IngressPublic
GetIngress returns the ingress of the VM. If the ingress does not exist, nil is returned
func (*VmK8s) GetIngressMap ¶
func (k8s *VmK8s) GetIngressMap() map[string]k8sModels.IngressPublic
GetIngressMap returns the ingress map of the VM. If the map is nil, it will be initialized before returning
func (*VmK8s) GetNetworkPolicy ¶
func (k8s *VmK8s) GetNetworkPolicy(name string) *k8sModels.NetworkPolicyPublic
GetNetworkPolicy returns the network policy of the VM. If the network policy does not exist, nil is returned
func (*VmK8s) GetNetworkPolicyMap ¶
func (k8s *VmK8s) GetNetworkPolicyMap() map[string]k8sModels.NetworkPolicyPublic
GetNetworkPolicyMap returns the network policy map of the VM. If the map is nil, it will be initialized before returning
func (*VmK8s) GetPvMap ¶
GetPvMap returns the PV map of the VM. If the map is nil, it will be initialized before returning
func (*VmK8s) GetPvcMap ¶
GetPvcMap returns the PVC map of the VM. If the map is nil, it will be initialized before returning
func (*VmK8s) GetSecret ¶
func (k8s *VmK8s) GetSecret(name string) *k8sModels.SecretPublic
GetSecret returns the secret of the VM. If the secret does not exist, nil is returned
func (*VmK8s) GetSecretMap ¶
func (k8s *VmK8s) GetSecretMap() map[string]k8sModels.SecretPublic
GetSecretMap returns the secret map of the VM. If the map is nil, it will be initialized before returning
func (*VmK8s) GetService ¶
func (k8s *VmK8s) GetService(name string) *k8sModels.ServicePublic
GetService returns the service of the VM. If the service does not exist, nil is returned
func (*VmK8s) GetServiceMap ¶
func (k8s *VmK8s) GetServiceMap() map[string]k8sModels.ServicePublic
GetServiceMap returns the service map of the VM. If the map is nil, it will be initialized before returning
func (*VmK8s) GetVmSnapshotByID ¶
func (k8s *VmK8s) GetVmSnapshotByID(id string) *k8sModels.VmSnapshotPublic
GetVmSnapshotByID returns a snapshot in the VM by ID. If the snapshot does not exist, nil is returned
func (*VmK8s) GetVmSnapshotByName ¶
func (k8s *VmK8s) GetVmSnapshotByName(name string) *k8sModels.VmSnapshotPublic
GetVmSnapshotByName returns a snapshot in the VM by name. If the snapshot does not exist, nil is returned
func (*VmK8s) GetVmSnapshotMap ¶
func (k8s *VmK8s) GetVmSnapshotMap() map[string]k8sModels.VmSnapshotPublic
GetVmSnapshotMap returns the vm snapshot map of the VM. If the map is nil, it will be initialized before returning
type VmPort ¶
type VmPort struct {
PublicPort int `bson:"publicPort"`
Zone string `bson:"zone"`
Lease *VmPortLease `bson:"lease"`
}
type VmPortLease ¶
type VmUpdateOwnerParams ¶
type VmUpdateParams ¶
type VmUpdateParams struct {
Name *string
OwnerID *string
SnapshotID *string
PortMap *map[string]PortUpdateParams
CpuCores *int
RAM *int
NeverStale *bool
}
func (VmUpdateParams) FromDTOv2 ¶
func (p VmUpdateParams) FromDTOv2(dto *body.VmUpdate) VmUpdateParams
FromDTOv2 converts a body.VmUpdate to a UpdateParams.
type WorkerStatus ¶
type WorkerStatus struct {
Name string `bson:"name"`
Status string `bson:"status"`
ReportedAt time.Time `bson:"reportedAt"`
}
func (*WorkerStatus) ToDTO ¶
func (ws *WorkerStatus) ToDTO() body.WorkerStatusRead
ToDTO converts a WorkerStatus to a body.WorkerStatusRead DTO.
Source Files
¶
- activity.go
- api_key.go
- custom_domain.go
- deployment.go
- deployment_convert.go
- deployment_params.go
- deployment_related.go
- deployment_subsystems.go
- discover.go
- event.go
- event_params.go
- github_ci.go
- gpu_claim.go
- gpu_claim_params.go
- gpu_claim_subsystems.go
- gpu_group.go
- gpu_lease.go
- gpu_lease_convert.go
- gpu_lease_params.go
- host.go
- job.go
- job_convert.go
- notification.go
- permissions.go
- quotas.go
- resource.go
- resource_migration.go
- resource_migration_params.go
- role.go
- sm.go
- sm_dto.go
- sm_params.go
- sm_related.go
- sm_subsystems.go
- snapshot.go
- team.go
- team_convert.go
- team_params.go
- user.go
- user_convert.go
- user_params.go
- vm.go
- vm_convert.go
- vm_params.go
- vm_port.go
- vm_related.go
- vm_subsystems.go
- worker_status.go
- zone.go