-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zachary Seguin
committed
Aug 11, 2020
1 parent
a8363a5
commit e3bcdf7
Showing
5 changed files
with
356 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package main | ||
|
||
import "net/http" | ||
|
||
type ConfigurationsConfiguration struct { | ||
Value []string `yaml:"value" json:"value"` | ||
ReadOnly bool `yaml:"readOnly" json:"readOnly"` | ||
} | ||
|
||
type SharedMemoryConfiguration struct { | ||
Value bool `yaml:"value" json:"value"` | ||
ReadOnly bool `yaml:"readOnly" json:"readOnly"` | ||
} | ||
|
||
type GPUVendorConfiguration struct { | ||
LimitsKey string `yaml:"limitsKey" json:"limitsKey"` | ||
UIName string `yaml:"uiName" json:"uiName"` | ||
} | ||
|
||
type GPUValueConfiguration struct { | ||
Quantity string `yaml:"num" json:"num"` | ||
Vendors []GPUVendorConfiguration `yaml:"vendors" json:"vendors"` | ||
Vendor string `yaml:"vendor" json:"vendor"` | ||
} | ||
|
||
type GPUConfiguration struct { | ||
Value GPUValueConfiguration `yaml:"value" json:"value"` | ||
ReadOnly bool `yaml:"readOnly" json:"readOnly"` | ||
} | ||
|
||
type ValueConfiguration struct { | ||
Value string `yaml:"value" json:"value"` | ||
} | ||
|
||
type VolumeValueConfiguration struct { | ||
Type ValueConfiguration `yaml:"type" json:"type"` | ||
Name ValueConfiguration `yaml:"name" json:"name"` | ||
Size ValueConfiguration `yaml:"size" json:"size"` | ||
MountPath ValueConfiguration `yaml:"mountPath" json:"mountPath"` | ||
AccessModes ValueConfiguration `yaml:"accessModes" json:"accessModes"` | ||
Class ValueConfiguration `yaml:"class" json:"class"` | ||
} | ||
|
||
type DataVolumesConfiguration struct { | ||
Values []VolumeValueConfiguration `yaml:"value" json:"value"` | ||
ReadOnly bool `yaml:"readOnly" json:"readOnly"` | ||
} | ||
|
||
type WorkspaceVolumeConfiguration struct { | ||
Value VolumeValueConfiguration `yaml:"value" json:"value"` | ||
ReadOnly bool `yaml:"readOnly" json:"readOnly"` | ||
} | ||
|
||
type ResourceConfiguration struct { | ||
Value string `yaml:"value" json:"value"` | ||
ReadOnly bool `yaml:"readOnly" json:"readOnly"` | ||
} | ||
|
||
type ImageConfiguration struct { | ||
Value string `yaml:"value" json:"value"` | ||
Options []string `yaml:"options" json:"options"` | ||
ReadOnly bool `yaml:"readOnly" json:"readOnly"` | ||
HideRegistry bool `yaml:"hideRegistry" json:"hideRegistry"` | ||
HideVersion bool `yaml:"hideVersion" json:"hideVersion"` | ||
} | ||
|
||
type SpawnerFormDefaults struct { | ||
Image ImageConfiguration `yaml:"image" json:"image"` | ||
CPU ResourceConfiguration `yaml:"cpu" json:"cpu"` | ||
Memory ResourceConfiguration `yaml:"memory" json:"memory"` | ||
WorkspaceVolume WorkspaceVolumeConfiguration `yaml:"workspaceVolume" json:"workspaceVolume"` | ||
DataVolumes DataVolumesConfiguration `yaml:"dataVolumes" json:"dataVolumes"` | ||
GPUs GPUConfiguration `yaml:"gpus" json:"gpus"` | ||
SharedMemory SharedMemoryConfiguration `yaml:"shm" json:"shm"` | ||
Configurations ConfigurationsConfiguration `yaml:"configurations" json:"configurations"` | ||
} | ||
|
||
type Configuration struct { | ||
SpawnerFormDefaults SpawnerFormDefaults `yaml:"spawnerFormDefaults" json:"spawnerFormDefaults"` | ||
} | ||
|
||
type configresponse struct { | ||
APIResponse | ||
Config SpawnerFormDefaults `json:"config"` | ||
} | ||
|
||
func (s *server) GetConfig(w http.ResponseWriter, r *http.Request) { | ||
s.respond(w, r, configresponse{ | ||
APIResponse: APIResponse{ | ||
Success: true, | ||
}, | ||
Config: s.Config.SpawnerFormDefaults, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.