Closed nxtcoder36 closed 1 week ago
This pull request updates the cluster up command and box ssh command, focusing on team context switching and error handling. The changes improve the user experience by providing a prompt when switching teams and enhance error reporting across multiple files.
sequenceDiagram
participant User
participant Client
participant FileClient
participant Cluster
participant APIClient
User->>Client: Start()
Client->>FileClient: GetExtraData()
alt Error
Client->>User: Return error
end
alt Team context switch needed
Client->>User: Prompt for team switch
User->>Client: Confirm switch
Client->>FileClient: SaveExtraData()
Client->>Cluster: StopK3sServer()
Client->>APIClient: GetClusterConfig()
Client->>APIClient: GetAccVPNConfig()
end
Client->>Client: startContainer()
alt Error
Client->>User: Return error
end
journey
title Team Context Switching
section Start Command
User: 5: Start command
System: 4: Check current team
System: 3: Prompt for team switch if needed
User: 4: Confirm team switch
System: 5: Save new team context
System: 5: Stop K3s server
System: 5: Fetch cluster and VPN config
section Up Command
System: 5: Start K3s server
System: 4: Check and set team context
System: 5: Create cluster teams
User: 5: Receive confirmation of server start
classDiagram
class client {
+Start() error
}
class fileclient {
+GetExtraData() ExtraData
+SaveExtraData(data ExtraData) error
}
class cluster {
+StopK3sServer(cmd Command) error
}
class apiclient {
+GetClusterConfig(teamName string) (Config, error)
+GetAccVPNConfig(teamName string) (Config, error)
}
client --> fileclient
client --> cluster
client --> apiclient
class ExtraData {
+string SelectedTeam
+map[string]Env SelectedEnvs
}
class Env {
+int SSHPort
}
Change | Details | Files |
---|---|---|
Implement team context switching in box start command |
|
cmd/box/boxpkg/start.go |
Enhance error handling and team selection in cluster up command |
|
cmd/cluster/up.go |
Minor updates to the use team command |
|
cmd/use/account.go |
Summary by Sourcery
Update the 'cluster up' and 'box ssh' commands to improve team context management and error handling. Introduce a confirmation step when switching teams and ensure the selected team is saved in the extra data file. Enhance error handling in the K3s server startup process.
Enhancements: