Skip to content
This repository was archived by the owner on Mar 22, 2018. It is now read-only.

Commit 410e6e2

Browse files
committed
Pick up keystone url from env var - OS_AUTH_URL
1 parent 6d902a6 commit 410e6e2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

cmd/k8s-keystone-auth/main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/golang/glog"
2020
"github.com/spf13/pflag"
2121
"net/http"
22+
"os"
2223

2324
"git.openstack.org/openstack/openstack-cloud-controller-manager/pkg/identity/keystone"
2425
"git.openstack.org/openstack/openstack-cloud-controller-manager/pkg/identity/webhook"
@@ -49,14 +50,17 @@ func main() {
4950
pflag.StringVar(&listenAddr, "listen", "0.0.0.0:8443", "<address>:<port> to listen on")
5051
pflag.StringVar(&tlsCertFile, "tls-cert-file", "", "File containing the default x509 Certificate for HTTPS.")
5152
pflag.StringVar(&tlsPrivateKey, "tls-private-key-file", "", "File containing the default x509 private key matching --tls-cert-file.")
52-
pflag.StringVar(&keystoneURL, "keystone-url", "http://localhost/identity/v3/", "URL for the OpenStack Keystone API")
53+
pflag.StringVar(&keystoneURL, "keystone-url", os.Getenv("OS_AUTH_URL"), "URL for the OpenStack Keystone API")
5354
pflag.StringVar(&keystoneCaFile, "keystone-ca-file", "", "File containing the certificate authority for Keystone Service.")
5455
pflag.StringVar(&policyFile, "keystone-policy-file", "", "File containing the policy.")
5556

5657
kflag.InitFlags()
5758
logs.InitLogs()
5859
defer logs.FlushLogs()
5960

61+
if keystoneURL == "" {
62+
glog.Fatal("please specify --keystone-url or set the OS_AUTH_URL environment variable.")
63+
}
6064
if tlsCertFile == "" || tlsPrivateKey == "" {
6165
glog.Fatal("Please specify --tls-cert-file and --tls-private-key-file arguments.")
6266
}
@@ -75,7 +79,7 @@ func main() {
7579
}
7680

7781
http.Handle("/webhook", webhookServer(authentication_handler, authorization_handler))
78-
glog.Infof("Starting webhook..")
82+
glog.Infof("Starting webhook...")
7983
glog.Fatal(
8084
http.ListenAndServeTLS(listenAddr,
8185
tlsCertFile,

0 commit comments

Comments
 (0)