Make service port configurable 70/87070/1 0.1.0
authorKiran Kamineni <kiran.k.kamineni@intel.com>
Mon, 6 May 2019 18:22:46 +0000 (11:22 -0700)
committerKiran Kamineni <kiran.k.kamineni@intel.com>
Mon, 6 May 2019 18:22:49 +0000 (11:22 -0700)
Service port should be configurable.
This patch removes the hardcoded value.
The default value is 9015

Issue-ID: MULTICLOUD-609
Change-Id: Iae05f42bd06ecd061ec68a3a7c4a4a87f33b22fa
Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
deployments/Dockerfile
deployments/start.sh
src/k8splugin/cmd/main.go
src/k8splugin/internal/config/config.go

index b3e2f06..dfe16cb 100644 (file)
@@ -16,7 +16,7 @@ ENV http_proxy $HTTP_PROXY
 ENV https_proxy $HTTPS_PROXY
 ENV no_proxy $NO_PROXY
 
-EXPOSE 8081
+EXPOSE 9015
 
 RUN groupadd -r onap && useradd -r -g onap onap
 RUN apt-get update && apt-get install -y -qq apt-transport-https curl \
index f8dc8e7..a57a637 100755 (executable)
@@ -31,6 +31,7 @@ cat << EOF > k8sconfig.json
     "database-address":     "$DATABASE_IP",
     "database-type": "mongo",
     "plugin-dir": "$(pwd)/plugins",
+    "service-port": "9015",
     "kube-config-dir": "$(pwd)/kubeconfigs"
 }
 EOF
index 607e3fe..d6d9d75 100644 (file)
@@ -25,6 +25,7 @@ import (
        "k8splugin/api"
        utils "k8splugin/internal"
        "k8splugin/internal/auth"
+       "k8splugin/internal/config"
 
        "github.com/gorilla/handlers"
 )
@@ -44,7 +45,7 @@ func main() {
 
        httpServer := &http.Server{
                Handler: loggedRouter,
-               Addr:    ":8081", // Remove hardcoded port number
+               Addr:    ":" + config.GetConfiguration().ServicePort,
        }
 
        connectionsClose := make(chan struct{})
index c3ca905..dc3f7a1 100644 (file)
@@ -39,6 +39,7 @@ type Configuration struct {
        EtcdCAFile        string `json:"etcd-ca-file"`
        KubeConfigDir     string `json:"kube-config-dir"`
        OVNCentralAddress string `json:"ovn-central-address"`
+       ServicePort       string `json:"service-port"`
 }
 
 // Config is the structure that stores the configuration
@@ -87,6 +88,7 @@ func defaultConfiguration() *Configuration {
                EtcdCAFile:        "etcd-ca.cert",
                KubeConfigDir:     cwd,
                OVNCentralAddress: "127.0.0.1",
+               ServicePort:       "9015",
        }
 }