Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.6'
go-version: '1.25.0'
- name: Cache Go modules
uses: actions/cache@v4
with:
Expand Down
17 changes: 17 additions & 0 deletions cmd/cluster/cluster.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cluster

import "github.com/spf13/cobra"

var ClusterCmd = &cobra.Command{
Use: "cluster",
Short: "Manage Arcus clusters",
}

func init() {
ClusterCmd.AddCommand(deployCmd)
ClusterCmd.AddCommand(startCmd)
ClusterCmd.AddCommand(stopCmd)
ClusterCmd.AddCommand(deleteCmd)
ClusterCmd.AddCommand(listCmd)
ClusterCmd.AddCommand(statusCmd)
}
12 changes: 12 additions & 0 deletions cmd/cluster/delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package cluster

import "github.com/spf13/cobra"

var deleteCmd = &cobra.Command{
Use: "delete <servicecode>",
Short: "Delete an Arcus cluster",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
// TODO: delete ๊ตฌํ˜„
},
}
12 changes: 12 additions & 0 deletions cmd/cluster/deploy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package cluster

import "github.com/spf13/cobra"

var deployCmd = &cobra.Command{
Use: "deploy <version> <topology.yml>",
Short: "Deploy a new Arcus cluster",
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
// TODO: deploy ๊ตฌํ˜„
},
}
12 changes: 12 additions & 0 deletions cmd/cluster/list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package cluster

import "github.com/spf13/cobra"

var listCmd = &cobra.Command{
Use: "list",
Short: "List managed Arcus clusters",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
// TODO: list ๊ตฌํ˜„
},
}
16 changes: 16 additions & 0 deletions cmd/cluster/start.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cluster

import "github.com/spf13/cobra"

var startCmd = &cobra.Command{
Use: "start <servicecode> [--node <address>]",
Short: "Start an Arcus cluster",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
// TODO: start ๊ตฌํ˜„
},
}

func init() {
startCmd.Flags().String("node", "", "address of the specific node to start")
}
12 changes: 12 additions & 0 deletions cmd/cluster/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package cluster

import "github.com/spf13/cobra"

var statusCmd = &cobra.Command{
Use: "status <servicecode>",
Short: "Show status of an Arcus cluster",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
// TODO: status ๊ตฌํ˜„
},
}
16 changes: 16 additions & 0 deletions cmd/cluster/stop.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cluster

import "github.com/spf13/cobra"

var stopCmd = &cobra.Command{
Use: "stop <servicecode> [--node <address>]",
Short: "Stop an Arcus cluster",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
// TODO: stop ๊ตฌํ˜„
},
}

func init() {
stopCmd.Flags().String("node", "", "address of the specific node to stop")
}
2 changes: 1 addition & 1 deletion cmd/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ credentials are provided, SASL SCRAM-SHA-256 authentication will be performed.`,
if err != nil {
panic(err)
}
defer conn.Close()
defer func() { _ = conn.Close() }()
Comment thread
f1v3-dev marked this conversation as resolved.

if len(args) == 2 {
username, password, _ := strings.Cut(args[1], ":")
Expand Down
4 changes: 4 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"runtime/debug"

"github.com/jam2in/arcusctl/cmd/acl"
"github.com/jam2in/arcusctl/cmd/cluster"
"github.com/jam2in/arcusctl/cmd/zk"
"github.com/jam2in/arcusctl/internal"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -35,6 +37,8 @@ func init() {
rootCmd.AddCommand(versionCmd)
rootCmd.AddCommand(acl.RootCmd)
rootCmd.AddCommand(connectCmd)
rootCmd.AddCommand(zk.ZKCmd)
rootCmd.AddCommand(cluster.ClusterCmd)

cobra.OnInitialize(internal.InitConfig)
}
Expand Down
12 changes: 12 additions & 0 deletions cmd/zk/delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package zk

import "github.com/spf13/cobra"

var deleteCmd = &cobra.Command{
Use: "delete <ensemble-name>",
Short: "Delete a ZooKeeper ensemble",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
// TODO: delete ๊ตฌํ˜„
},
}
12 changes: 12 additions & 0 deletions cmd/zk/deploy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package zk

import "github.com/spf13/cobra"

var deployCmd = &cobra.Command{
Use: "deploy <version> <topology.yml>",
Short: "Deploy a new ZooKeeper ensemble",
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
// TODO: deploy ๊ตฌํ˜„
},
}
12 changes: 12 additions & 0 deletions cmd/zk/list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package zk

import "github.com/spf13/cobra"

var listCmd = &cobra.Command{
Use: "list",
Short: "List ZooKeeper ensembles",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
// TODO: list ๊ตฌํ˜„
},
}
16 changes: 16 additions & 0 deletions cmd/zk/start.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package zk

import "github.com/spf13/cobra"

var startCmd = &cobra.Command{
Use: "start <ensemble-name> [--node <myid>]",
Short: "Start a ZooKeeper ensemble",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
// TODO: start ๊ตฌํ˜„
},
}

func init() {
startCmd.Flags().Int("node", 0, "myid of the specific node to start")
}
12 changes: 12 additions & 0 deletions cmd/zk/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package zk

import "github.com/spf13/cobra"

var statusCmd = &cobra.Command{
Use: "status <ensemble-name>",
Short: "Show status of a ZooKeeper ensemble",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
// TODO: status ๊ตฌํ˜„
},
}
16 changes: 16 additions & 0 deletions cmd/zk/stop.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package zk

import "github.com/spf13/cobra"

var stopCmd = &cobra.Command{
Use: "stop <ensemble-name> [--node <myid>]",
Short: "Stop a ZooKeeper ensemble",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
// TODO: stop ๊ตฌํ˜„
},
}

func init() {
stopCmd.Flags().Int("node", 0, "myid of the specific node to stop")
}
17 changes: 17 additions & 0 deletions cmd/zk/zk.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package zk

import "github.com/spf13/cobra"

var ZKCmd = &cobra.Command{
Use: "zk",
Short: "Manage ZooKeeper ensembles",
}

func init() {
ZKCmd.AddCommand(deployCmd)
ZKCmd.AddCommand(startCmd)
ZKCmd.AddCommand(stopCmd)
ZKCmd.AddCommand(deleteCmd)
ZKCmd.AddCommand(listCmd)
ZKCmd.AddCommand(statusCmd)
}
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
module github.com/jam2in/arcusctl

go 1.24.6
go 1.25.0
Comment thread
namsic marked this conversation as resolved.

require (
github.com/cybergarage/go-sasl v1.2.6
github.com/go-zookeeper/zk v1.0.4
github.com/spf13/cobra v1.9.1
github.com/spf13/viper v1.21.0
golang.org/x/term v0.35.0
go.yaml.in/yaml/v3 v3.0.4
golang.org/x/crypto v0.50.0
golang.org/x/term v0.42.0
)

require (
Expand All @@ -22,7 +24,6 @@ require (
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/sys v0.43.0 // indirect
golang.org/x/text v0.36.0 // indirect
)
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ=
golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI=
golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q=
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY=
golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY=
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
7 changes: 7 additions & 0 deletions internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var (

Config = struct {
ZooKeeper string
Home string
}{}
)

Expand All @@ -34,6 +35,12 @@ func InitConfig() {
v.SetConfigName("config")
}

homeDir, err := os.UserHomeDir()
if err != nil {
panic(err)
}
v.SetDefault("home", filepath.Join(homeDir, ".arcusctl"))

v.SetEnvPrefix("ARCUSCTL")
v.AutomaticEnv()

Expand Down
Loading
Loading