Merge "Replica Scaling of MSO component"
diff --git a/kubernetes/README_HELM b/kubernetes/README_HELM
index c1d5fdf..0f65120 100644
--- a/kubernetes/README_HELM
+++ b/kubernetes/README_HELM
@@ -3,7 +3,7 @@
 - Helm
 
 In order to use Helm with Rancher, check the tiller version installed
-by runing "helm version" on the ranchr CLI
+by running "helm version" on the rancher CLI
 and install the appropriate Helm.
 Notice both tiller and helm are installed,
 but you will need to install on your VM.
diff --git a/kubernetes/appc/templates/appc-deployment.yaml b/kubernetes/appc/templates/appc-deployment.yaml
index 8caf286..35e9470 100644
--- a/kubernetes/appc/templates/appc-deployment.yaml
+++ b/kubernetes/appc/templates/appc-deployment.yaml
@@ -5,6 +5,7 @@
   name: appc
   namespace: "{{ .Values.nsPrefix }}-appc"
 spec:
+  replicas: {{ .Values.appcReplicas }}
   selector:
     matchLabels:
       app: appc
diff --git a/kubernetes/appc/templates/db-deployment.yaml b/kubernetes/appc/templates/db-deployment.yaml
index 607a0df..0b29393 100644
--- a/kubernetes/appc/templates/db-deployment.yaml
+++ b/kubernetes/appc/templates/db-deployment.yaml
@@ -5,6 +5,7 @@
   name: appc-dbhost
   namespace: "{{ .Values.nsPrefix }}-appc"
 spec:
+  replicas: {{ .Values.dbReplicas }}
   selector:
     matchLabels:
       app: appc-dbhost
@@ -45,4 +46,4 @@
           claimName: appc-db
       imagePullSecrets:
       - name: "{{ .Values.nsPrefix }}-docker-registry-key"
-#{{ end }}
\ No newline at end of file
+#{{ end }}
diff --git a/kubernetes/appc/templates/dgbuilder-deployment.yaml b/kubernetes/appc/templates/dgbuilder-deployment.yaml
index ed69c05..3bbc671 100644
--- a/kubernetes/appc/templates/dgbuilder-deployment.yaml
+++ b/kubernetes/appc/templates/dgbuilder-deployment.yaml
@@ -5,6 +5,7 @@
   name: appc-dgbuilder
   namespace: "{{ .Values.nsPrefix }}-appc"
 spec:
+  replicas: {{ .Values.dgbuilderReplicas }}
   selector:
     matchLabels:
       app: appc-dgbuilder
diff --git a/kubernetes/appc/values.yaml b/kubernetes/appc/values.yaml
index 882267c..0bf4da9 100644
--- a/kubernetes/appc/values.yaml
+++ b/kubernetes/appc/values.yaml
@@ -1,9 +1,12 @@
 nsPrefix: onap
 pullPolicy: Always
 nodePortPrefix: 302
+appcReplicas: 1
+dbReplicas: 1
+dgbuilderReplicas: 1
 image:
   readiness: oomk8s/readiness-check:1.0.0
   appc: nexus3.onap.org:10001/openecomp/appc-image:v1.2.0
   mysqlServer: mysql/mysql-server:5.6
   dgbuilderSdnc: nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:v0.1.0
-  filebeat: docker.elastic.co/beats/filebeat:5.5.0
\ No newline at end of file
+  filebeat: docker.elastic.co/beats/filebeat:5.5.0
diff --git a/kubernetes/message-router/templates/message-router-dmaap.yaml b/kubernetes/message-router/templates/message-router-dmaap.yaml
index 1d9777e..cecf69b 100644
--- a/kubernetes/message-router/templates/message-router-dmaap.yaml
+++ b/kubernetes/message-router/templates/message-router-dmaap.yaml
@@ -5,6 +5,7 @@
   name: dmaap
   namespace: "{{ .Values.nsPrefix }}-message-router"
 spec:
+  replicas: {{ .Values.dmaapReplicas }}
   selector:
     matchLabels:
       app: dmaap
diff --git a/kubernetes/message-router/templates/message-router-kafka.yaml b/kubernetes/message-router/templates/message-router-kafka.yaml
index 509b15f..94e01b3 100644
--- a/kubernetes/message-router/templates/message-router-kafka.yaml
+++ b/kubernetes/message-router/templates/message-router-kafka.yaml
@@ -5,6 +5,7 @@
   name: global-kafka
   namespace: "{{ .Values.nsPrefix }}-message-router"
 spec:
+  replicas: {{ .Values.kafkaReplicas }}
   selector:
     matchLabels:
       app: global-kafka
diff --git a/kubernetes/message-router/templates/message-router-zookeeper.yaml b/kubernetes/message-router/templates/message-router-zookeeper.yaml
index 47cdb51..5a5bc9f 100644
--- a/kubernetes/message-router/templates/message-router-zookeeper.yaml
+++ b/kubernetes/message-router/templates/message-router-zookeeper.yaml
@@ -5,6 +5,7 @@
   name: zookeeper
   namespace: "{{ .Values.nsPrefix }}-message-router"
 spec:
+  replicas: {{ .Values.zookeeperReplicas }}
   selector:
     matchLabels:
       app: zookeeper
@@ -41,4 +42,4 @@
           claimName: message-router-zookeeper
       imagePullSecrets:
       - name: "{{ .Values.nsPrefix }}-docker-registry-key"
-#{{ end }}
\ No newline at end of file
+#{{ end }}
diff --git a/kubernetes/message-router/values.yaml b/kubernetes/message-router/values.yaml
index 9206729..6782b71 100644
--- a/kubernetes/message-router/values.yaml
+++ b/kubernetes/message-router/values.yaml
@@ -1,6 +1,9 @@
 nsPrefix: onap
 pullPolicy: Always
 nodePortPrefix: 302
+dmaapReplicas: 1
+kafkaReplicas: 1
+zookeeperReplicas: 1
 image:
   readiness: oomk8s/readiness-check:1.0.0
   dmaap: attos/dmaap:latest
diff --git a/kubernetes/readiness/docker/init/ready.py b/kubernetes/readiness/docker/init/ready.py
index c5b55ee..7cfb6cd 100644
--- a/kubernetes/readiness/docker/init/ready.py
+++ b/kubernetes/readiness/docker/init/ready.py
@@ -36,6 +36,9 @@
     try:
         response = v1.list_namespaced_pod(namespace=namespace, watch=False)
         for i in response.items:
+            # container_statuses can be None, which is non-iterable.
+            if i.status.container_statuses is None:
+               continue
             for s in i.status.container_statuses:
                 if s.name == container_name:
                     ready = s.ready
diff --git a/kubernetes/sdnc/templates/dgbuilder-deployment.yaml b/kubernetes/sdnc/templates/dgbuilder-deployment.yaml
index e0f8b29..b9ec155 100644
--- a/kubernetes/sdnc/templates/dgbuilder-deployment.yaml
+++ b/kubernetes/sdnc/templates/dgbuilder-deployment.yaml
@@ -5,6 +5,7 @@
   name: sdnc-dgbuilder
   namespace: "{{ .Values.nsPrefix }}-sdnc"
 spec:
+  replicas: {{ .Values.dgbuilderReplicas }}
   selector:
     matchLabels:
       app: sdnc-dgbuilder
diff --git a/kubernetes/sdnc/templates/dmaap-deployment.yaml b/kubernetes/sdnc/templates/dmaap-deployment.yaml
index b9ba346..eb6f354 100644
--- a/kubernetes/sdnc/templates/dmaap-deployment.yaml
+++ b/kubernetes/sdnc/templates/dmaap-deployment.yaml
@@ -5,6 +5,7 @@
   name: dmaap-listener
   namespace: "{{ .Values.nsPrefix }}-sdnc"
 spec:
+  replicas: {{ .Values.dmaapReplicas }}
   selector:
     matchLabels:
       app: dmaap-listener
diff --git a/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml b/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml
index 9d3feef..a283d0f 100644
--- a/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml
+++ b/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml
@@ -5,7 +5,7 @@
   name: nfs-provisioner
   namespace: "{{ .Values.nsPrefix }}-sdnc"
 spec:
-  replicas: 1
+  replicas: {{ .Values.nfsReplicas }}
   strategy:
     type: Recreate
   template:
diff --git a/kubernetes/sdnc/templates/ueb-deployment.yaml b/kubernetes/sdnc/templates/ueb-deployment.yaml
index a7e5e74..c109acd 100644
--- a/kubernetes/sdnc/templates/ueb-deployment.yaml
+++ b/kubernetes/sdnc/templates/ueb-deployment.yaml
@@ -5,6 +5,7 @@
   name: ueb-listener
   namespace: "{{ .Values.nsPrefix }}-sdnc"
 spec:
+  replicas: {{ .Values.uebReplicas }}
   selector:
     matchLabels:
       app: ueb-listener
diff --git a/kubernetes/sdnc/templates/web-deployment.yaml b/kubernetes/sdnc/templates/web-deployment.yaml
index 7e8b59c..73d8e0a 100644
--- a/kubernetes/sdnc/templates/web-deployment.yaml
+++ b/kubernetes/sdnc/templates/web-deployment.yaml
@@ -5,6 +5,7 @@
   name: sdnc-portal
   namespace: "{{ .Values.nsPrefix }}-sdnc"
 spec:
+  replicas: {{ .Values.portalReplicas }}
   selector:
     matchLabels:
       app: sdnc-portal
diff --git a/kubernetes/sdnc/values.yaml b/kubernetes/sdnc/values.yaml
index 3959709..e91dc2a 100644
--- a/kubernetes/sdnc/values.yaml
+++ b/kubernetes/sdnc/values.yaml
@@ -14,5 +14,10 @@
 enableODLCluster: false
 numberOfODLReplicas: 1
 numberOfDbReplicas: 1
+dgbuilderReplicas: 1
+dmaapReplicas: 1
+nfsReplicas: 1
+uebReplicas: 1
+portalReplicas: 1
 disableSdncSdncDgbuilder: false
 disableSdncSdncPortal: false