Skip to content

Commit

Permalink
k8s: fix cassandra-tool env key conflict with k8s (cadence-workflow#3505
Browse files Browse the repository at this point in the history
)

*  k8s: fix cassandra-tool env key conflict with k8s

1. The default CASSANDRA_PORT key is used by k8s when you have an
service pod named cassandra(k8s will gen a env key which is name_port).
And the CASSANDRA_PORT has valid value which is an url, cannot be 
parsed to an int value. Finally, the cadence-cassandra-tool can not be
executed. Candence cannot work well when need cadence-canssandra.
2. Replace the CASSANDRA_PORT to CASSANDRA_DB_PORT, to avoid
use the same key with k8s. 

* tools: terminated with a non-zero exit code

1. When cannot run
2. These tools depend on some environment vars, which are not really
reliable. In that case, tools start and stop without any stdout.
  • Loading branch information
pip1998 authored Sep 11, 2020
1 parent fc856d5 commit d3cab3e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion cmd/tools/cassandra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ import (
)

func main() {
cassandra.RunTool(os.Args) //nolint:errcheck
err := cassandra.RunTool(os.Args)
if err != nil {
panic(err)
}
}
5 changes: 4 additions & 1 deletion cmd/tools/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ import (
// See cadence/tools/cli/README.md for usage
func main() {
app := cli.NewCliApp()
app.Run(os.Args)
err := app.Run(os.Args)
if err != nil {
panic(err)
}
}
5 changes: 4 additions & 1 deletion cmd/tools/sql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ import (
)

func main() {
sql.RunTool(os.Args) //nolint:errcheck
err := sql.RunTool(os.Args)
if err != nil {
panic(err)
}
}
2 changes: 1 addition & 1 deletion environment/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
// CassandraSeeds env
CassandraSeeds = "CASSANDRA_SEEDS"
// CassandraPort env
CassandraPort = "CASSANDRA_PORT"
CassandraPort = "CASSANDRA_DB_PORT"
// CassandraDefaultPort Cassandra default port
CassandraDefaultPort = "9042"

Expand Down
2 changes: 1 addition & 1 deletion tools/cassandra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func buildCLIOptions() *cli.App {
Name: schema.CLIFlagPort,
Value: defaultCassandraPort,
Usage: "Port of cassandra host to connect to",
EnvVar: "CASSANDRA_PORT",
EnvVar: "CASSANDRA_DB_PORT",
},
cli.StringFlag{
Name: schema.CLIFlagUser,
Expand Down

0 comments on commit d3cab3e

Please sign in to comment.