Initial SEBA charts
Change-Id: I78a85b2d27ac343c1c220e388306005de043313c
diff --git a/helm-charts/README.md b/helm-charts/README.md
new file mode 100644
index 0000000..8bf705b
--- /dev/null
+++ b/helm-charts/README.md
@@ -0,0 +1,24 @@
+# SEBA Helm Charts
+
+This directory contains Helm charts used to install SEBA components on
+a Kubernetes cluster.
+
+To install SEBA:
+
+```
+helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
+helm repo add cord https://charts.opencord.org/master
+helm dep update nem
+helm dep update seba-substrate
+helm install nem -n nem
+helm install seba-substrate -n seba-substrate
+helm upgrade seba-substrate --set voltha.etcd-operator.customResources.createEtcdClusterCRD=true seba-substrate
+```
+
+After installing the SEBA charts above, the following commands can be used to
+wait until all pods have started successfully:
+
+```
+tools/wait-for-pods.sh
+tools/wait-for-pods.sh voltha
+```
\ No newline at end of file
diff --git a/helm-charts/nem/.helmignore b/helm-charts/nem/.helmignore
new file mode 100644
index 0000000..f0c1319
--- /dev/null
+++ b/helm-charts/nem/.helmignore
@@ -0,0 +1,21 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
diff --git a/helm-charts/nem/Chart.yaml b/helm-charts/nem/Chart.yaml
new file mode 100644
index 0000000..10e3a15
--- /dev/null
+++ b/helm-charts/nem/Chart.yaml
@@ -0,0 +1,20 @@
+---
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: v1
+name: nem
+description: A Helm chart for NEM
+version: 0.1.0
+
diff --git a/helm-charts/nem/requirements.yaml b/helm-charts/nem/requirements.yaml
new file mode 100644
index 0000000..e653852
--- /dev/null
+++ b/helm-charts/nem/requirements.yaml
@@ -0,0 +1,33 @@
+---
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+dependencies:
+
+- name: xos-core
+ version: 2.0.0
+ repository: https://charts.opencord.org/master/
+
+- name: rcord-lite
+ version: 0.1.0
+ repository: https://charts.opencord.org/master/
+
+- name: hippie-oss
+ version: 1.0.0
+ repository: https://charts.opencord.org/master/
+
+- name: kafka
+ alias: cord-kafka
+ version: 0.4.7
+ repository: https://kubernetes-charts-incubator.storage.googleapis.com/
diff --git a/helm-charts/nem/templates/NOTES.txt b/helm-charts/nem/templates/NOTES.txt
new file mode 100644
index 0000000..cb50ff5
--- /dev/null
+++ b/helm-charts/nem/templates/NOTES.txt
@@ -0,0 +1,4 @@
+Thank you for installing {{ .Chart.Name }}.
+
+Your release is named {{ .Release.Name }}.
+
diff --git a/helm-charts/nem/values.yaml b/helm-charts/nem/values.yaml
new file mode 100644
index 0000000..7005c11
--- /dev/null
+++ b/helm-charts/nem/values.yaml
@@ -0,0 +1,25 @@
+---
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Aggregation chart of NEM charts
+
+cord-kafka:
+ replicas: 1
+ persistence:
+ enabled: false
+ zookeeper:
+ servers: 1
+ persistence:
+ enabled: false
diff --git a/helm-charts/seba-substrate/.helmignore b/helm-charts/seba-substrate/.helmignore
new file mode 100644
index 0000000..f0c1319
--- /dev/null
+++ b/helm-charts/seba-substrate/.helmignore
@@ -0,0 +1,21 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
diff --git a/helm-charts/seba-substrate/Chart.yaml b/helm-charts/seba-substrate/Chart.yaml
new file mode 100644
index 0000000..c0e22e8
--- /dev/null
+++ b/helm-charts/seba-substrate/Chart.yaml
@@ -0,0 +1,20 @@
+---
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: v1
+name: seba-substrate
+description: A Helm chart for setting up VOLTHA, ONOS, and Kafka
+version: 0.1.0
+
diff --git a/helm-charts/seba-substrate/requirements.yaml b/helm-charts/seba-substrate/requirements.yaml
new file mode 100644
index 0000000..4bc335c
--- /dev/null
+++ b/helm-charts/seba-substrate/requirements.yaml
@@ -0,0 +1,35 @@
+---
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+dependencies:
+
+- name: voltha
+ version: 1.0.0
+ repository: https://charts.opencord.org/master/
+
+- name: onos
+ alias: onos-voltha
+ version: 0.1.0
+ repository: https://charts.opencord.org/master/
+
+- name: onos
+ alias: onos-fabric
+ version: 0.1.0
+ repository: https://charts.opencord.org/master/
+
+- name: kafka
+ alias: voltha-kafka
+ version: 0.4.7
+ repository: https://kubernetes-charts-incubator.storage.googleapis.com/
diff --git a/helm-charts/seba-substrate/templates/NOTES.txt b/helm-charts/seba-substrate/templates/NOTES.txt
new file mode 100644
index 0000000..cb50ff5
--- /dev/null
+++ b/helm-charts/seba-substrate/templates/NOTES.txt
@@ -0,0 +1,4 @@
+Thank you for installing {{ .Chart.Name }}.
+
+Your release is named {{ .Release.Name }}.
+
diff --git a/helm-charts/seba-substrate/values.yaml b/helm-charts/seba-substrate/values.yaml
new file mode 100644
index 0000000..3f4a2c3
--- /dev/null
+++ b/helm-charts/seba-substrate/values.yaml
@@ -0,0 +1,86 @@
+---
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Aggregation chart of SEBA charts
+
+# configuration for kafka
+voltha-kafka:
+ replicas: 1
+ persistence:
+ enabled: false
+ zookeeper:
+ servers: 1
+ persistence:
+ enabled: false
+
+voltha:
+ etcd-operator:
+ customResources:
+ createEtcdClusterCRD: false
+ kafkaReleaseName: "seba-substrate-voltha-kafka"
+
+# from configs/onos-voltha.yaml
+onos-voltha:
+ nameOverride: "onosv"
+ fullnameOverride: "onos-voltha"
+
+ namespace: voltha
+ serviceAccountName: voltha-serviceaccount
+
+ onosImage: 'voltha/voltha-onos:latest'
+
+ services:
+ openflowServiceType: ClusterIP
+ ovsdbServiceType: ClusterIP
+ sshServiceType: NodePort
+ uiServiceType: NodePort
+ ssh:
+ nodePort: 30115
+ ui:
+ nodePort: 30120
+
+ onos_env:
+ - name: POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: ONOS_APPS
+ value: "drivers,openflow-base"
+
+
+# from configs/onos-fabric.yaml
+onos-fabric:
+ services:
+ openflowServiceType: NodePort
+ ovsdbServiceType: NodePort
+ sshServiceType: NodePort
+ uiServiceType: NodePort
+ ovsdb:
+ nodePort: 31640
+ openflow:
+ nodePort: 31653
+ ssh:
+ nodePort: 31101
+ ui:
+ nodePort: 31181
+
+ onos_env:
+ - name: ONOS_APPS
+ value: "openflow"
+
diff --git a/tools/wait-for-pods.sh b/tools/wait-for-pods.sh
new file mode 100755
index 0000000..f6ea657
--- /dev/null
+++ b/tools/wait-for-pods.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# Copyright 2017 The Openstack-Helm Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+set -e
+
+# From Kolla-Kubernetes, orginal authors Kevin Fox & Serguei Bezverkhi
+# Default wait timeout is 600 seconds
+end=$(date +%s)
+if ! [ -z $2 ]; then
+ end=$((end + $2))
+else
+ end=$((end + 900))
+fi
+while true; do
+ kubectl get pods --namespace=$1 -o json | jq -r \
+ '.items[].status.phase' | grep Pending > /dev/null && \
+ PENDING=True || PENDING=False
+ query='.items[]|select(.status.phase=="Running")'
+ query="$query|.status.containerStatuses[].ready"
+ kubectl get pods --namespace=$1 -o json | jq -r "$query" | \
+ grep false > /dev/null && READY="False" || READY="True"
+ kubectl get jobs -o json --namespace=$1 | jq -r \
+ '.items[] | .spec.completions == .status.succeeded' | \
+ grep false > /dev/null && JOBR="False" || JOBR="True"
+ [ $PENDING == "False" -a $READY == "True" -a $JOBR == "True" ] && \
+ break || true
+ sleep 5
+ now=$(date +%s)
+ [ $now -gt $end ] && echo containers failed to start. && \
+ kubectl get pods --namespace $1 -o wide && exit -1
+done