Adding support for communicating with Aurora using TLS.
This commit is contained in:
parent
72692b5dd7
commit
f4d86536c3
3 changed files with 21 additions and 6 deletions
5
Gopkg.lock
generated
5
Gopkg.lock
generated
|
@ -14,13 +14,14 @@
|
|||
version = "v1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "SSLOverride"
|
||||
name = "github.com/paypal/gorealis"
|
||||
packages = [
|
||||
".",
|
||||
"gen-go/apache/aurora",
|
||||
"response"
|
||||
]
|
||||
revision = "94e7c878b4e54385b6fbbb7b0c1ce5a82865af2b"
|
||||
revision = "d64a91784a16206c036048a5006a103ed7fe0d89"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pkg/errors"
|
||||
|
@ -46,6 +47,6 @@
|
|||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "7cdf3e22d0409d2ae71180bc65c717e6b88f93c5dbf68c8fca796a6a8c32472c"
|
||||
inputs-digest = "605455afaa36eb3474c79fbff14ae9755c5acf95d947da68ca1bc376c29f4245"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -2,7 +2,7 @@ required = ["git.apache.org/thrift.git/lib/go/thrift"]
|
|||
|
||||
[[constraint]]
|
||||
name = "github.com/paypal/gorealis"
|
||||
revision = "94e7c878b4e54385b6fbbb7b0c1ce5a82865af2b"
|
||||
branch = "develop"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/spf13/cobra"
|
||||
|
|
20
cmd/root.go
20
cmd/root.go
|
@ -24,12 +24,18 @@ var username, password, zkAddr, schedAddr string
|
|||
var env, role, name string
|
||||
var client realis.Realis
|
||||
var monitor *realis.Monitor
|
||||
var insecureSkipVerify bool
|
||||
var caCertsPath string
|
||||
var clientKey, clientCert string
|
||||
|
||||
func init() {
|
||||
rootCmd.PersistentFlags().StringVarP(&zkAddr, "zookeeper", "z", "", "Zookeeper node(s) where Aurora stores information.")
|
||||
rootCmd.PersistentFlags().StringVarP(&username, "username", "u", "", "Username to use for API authentication")
|
||||
rootCmd.PersistentFlags().StringVarP(&password, "password", "p", "", "Password to use for API authentication")
|
||||
rootCmd.PersistentFlags().StringVarP(&schedAddr, "scheduler_addr", "s", "", "Aurora Scheduler's address.")
|
||||
rootCmd.PersistentFlags().StringVarP(&clientKey, "clientKey", "k", "", "Client key to use to connect to Aurora.")
|
||||
rootCmd.PersistentFlags().StringVarP(&clientCert, "clientCert", "c", "", "Client certificate to use to connect to Aurora.")
|
||||
rootCmd.PersistentFlags().StringVarP(&caCertsPath, "caCertsPath", "a", "", "CA certificates path to use.")
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
|
@ -50,10 +56,19 @@ func connect(cmd *cobra.Command, args []string) {
|
|||
Jitter: 0.1,
|
||||
})}
|
||||
|
||||
|
||||
// Prefer zookeeper if both ways of connecting are provided
|
||||
if zkAddr != "" {
|
||||
realisOptions = append(realisOptions, realis.ZKUrl(zkAddr))
|
||||
|
||||
// Configure Zookeeper to connect
|
||||
zkOptions := []realis.ZKOpt{ realis.ZKEndpoints(zkAddr), realis.ZKPath("/aurora/scheduler")}
|
||||
|
||||
if clientKey != "" || clientCert != "" || caCertsPath != "" {
|
||||
zkOptions = append(zkOptions, realis.ZKAuroraPortOverride(8081), realis.ZKAuroraSchemeOverride("https"))
|
||||
|
||||
realisOptions = append(realisOptions, realis.Certspath(caCertsPath), realis.ClientCerts(clientKey, clientCert))
|
||||
}
|
||||
|
||||
realisOptions = append(realisOptions, realis.ZookeeperOptions(zkOptions...))
|
||||
} else if schedAddr != "" {
|
||||
realisOptions = append(realisOptions, realis.SchedulerUrl(schedAddr))
|
||||
} else {
|
||||
|
@ -61,7 +76,6 @@ func connect(cmd *cobra.Command, args []string) {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
||||
// Connect to Aurora Scheduler and create a client object
|
||||
client, err = realis.NewRealisClient(realisOptions...)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue