Added voltha-infra chart
Added voltha-stack chart
Moved "defaults" values to "global" so that they can be managed by the
macro charts
Added examples for different workflows

Change-Id: I5fb2bfa54a1be725892445e93bd8a35d608e5d14
diff --git a/voltha-infra/.helmignore b/voltha-infra/.helmignore
new file mode 100644
index 0000000..50af031
--- /dev/null
+++ b/voltha-infra/.helmignore
@@ -0,0 +1,22 @@
+# 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
+.vscode/
diff --git a/voltha-infra/Chart.yaml b/voltha-infra/Chart.yaml
new file mode 100644
index 0000000..1354d94
--- /dev/null
+++ b/voltha-infra/Chart.yaml
@@ -0,0 +1,74 @@
+# Copyright 2020-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: v2
+description: A Helm chart to install the required infrastructure for VOLTHA
+keywords:
+  - "onf"
+  - "voltha"
+  - "onos"
+  - "radius"
+  - "sadis-server"
+home: "https://www.opennetworking.org/voltha"
+icon: "https://guide.opencord.org/logos/voltha.svg"
+maintainers:
+  - name: "Open Networking Foundation"
+    email: "info@opennetworking.org"
+    url: "https://www.opennetworking.org"
+name: voltha-infra
+
+appVersion: "1.0"
+version: 0.1.0
+
+dependencies:
+  - name: onos-classic
+    repository: https://charts.onosproject.org
+    version: 0.1.10
+    condition: onos-classic.enabled
+  - name: bbsim-sadis-server
+    # repository: https://charts.opencord.org
+    repository: "file://../bbsim-sadis-server"
+    version: 0.1.1
+    condition: bbsim-sadis-server.enabled
+  - name: etcd
+    repository: https://charts.bitnami.com/bitnami
+    version: 5.4.2
+    condition: etcd.enabled
+  - name: kafka
+    repository: https://charts.bitnami.com/bitnami
+    version: 12.5.0
+    condition: kafka.enabled
+  - name: freeradius
+    repository: https://charts.opencord.org
+    version: 1.0.2
+    condition: radius.enabled
+  - name: voltha-tracing
+    repository: https://charts.opencord.org
+    version: 1.0.0
+    condition: voltha-tracing.enabled
+  - name: elasticsearch
+    repository: https://helm.elastic.co
+    version: 7.10.1
+    condition: efk.enabled
+  - name: kibana
+    repository: https://helm.elastic.co
+    version: 7.10.1
+    condition: efk.enabled
+  - name: fluentd-elasticsearch
+    repository: https://kiwigrid.github.io
+    version: 9.6.2
+    # TODO kiwigrid is deprecated, use: https://github.com/kokuwaio/helm-charts/tree/main/charts/fluentd-elasticsearch
+    # repository: https://kokuwaio.github.io/helm-charts
+    # version: 11.7.1
+    condition: efk.enabled
diff --git a/voltha-infra/templates/NOTES.txt b/voltha-infra/templates/NOTES.txt
new file mode 100644
index 0000000..d5db669
--- /dev/null
+++ b/voltha-infra/templates/NOTES.txt
@@ -0,0 +1,13 @@
+Congratulations!
+
+You successfully installed the infrastructure required to run VOLTHA.
+
+Here are some commands to expose services:
+
+ONOS SSH: kubectl port-forward -n {{ .Release.Namespace }} svc/{{ .Release.Name }}-onos-classic-hs 8101
+ONOS GUI: kubectl port-forward -n {{ .Release.Namespace }} svc/{{ .Release.Name }}-onos-classic-hs 8181
+ETCD: kubectl port-forward -n {{ .Release.Namespace }} svc/{{ .Release.Name }}-etcd {{ .Values.etcd.service.port }}
+KAFKA: kubectl port-forward -n {{ .Release.Namespace }} svc/{{ .Release.Name }}-kafka {{ .Values.kafka.service.port }}
+
+Jaeger: kubectl port-forward -n {{ .Release.Namespace }} --address 0.0.0.0 svc/{{ .Release.Name }}-voltha-tracing-jaeger-gui 16686
+Kibana: kubectl port-forward -n {{ .Release.Namespace }} --address 0.0.0.0 svc/{{ .Release.Name }}-kibana 5601
diff --git a/voltha-infra/templates/_helpers.tpl b/voltha-infra/templates/_helpers.tpl
new file mode 100644
index 0000000..bf89b45
--- /dev/null
+++ b/voltha-infra/templates/_helpers.tpl
@@ -0,0 +1,23 @@
+# Copyright 2020-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.
+{{/* Expand the name of the chart. */}}
+{{- define "name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{/* Create a default fully qualified app name. We truncate at 63 chars because . . . */}}
+{{- define "fullname" -}}
+{{- $name := default .Chart.Name .Values.nameOverride -}}
+{{- $fullname := default (printf "%s-%s" .Release.Name $name) .Values.fullNameOverride -}}
+{{- $fullname | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/voltha-infra/templates/onos-config-loader-configmap.yaml b/voltha-infra/templates/onos-config-loader-configmap.yaml
new file mode 100644
index 0000000..612d3a1
--- /dev/null
+++ b/voltha-infra/templates/onos-config-loader-configmap.yaml
@@ -0,0 +1,24 @@
+---
+
+# Copyright 2018-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
+kind: ConfigMap
+metadata:
+  name: {{ .Release.Name }}-onos-configs-data
+data:
+  netcfg.json: {{ tpl .Values.onos.netcfg . | quote }}
+  {{- range $key, $val := .Values.onos.componentConfig }}
+  {{ $key }}: {{ $val | quote }}
+  {{- end }}
diff --git a/voltha-infra/templates/onos-config-loader-script.yaml b/voltha-infra/templates/onos-config-loader-script.yaml
new file mode 100644
index 0000000..9132c85
--- /dev/null
+++ b/voltha-infra/templates/onos-config-loader-script.yaml
@@ -0,0 +1,33 @@
+---
+
+# Copyright 2020-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
+kind: ConfigMap
+metadata:
+  name: {{ .Release.Name }}-onos-configs-loader
+data:
+  loader.sh: >
+    set -euo pipefail
+
+    echo -e "Loading netcfg into ONOS\n";
+    curl --fail -sSL --user {{ .Values.onos.username }}:{{ .Values.onos.password }} -X POST "http://{{ .Release.Name }}-onos-classic-hs:8181/onos/v1/network/configuration/" -H Content-type:application/json -d @/opt/configs/netcfg.json;
+
+    echo -e "Loading component configs into ONOS\n";
+    CFGS=$(ls /opt/configs | grep -v netcfg.json);
+    for CFG in ${CFGS};
+    do
+      echo -e "Loading $CFG config"
+      curl --fail -sSL --user {{ .Values.onos.username }}:{{ .Values.onos.password }} -X POST "http://{{ .Release.Name }}-onos-classic-hs:8181/onos/v1/configuration/$CFG" -H Content-type:application/json -d @/opt/configs/$CFG;
+    done
diff --git a/voltha-infra/templates/onos-config-loader.yaml b/voltha-infra/templates/onos-config-loader.yaml
new file mode 100644
index 0000000..79fc6a1
--- /dev/null
+++ b/voltha-infra/templates/onos-config-loader.yaml
@@ -0,0 +1,55 @@
+---
+
+# Copyright 2018-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: batch/v1
+kind: Job
+metadata:
+  name: {{ template "fullname" . }}-onos-config-loader
+  labels:
+    app: onos-config-loader
+    chart: {{ .Chart.Name }}
+    release: {{ .Release.Name }}
+spec:
+  backoffLimit: 12
+  template:
+    metadata:
+      labels:
+        app: onos-config-loader
+        release: {{ .Release.Name }}
+      annotations:
+        checksum/config: {{ include (print $.Template.BasePath "/onos-config-loader-configmap.yaml") . | sha256sum }}
+    spec:
+      restartPolicy: OnFailure
+      containers:
+        - name: onos-config-loader
+          image: ellerbrock/alpine-bash-curl-ssl:latest
+          imagePullPolicy: IfNotPresent
+          command:
+            - "bash"
+            - "/opt/loader/loader.sh"
+          volumeMounts:
+            - name: onos-configs
+              mountPath: /opt/configs
+            - name: onos-loader
+              mountPath: /opt/loader
+      volumes:
+        - name: onos-configs
+          configMap:
+            name: {{ .Release.Name }}-onos-configs-data
+        - name: onos-loader
+          configMap:
+            name: {{ .Release.Name }}-onos-configs-loader
+            defaultMode: 0777
diff --git a/voltha-infra/values.yaml b/voltha-infra/values.yaml
new file mode 100644
index 0000000..6c6676c
--- /dev/null
+++ b/voltha-infra/values.yaml
@@ -0,0 +1,170 @@
+# Copyright 2020-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.
+
+# Default values for voltha-infra.
+# This is a YAML-formatted file.
+
+# components config
+onos-classic:
+  enabled: true
+  replicas: 1
+  atomix:
+    replicas: 0
+  image:
+    pullPolicy: Always
+    repository: voltha/voltha-onos
+    tag: master
+
+bbsim-sadis-server:
+  enabled: true
+  replicas: 1
+
+radius:
+  enabled: true
+
+etcd:
+  enabled: true
+  auth:
+    rbac:
+      enabled: false
+  persistence:
+    enabled: false
+  statefulset:
+    replicaCount: 1
+  service:
+    port: 2379
+
+kafka:
+  enabled: true
+  replicaCount: 1
+  persistence:
+    enabled: false
+  zookeeper:
+    replicaCount: 1
+    persistence:
+      enabled: false
+  service:
+    port: 9092
+
+voltha-tracing:
+  enabled: false
+  tracing:
+    maxTraces: 500000
+
+efk:
+  enabled: false
+
+# onos configuration
+# used in the job "onos-config-loader"
+onos:
+  # NOTE that these values won't change the configuration in the ONOS container, they are only used in the script that loads the config
+  username: karaf
+  password: karaf
+  netcfg: >
+    {
+      "apps" : {
+        "org.opencord.dhcpl2relay" : {
+          "dhcpl2relay" : {
+            "useOltUplinkForServerPktInOut" : true
+          }
+        },
+        "org.opencord.kafka": {
+          "kafka" : {
+            "bootstrapServers" : "{{ .Release.Name }}-kafka.{{ .Release.Namespace }}.svc:9092"
+          }
+        },
+        "org.opencord.aaa" : {
+          "AAA": {
+            "radiusConnectionType" : "socket",
+            "radiusHost": "{{ .Release.Name }}-freeradius.{{ .Release.Namespace }}.svc",
+            "radiusServerPort": "1812",
+            "radiusSecret": "SECRET"
+          }
+        },
+        "org.opencord.sadis": {
+          "sadis": {
+            "integration": {
+              "url": "http://bbsim-sadis-server.{{ .Release.Namespace }}.svc:58080/subscribers/%s",
+              "cache": {
+                "enabled": true,
+                "maxsize": 50,
+                "ttl": "PT1m"
+              }
+            }
+          },
+          "bandwidthprofile": {
+            "integration": {
+              "url": "http://bbsim-sadis-server.{{ .Release.Namespace }}.svc:58080/profiles/%s",
+              "cache": {
+                "enabled": true,
+                "maxsize": 50,
+                "ttl": "PT1m"
+              }
+            }
+          }
+        }
+      }
+    }
+  componentConfig:
+    "org.opencord.olt.impl.OltFlowService": >
+      {
+        "enableDhcpOnNni": "true",
+        "defaultTechProfileId": "64",
+        "enableIgmpOnNni": "false",
+        "enableEapol": "true",
+        "enableDhcpV6": "false",
+        "enableDhcpV4": "true"
+      }
+    "org.onosproject.provider.lldp.impl.LldpLinkProvider": >
+      {
+        "enabled": "false"
+      }
+
+# START EFK Setup to push voltha logs
+# elasticstack config
+# ref: https://github.com/elastic/helm-charts/tree/7.7.0/elasticsearch
+elasticsearch:
+  replicas: 1
+  minimumMasterNodes: 1
+  # set cpu and memory configuration
+  resources:
+    requests:
+      cpu: "400m"
+      memory: "1Gi"
+    limits:
+      cpu: "1000m"
+      memory: "2Gi"
+  # setup persistence volume.By default persistence volumeclaim is disabled
+  volumeClaimTemplate:
+    accessModes: ["ReadWriteOnce"]
+    resources:
+      requests:
+        storage: 5Gi
+  persistence:
+    enabled: false
+  # setup cluster health status as yellow
+  clusterHealthCheckParams: "wait_for_status=yellow&timeout=1s"
+
+# kibana config
+# ref: https://github.com/elastic/helm-charts/tree/7.7.0/kibana
+kibana:
+  elasticsearchHosts: "http://elasticsearch-master:9200"
+
+# fluentd-elasticsearch config
+# ref: https://github.com/kiwigrid/helm-charts/tree/master/charts/fluentd-elasticsearch
+fluentd-elasticsearch:
+  elasticsearch:
+    # set elasticsearch host
+    hosts: ["elasticsearch-master:9200"]
+    sslVerify: false