Skip to content

Commit 414e022

Browse files
committed
FEATURE: Add foundation for zk and cluster management
1 parent 6a17d60 commit 414e022

25 files changed

Lines changed: 591 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Set up Go
1313
uses: actions/setup-go@v5
1414
with:
15-
go-version: '1.24.6'
15+
go-version: '1.25.0'
1616
- name: Cache Go modules
1717
uses: actions/cache@v4
1818
with:

cmd/cluster/cluster.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package cluster
2+
3+
import "github.com/spf13/cobra"
4+
5+
var ClusterCmd = &cobra.Command{
6+
Use: "cluster",
7+
Short: "Manage Arcus clusters",
8+
}
9+
10+
func init() {
11+
ClusterCmd.AddCommand(deployCmd)
12+
ClusterCmd.AddCommand(startCmd)
13+
ClusterCmd.AddCommand(stopCmd)
14+
ClusterCmd.AddCommand(deleteCmd)
15+
ClusterCmd.AddCommand(listCmd)
16+
ClusterCmd.AddCommand(statusCmd)
17+
}

cmd/cluster/delete.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package cluster
2+
3+
import "github.com/spf13/cobra"
4+
5+
var deleteCmd = &cobra.Command{
6+
Use: "delete <servicecode>",
7+
Short: "Delete an Arcus cluster",
8+
Args: cobra.ExactArgs(1),
9+
Run: func(cmd *cobra.Command, args []string) {
10+
// TODO: delete 구현
11+
},
12+
}

cmd/cluster/deploy.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package cluster
2+
3+
import "github.com/spf13/cobra"
4+
5+
var deployCmd = &cobra.Command{
6+
Use: "deploy <version> <topology.yml>",
7+
Short: "Deploy a new Arcus cluster",
8+
Args: cobra.ExactArgs(2),
9+
Run: func(cmd *cobra.Command, args []string) {
10+
// TODO: deploy 구현
11+
},
12+
}

cmd/cluster/list.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package cluster
2+
3+
import "github.com/spf13/cobra"
4+
5+
var listCmd = &cobra.Command{
6+
Use: "list",
7+
Short: "List managed Arcus clusters",
8+
Args: cobra.NoArgs,
9+
Run: func(cmd *cobra.Command, args []string) {
10+
// TODO: list 구현
11+
},
12+
}

cmd/cluster/start.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package cluster
2+
3+
import "github.com/spf13/cobra"
4+
5+
var startCmd = &cobra.Command{
6+
Use: "start <servicecode> [--node <address>]",
7+
Short: "Start an Arcus cluster",
8+
Args: cobra.ExactArgs(1),
9+
Run: func(cmd *cobra.Command, args []string) {
10+
// TODO: start 구현
11+
},
12+
}
13+
14+
func init() {
15+
startCmd.Flags().String("node", "", "address of the specific node to start")
16+
}

cmd/cluster/status.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package cluster
2+
3+
import "github.com/spf13/cobra"
4+
5+
var statusCmd = &cobra.Command{
6+
Use: "status <servicecode>",
7+
Short: "Show status of an Arcus cluster",
8+
Args: cobra.ExactArgs(1),
9+
Run: func(cmd *cobra.Command, args []string) {
10+
// TODO: status 구현
11+
},
12+
}

cmd/cluster/stop.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package cluster
2+
3+
import "github.com/spf13/cobra"
4+
5+
var stopCmd = &cobra.Command{
6+
Use: "stop <servicecode> [--node <address>]",
7+
Short: "Stop an Arcus cluster",
8+
Args: cobra.ExactArgs(1),
9+
Run: func(cmd *cobra.Command, args []string) {
10+
// TODO: stop 구현
11+
},
12+
}
13+
14+
func init() {
15+
stopCmd.Flags().String("node", "", "address of the specific node to stop")
16+
}

cmd/connect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ credentials are provided, SASL SCRAM-SHA-256 authentication will be performed.`,
3838
if err != nil {
3939
panic(err)
4040
}
41-
defer conn.Close()
41+
defer func() { _ = conn.Close() }()
4242

4343
if len(args) == 2 {
4444
username, password, _ := strings.Cut(args[1], ":")

cmd/root.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"runtime/debug"
77

88
"github.com/jam2in/arcusctl/cmd/acl"
9+
"github.com/jam2in/arcusctl/cmd/cluster"
10+
"github.com/jam2in/arcusctl/cmd/zk"
911
"github.com/jam2in/arcusctl/internal"
1012
"github.com/spf13/cobra"
1113
)
@@ -35,6 +37,8 @@ func init() {
3537
rootCmd.AddCommand(versionCmd)
3638
rootCmd.AddCommand(acl.RootCmd)
3739
rootCmd.AddCommand(connectCmd)
40+
rootCmd.AddCommand(zk.ZKCmd)
41+
rootCmd.AddCommand(cluster.ClusterCmd)
3842

3943
cobra.OnInitialize(internal.InitConfig)
4044
}

0 commit comments

Comments
 (0)