started kubernetes support

This commit is contained in:
ACoolName 2025-04-05 17:14:28 +03:00
parent 8b74b73704
commit 37c42772fe
4 changed files with 59 additions and 34 deletions

1
go.mod
View File

@ -62,6 +62,7 @@ require (
golang.org/x/time v0.11.0 // indirect
gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect
gotest.tools/v3 v3.5.2 // indirect
k8s.io/client-go v0.32.3 // indirect
)
require (

2
go.sum
View File

@ -268,5 +268,7 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
k8s.io/client-go v0.32.3 h1:RKPVltzopkSgHS7aS98QdscAgtgah/+zmpAogooIqVU=
k8s.io/client-go v0.32.3/go.mod h1:3v0+3k4IcT9bXTc4V2rt+d2ZPPG700Xy6Oi0Gdl2PaY=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=

View File

@ -12,61 +12,78 @@ type InstanceManager struct {
instancemanager.InstanceManager
}
//General
// General
// Read Only
func (i *InstanceManager) GetImage(ctx context.Context, imageId string) (*instancemanager.Image, error) {
return nil, nil
}
func (self *InstanceManager) GetImage(ctx context.Context, imageId string) (*instancemanager.Image, error) {
func (i *InstanceManager) ListImages(ctx context.Context) ([]instancemanager.Image, error) {
return nil, nil
}
func (self *InstanceManager) ListImages(ctx context.Context) ([]instancemanager.Image, error) {
func (i *InstanceManager) GetServer(ctx context.Context, serverId string) (*instancemanager.Server, error) {
return nil, nil
}
func (self *InstanceManager) GetServer(ctx context.Context, serverId string) (*instancemanager.Server, error) {
return nil, nil
}
func (self *InstanceManager) ListServers(ctx context.Context) ([]instancemanager.Server, error) {
func (i *InstanceManager) ListServers(ctx context.Context) ([]instancemanager.Server, error) {
return nil, nil
}
// State Changing
func (self *InstanceManager) StartServer(ctx context.Context, serverId string, imageId string, command string, ports []models.Port) error {
return nil
}
func (self *InstanceManager) StopServer(ctx context.Context, serverId string) error {
func (i *InstanceManager) StartServer(ctx context.Context, serverId string, imageId string, command string, ports []models.Port) error {
return nil
}
func (self *InstanceManager) CreateServer(ctx context.Context) (*instancemanager.Server, error) {
return nil, nil
}
func (self *InstanceManager) DeleteServer(ctx context.Context, serverId string) error {
func (i *InstanceManager) StopServer(ctx context.Context, serverId string) error {
return nil
}
// Terminal {return nil, nil}
// Status Changing {return nil, nil}
func (self *InstanceManager) InteractiveTerminal(ctx context.Context, serverId string) (*net.Conn, error) {
func (i *InstanceManager) CreateServer(ctx context.Context) (*instancemanager.Server, error) {
return nil, nil
}
func (self *InstanceManager) ResizeTerminal(ctx context.Context, serverId string, width uint, height uint) error {
func (i *InstanceManager) DeleteServer(ctx context.Context, serverId string) error {
return nil
}
// File Browser {return nil, nil}
// Terminal
// Read Only {return nil, nil}
func (self *InstanceManager) GetFileBrowser(ctx context.Context, serverId string) (*models.FileBrowser, error) {
return nil, nil
}
func (self *InstanceManager) ListFileBrowsers(ctx context.Context) ([]models.FileBrowser, error) {
// Status Changing
func (i *InstanceManager) InteractiveTerminal(ctx context.Context, serverId string) (*net.Conn, error) {
return nil, nil
}
// Status Changing {return nil, nil}
func (self *InstanceManager) StartFileBrowser(ctx context.Context, serverId string) (*models.FileBrowser, error) {
return nil, nil
}
func (self *InstanceManager) StopFileBrowser(ctx context.Context, serverId string) error {
func (i *InstanceManager) ResizeTerminal(ctx context.Context, serverId string, width uint, height uint) error {
return nil
}
// File Browser
// Read Only
func (i *InstanceManager) GetFileBrowser(ctx context.Context, serverId string) (*models.FileBrowser, error) {
return nil, nil
}
func (i *InstanceManager) ListFileBrowsers(ctx context.Context) ([]models.FileBrowser, error) {
return nil, nil
}
// Status Changing
func (i *InstanceManager) StartFileBrowser(ctx context.Context, serverId string) (*models.FileBrowser, error) {
return nil, nil
}
func (i *InstanceManager) StopFileBrowser(ctx context.Context, serverId string) error {
return nil
}
func NewInstanceManager(config models.KubernetesInstanceManagerConfig) (*InstanceManager, error) {
if err != nil {
return nil, err
}
defer apiClient.Close()
return &InstanceManager{}, nil
}

View File

@ -46,7 +46,7 @@ type UserPassAuthConfig struct {
type AuthenticationConfig struct {
Type AuthMode `yaml:"type"`
Oidc OidcAuthConfig `yaml:"oidc"`
NOidc OidcAuthConfig `yaml:"oidc"`
UserPass UserPassAuthConfig `yaml:"user_pass"`
}
@ -68,9 +68,14 @@ type DockerInstanceManagerConfig struct {
FileBrowser FileBrowserConfig `yaml:"file_browser"`
}
type KubernetesInstanceManagerConfig struct {
Namespace string `yaml:"namespace"`
}
type InstanceManagerConfig struct {
Type InstanceManagerType `yaml:"type"`
Docker *DockerInstanceManagerConfig `yaml:"docker"`
Type InstanceManagerType `yaml:"type"`
Docker *DockerInstanceManagerConfig `yaml:"docker"`
Kubernetes *KubernetesInstanceManagerConfig `yaml:"kubernetes"`
}
type ServersDatabaseConfig struct {