Skip to content

Commit

Permalink
docs: change blog url (#5251)
Browse files Browse the repository at this point in the history
Signed-off-by: Carson Yang <[email protected]>

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: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

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
yangchuansheng authored and bearslyricattack committed Dec 20, 2024
1 parent 20c9ce5 commit 384d288
Show file tree
Hide file tree
Showing 6 changed files with 263 additions and 84 deletions.
15 changes: 13 additions & 2 deletions controllers/devbox/api/v1alpha1/devbox_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,20 @@ type RuntimeRef struct {

type NetworkSpec struct {
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum=NodePort;Tailnet
// +kubebuilder:validation:Enum=NodePort;Tailnet;WebSocket
Type NetworkType `json:"type"`
// +kubebuilder:validation:Optional
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 Expand Up @@ -118,7 +129,7 @@ type DevboxSpec struct {

type NetworkStatus struct {
// +kubebuilder:default=NodePort
// +kubebuilder:validation:Enum=NodePort;Tailnet
// +kubebuilder:validation:Enum=NodePort;Tailnet;WebSocket
Type NetworkType `json:"type"`

// +kubebuilder:validation:Optional
Expand Down
20 changes: 18 additions & 2 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", "jpillora/chisel", "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,6 +204,12 @@ func main() {
RequestEphemeralStorage: requestEphemeralStorage,
LimitEphemeralStorage: limitEphemeralStorage,
DebugMode: debugMode,
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 384d288

Please sign in to comment.