Skip to content

Commit

Permalink
feat:devbox controller support websocket
Browse files Browse the repository at this point in the history
feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

feat:devbox controller support websocket

chore(fmt): format code

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

feat:websocket auto shutdown

feat:websocket auto shutdown

chore(fmt): format code

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

feat:websocket auto shutdown

chore(fmt): format code

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

feat:websocket auto shutdown

feat:websocket auto shutdown
  • Loading branch information
bearslyricattack committed Dec 20, 2024
1 parent 44b86a6 commit 8efd4fe
Show file tree
Hide file tree
Showing 4 changed files with 252 additions and 87 deletions.
11 changes: 11 additions & 0 deletions controllers/devbox/api/v1alpha1/devbox_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ type NetworkSpec struct {
ExtraPorts []corev1.ContainerPort `json:"extraPorts"`
}

type AutoShutdownSpec struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
Enable bool `json:"type"`
// +kubebuilder:validation:Optional
Time string `json:"time"`
}

// DevboxSpec defines the desired state of Devbox
type DevboxSpec struct {
// +kubebuilder:validation:Required
Expand All @@ -88,6 +96,9 @@ type DevboxSpec struct {
// +kubebuilder:validation:Required
NetworkSpec NetworkSpec `json:"network,omitempty"`

// +kubebuilder:validation:Optional
AutoShutdownSpec AutoShutdownSpec `json:"autoShutdown,omitempty"`

// todo add rewrite labels and annotations...
// +kubebuilder:validation:Optional
ExtraLabels map[string]string `json:"extraLabels,omitempty"`
Expand Down
21 changes: 18 additions & 3 deletions controllers/devbox/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ func main() {
var requestEphemeralStorage string
var limitEphemeralStorage string
var debugMode bool
var WebSocketImage string
var webSocketImage string
var websocketProxyDomain string
var ingressClass string
var enableAutoShutdown bool
var shutdownServerKey string
var shutdownServerAddr string
flag.StringVar(&registryAddr, "registry-addr", "sealos.hub:5000", "The address of the registry")
flag.StringVar(&registryUser, "registry-user", "admin", "The user of the registry")
flag.StringVar(&registryPassword, "registry-password", "passw0rd", "The password of the registry")
Expand All @@ -94,7 +99,12 @@ func main() {
flag.Float64Var(&requestMemoryRate, "request-memory-rate", 10, "The request rate of memory limit in devbox.")
flag.StringVar(&requestEphemeralStorage, "request-ephemeral-storage", "500Mi", "The request value of ephemeral storage in devbox.")
flag.StringVar(&limitEphemeralStorage, "limit-ephemeral-storage", "10Gi", "The limit value of ephemeral storage in devbox.")
flag.StringVar(&WebSocketImage, "websocket-image", "bearslyricattack/chisel:1.0", "The image name of devbox websocket proxy pod")
flag.StringVar(&webSocketImage, "websocket-image", "cbluebird/wst:v0.0.4", "The image name of devbox websocket proxy pod.")
flag.StringVar(&websocketProxyDomain, "websocket-proxy-domain", "sealoshzh.site", "The websocket proxy domain of devbox ingress.")
flag.StringVar(&ingressClass, "ingress-class", "nginx", "The ingress class name.")
flag.BoolVar(&enableAutoShutdown, "enable-auto-shutdown", true, "If set, Devbox auto shutdown will be enabled.")
flag.StringVar(&shutdownServerKey, "shutdown-server-key", "sealos-devbox-shutdown", "The server key used to shutdown the server.")
flag.StringVar(&shutdownServerAddr, "shutdown-server-addr", "http://shutdown-service:8082", "The shutdown server address.")
opts := zap.Options{
Development: true,
}
Expand Down Expand Up @@ -194,7 +204,12 @@ func main() {
RequestEphemeralStorage: requestEphemeralStorage,
LimitEphemeralStorage: limitEphemeralStorage,
DebugMode: debugMode,
WebSocketImage: WebSocketImage,
WebSocketImage: webSocketImage,
WebsocketProxyDomain: websocketProxyDomain,
IngressClass: ingressClass,
EnableAutoShutdown: enableAutoShutdown,
ShutdownServerKey: shutdownServerKey,
ShutdownServerAddr: shutdownServerAddr,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Devbox")
os.Exit(1)
Expand Down
Loading

0 comments on commit 8efd4fe

Please sign in to comment.