Refactor NEM charts to allow for multiple profiles
Change-Id: Ib98f1fc9ff9b7b0801a90edf4c8ec78cb4198014
diff --git a/helm-charts/README.md b/helm-charts/README.md
index 8bf705b..92d57ab 100644
--- a/helm-charts/README.md
+++ b/helm-charts/README.md
@@ -8,9 +8,11 @@
```
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 nem-core
+helm dep update profile/bng-in-fabric
helm dep update seba-substrate
-helm install nem -n nem
+helm install nem-core -n nem-core
+helm install profile/bng-in-fabric -n nem-svc
helm install seba-substrate -n seba-substrate
helm upgrade seba-substrate --set voltha.etcd-operator.customResources.createEtcdClusterCRD=true seba-substrate
```
@@ -19,6 +21,6 @@
wait until all pods have started successfully:
```
-tools/wait-for-pods.sh
-tools/wait-for-pods.sh voltha
+../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-core/.helmignore
similarity index 100%
rename from helm-charts/nem/.helmignore
rename to helm-charts/nem-core/.helmignore
diff --git a/helm-charts/nem/Chart.yaml b/helm-charts/nem-core/Chart.yaml
similarity index 90%
rename from helm-charts/nem/Chart.yaml
rename to helm-charts/nem-core/Chart.yaml
index 10e3a15..d23be31 100644
--- a/helm-charts/nem/Chart.yaml
+++ b/helm-charts/nem-core/Chart.yaml
@@ -14,7 +14,7 @@
# limitations under the License.
apiVersion: v1
-name: nem
-description: A Helm chart for NEM
+name: nem-core
+description: A Helm chart that installs the NEM core
version: 0.1.0
diff --git a/helm-charts/nem/requirements.yaml b/helm-charts/nem-core/requirements.yaml
similarity index 80%
rename from helm-charts/nem/requirements.yaml
rename to helm-charts/nem-core/requirements.yaml
index e653852..be454e2 100644
--- a/helm-charts/nem/requirements.yaml
+++ b/helm-charts/nem-core/requirements.yaml
@@ -19,15 +19,7 @@
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
+ alias: 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-core/templates/NOTES.txt
similarity index 100%
rename from helm-charts/nem/templates/NOTES.txt
rename to helm-charts/nem-core/templates/NOTES.txt
diff --git a/helm-charts/nem/values.yaml b/helm-charts/nem-core/values.yaml
similarity index 98%
rename from helm-charts/nem/values.yaml
rename to helm-charts/nem-core/values.yaml
index 7005c11..4696c48 100644
--- a/helm-charts/nem/values.yaml
+++ b/helm-charts/nem-core/values.yaml
@@ -15,7 +15,7 @@
# Aggregation chart of NEM charts
-cord-kafka:
+kafka:
replicas: 1
persistence:
enabled: false
diff --git a/helm-charts/nem/.helmignore b/helm-charts/profile/bng-in-fabric/.helmignore
similarity index 100%
copy from helm-charts/nem/.helmignore
copy to helm-charts/profile/bng-in-fabric/.helmignore
diff --git a/helm-charts/nem/Chart.yaml b/helm-charts/profile/bng-in-fabric/Chart.yaml
similarity index 79%
copy from helm-charts/nem/Chart.yaml
copy to helm-charts/profile/bng-in-fabric/Chart.yaml
index 10e3a15..b98397b 100644
--- a/helm-charts/nem/Chart.yaml
+++ b/helm-charts/profile/bng-in-fabric/Chart.yaml
@@ -1,5 +1,6 @@
---
-# Copyright 2017-present Open Networking Foundation
+
+# 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.
@@ -14,7 +15,7 @@
# limitations under the License.
apiVersion: v1
-name: nem
-description: A Helm chart for NEM
+appVersion: "1.0"
+description: A Helm chart for NEM's "bng-in-fabric" profile
+name: bng-in-fabric
version: 0.1.0
-
diff --git a/helm-charts/nem/requirements.yaml b/helm-charts/profile/bng-in-fabric/requirements.yaml
similarity index 63%
copy from helm-charts/nem/requirements.yaml
copy to helm-charts/profile/bng-in-fabric/requirements.yaml
index e653852..d4c3a95 100644
--- a/helm-charts/nem/requirements.yaml
+++ b/helm-charts/profile/bng-in-fabric/requirements.yaml
@@ -1,5 +1,5 @@
---
-# Copyright 2017-present Open Networking Foundation
+# 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.
@@ -14,20 +14,24 @@
# limitations under the License.
dependencies:
-
-- name: xos-core
+- name: rcord
+ version: 1.0.0
+ repository: https://charts.opencord.org/master/
+- name: onos-service
version: 2.0.0
repository: https://charts.opencord.org/master/
-
-- name: rcord-lite
- version: 0.1.0
+- name: fabric
+ version: 2.0.0
repository: https://charts.opencord.org/master/
-
+- name: volt
+ version: 2.0.0
+ repository: https://charts.opencord.org/master/
+- name: vsg-hw
+ version: 1.0.0
+ repository: https://charts.opencord.org/master/
+- name: vrouter
+ version: 2.0.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/profile/bng-in-fabric/templates/_helpers.tpl b/helm-charts/profile/bng-in-fabric/templates/_helpers.tpl
new file mode 100644
index 0000000..1cf7cbb
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/templates/_helpers.tpl
@@ -0,0 +1,47 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+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.
+*/}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "bng-in-fabric.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "bng-in-fabric.fullname" -}}
+{{- if .Values.fullnameOverride -}}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- $name := default .Chart.Name .Values.nameOverride -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "bng-in-fabric.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/helm-charts/profile/bng-in-fabric/templates/_tosca.tpl b/helm-charts/profile/bng-in-fabric/templates/_tosca.tpl
new file mode 100644
index 0000000..cb6aebb
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/templates/_tosca.tpl
@@ -0,0 +1,255 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+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.
+*/}}
+{{- define "bng-in-fabric.basicFixturesTosca" -}}
+tosca_definitions_version: tosca_simple_yaml_1_0
+description: Some basic fixtures
+imports:
+ - custom_types/siterole.yaml
+ - custom_types/slicerole.yaml
+ - custom_types/networkparametertype.yaml
+ - custom_types/networktemplate.yaml
+ - custom_types/deployment.yaml
+topology_template:
+ node_templates:
+
+# -----------------------------------------------------------------------------
+# Network Parameter Types
+# -----------------------------------------------------------------------------
+ s_tag:
+ type: tosca.nodes.NetworkParameterType
+ properties:
+ name: s_tag
+ c_tag:
+ type: tosca.nodes.NetworkParameterType
+ properties:
+ name: c_tag
+ next_hop:
+ type: tosca.nodes.NetworkParameterType
+ properties:
+ name: next_hop
+ device:
+ type: tosca.nodes.NetworkParameterType
+ properties:
+ name: device
+ bridge:
+ type: tosca.nodes.NetworkParameterType
+ properties:
+ name: bridge
+ neutron_port_name:
+ type: tosca.nodes.NetworkParameterType
+ properties:
+ name: neutron_port_name
+
+# ----------------------------------------------------------------------------
+# Roles
+# ----------------------------------------------------------------------------
+ siterole#admin:
+ type: tosca.nodes.SiteRole
+ properties:
+ role: admin
+ siterole#pi:
+ type: tosca.nodes.SiteRole
+ properties:
+ role: pi
+ siterole#tech:
+ type: tosca.nodes.SiteRole
+ properties:
+ role: tech
+ slicerole#admin:
+ type: tosca.nodes.SliceRole
+ properties:
+ role: admin
+ slicerole#access:
+ type: tosca.nodes.SliceRole
+ properties:
+ role: access
+
+# -----------------------------------------------------------------------------
+# Network Templates
+# -----------------------------------------------------------------------------
+ Private:
+ type: tosca.nodes.NetworkTemplate
+ properties:
+ name: Private
+ visibility: private
+ translation: none
+
+ Public shared IPv4:
+ type: tosca.nodes.NetworkTemplate
+ properties:
+ name: Public shared IPv4
+ visibility: private
+ translation: NAT
+ shared_network_name: nat-net
+
+ Public dedicated IPv4:
+ type: tosca.nodes.NetworkTemplate
+ properties:
+ name: Public dedicated IPv4
+ visibility: public
+ translation: none
+ shared_network_name: ext-net
+
+# -----------------------------------------------------------------------------
+# Deployment
+# -----------------------------------------------------------------------------
+ MyDeployment:
+ type: tosca.nodes.Deployment
+ properties:
+ name: MyDeployment
+{{- end -}}
+
+
+{{- define "bng-in-fabric.serviceGraphTosca" -}}
+tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+ - custom_types/fabricservice.yaml
+ - custom_types/onosservice.yaml
+ - custom_types/rcordservice.yaml
+ - custom_types/vrouterservice.yaml
+ - custom_types/voltservice.yaml
+ - custom_types/vsghwservice.yaml
+ - custom_types/servicedependency.yaml
+ - custom_types/servicegraphconstraint.yaml
+description: NEM's bng-in-fabric service graph
+topology_template:
+ node_templates:
+
+# These services must be defined before loading the graph
+
+ service#ONOS_Fabric:
+ type: tosca.nodes.ONOSService
+ properties:
+ name: ONOS_Fabric
+ must-exist: true
+
+ service#ONOS_VOLTHA:
+ type: tosca.nodes.ONOSService
+ properties:
+ name: ONOS_VOLTHA
+ must-exist: true
+
+ service#fabric:
+ type: tosca.nodes.FabricService
+ properties:
+ name: fabric
+ must-exist: true
+
+ service#rcord:
+ type: tosca.nodes.RCORDService
+ properties:
+ name: rcord
+ must-exist: true
+
+ service#vrouter:
+ type: tosca.nodes.VRouterService
+ properties:
+ name: vrouter
+ must-exist: true
+
+ service#volt:
+ type: tosca.nodes.VOLTService
+ properties:
+ name: volt
+ must-exist: true
+
+ service#vsg-hw:
+ type: tosca.nodes.VSGHWService
+ properties:
+ name: vsg-hw
+ must-exist: true
+
+# The service graph
+
+ service_dependency#onos-fabric_fabric:
+ type: tosca.nodes.ServiceDependency
+ properties:
+ connect_method: None
+ requirements:
+ - subscriber_service:
+ node: service#ONOS_Fabric
+ relationship: tosca.relationships.BelongsToOne
+ - provider_service:
+ node: service#fabric
+ relationship: tosca.relationships.BelongsToOne
+
+ service_dependency#rcord_volt:
+ type: tosca.nodes.ServiceDependency
+ properties:
+ connect_method: None
+ requirements:
+ - subscriber_service:
+ node: service#rcord
+ relationship: tosca.relationships.BelongsToOne
+ - provider_service:
+ node: service#volt
+ relationship: tosca.relationships.BelongsToOne
+
+ service_dependency#onos_voltha_volt:
+ type: tosca.nodes.ServiceDependency
+ properties:
+ connect_method: None
+ requirements:
+ - subscriber_service:
+ node: service#volt
+ relationship: tosca.relationships.BelongsToOne
+ - provider_service:
+ node: service#ONOS_VOLTHA
+ relationship: tosca.relationships.BelongsToOne
+
+ service_dependency#fabric_vrouter:
+ type: tosca.nodes.ServiceDependency
+ properties:
+ connect_method: None
+ requirements:
+ - subscriber_service:
+ node: service#fabric
+ relationship: tosca.relationships.BelongsToOne
+ - provider_service:
+ node: service#vrouter
+ relationship: tosca.relationships.BelongsToOne
+
+ service_dependency#volt_vsg-hw:
+ type: tosca.nodes.ServiceDependency
+ properties:
+ connect_method: None
+ requirements:
+ - subscriber_service:
+ node: service#volt
+ relationship: tosca.relationships.BelongsToOne
+ - provider_service:
+ node: service#vsg-hw
+ relationship: tosca.relationships.BelongsToOne
+
+ service_dependency#onos_fabric_vsg-hw:
+ type: tosca.nodes.ServiceDependency
+ properties:
+ connect_method: None
+ requirements:
+ - subscriber_service:
+ node: service#vsg-hw
+ relationship: tosca.relationships.BelongsToOne
+ - provider_service:
+ node: service#ONOS_Fabric
+ relationship: tosca.relationships.BelongsToOne
+
+ constraints:
+ type: tosca.nodes.ServiceGraphConstraint
+ properties:
+ constraints: '[[null, "rcord"], ["ONOS_VOLTHA", "volt"], ["ONOS_Fabric", "vsg-hw"], ["fabric", null], ["vrouter", null]]'
+{{- end -}}
+
diff --git a/helm-charts/profile/bng-in-fabric/templates/tests/test-api.yaml b/helm-charts/profile/bng-in-fabric/templates/tests/test-api.yaml
new file mode 100644
index 0000000..94a3ab5
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/templates/tests/test-api.yaml
@@ -0,0 +1,45 @@
+---
+# 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
+kind: Pod
+metadata:
+ name: "{{ .Release.Name }}-api-test"
+ annotations:
+ "helm.sh/hook": test-success
+spec:
+ restartPolicy: Never
+ containers:
+ - name: {{ .Release.Name }}-api-test
+ image: {{ .Values.xos_api_testerImage }}
+ imagePullPolicy: {{ .Values.imagePullPolicy }}
+ volumeMounts:
+ - name: log-volume
+ mountPath: /src/cord-api/Tests/Log/
+ env:
+ - name: SERVER_IP
+ value: 'xos-chameleon'
+ - name: SERVER_PORT
+ value: '9101'
+ - name: XOS_USER
+ value: {{ .Values.xosAdminUser | quote }}
+ - name: XOS_PASSWD
+ value: {{ .Values.xosAdminPassword | quote}}
+ command: ["pybot", "-L", "TRACE", "-d", "Log", "-T", "VOLTDevice_Test.txt", "RCORDLite_E2ETest.txt"]
+ volumes:
+ - name: log-volume
+ hostPath:
+ path: /tmp/helm_test_bng-in-fabric_logs_{{ dateInZone "20060102T030405.00Z" (now) "UTC" }}
+ type: DirectoryOrCreate
diff --git a/helm-charts/profile/bng-in-fabric/templates/tosca-configmap.yaml b/helm-charts/profile/bng-in-fabric/templates/tosca-configmap.yaml
new file mode 100644
index 0000000..8efaeb7
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/templates/tosca-configmap.yaml
@@ -0,0 +1,39 @@
+---
+
+# 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: bng-in-fabric-tosca
+data:
+ 010-fixtures.yaml: |
+{{ include "bng-in-fabric.basicFixturesTosca" . | indent 4 }}
+ 020-rcord-subscriber-service.yaml: |
+{{ include "rcord.serviceTosca" .Values.rcord | indent 4 }}
+ 030-volt-service.yaml: |
+{{ include "volt.serviceTosca" .Values.volt | indent 4 }}
+ 040-vsg-hw-service.yaml: |
+{{ include "vsg-hw.serviceTosca" (index .Values "vsg-hw") | indent 4 }}
+ 050-vrouter-service.yaml: |
+{{ include "vrouter.serviceTosca" .Values.vrouter | indent 4 }}
+ 060-onos-service-fabric.yaml: |
+{{ include "onos-service.fabricAppTosca" (index .Values "onos-service") | indent 4 }}
+ 061-onos-voltha-service-fabric.yaml: |
+{{ include "onos-service.volthaOnosTosca" (index .Values "onos-service") | indent 4 }}
+ 070-fabric-service.yaml: |
+{{ include "fabric.serviceTosca" .Values.fabric | indent 4 }}
+ 300-service-graph.yaml: |
+{{ include "bng-in-fabric.serviceGraphTosca" . | indent 4 }}
diff --git a/helm-charts/profile/bng-in-fabric/templates/tosca-job.yaml b/helm-charts/profile/bng-in-fabric/templates/tosca-job.yaml
new file mode 100644
index 0000000..a16ed0a
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/templates/tosca-job.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 "bng-in-fabric.fullname" . }}-tosca-loader
+ labels:
+ app: {{ template "bng-in-fabric.name" . }}
+ chart: {{ template "bng-in-fabric.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+spec:
+ backoffLimit: 12
+ template:
+ metadata:
+ labels:
+ app: {{ template "bng-in-fabric.name" . }}
+ release: {{ .Release.Name }}
+ annotations:
+ checksum/config: {{ include (print $.Template.BasePath "/tosca-configmap.yaml") . | sha256sum }}
+ spec:
+ restartPolicy: OnFailure
+ containers:
+ - name: {{ .Chart.Name }}-tosca-loader
+ image: {{ tpl .Values.tosca_loaderImage . | quote }}
+ imagePullPolicy: {{ .Values.imagePullPolicy }}
+ env:
+ - name: XOS_USER
+ value: {{ .Values.xosAdminUser }}
+ - name: XOS_PASSWD
+ valueFrom:
+ secretKeyRef:
+ name: xos-admin-passwd-secret
+ key: password
+ volumeMounts:
+ - name: bng-in-fabric-tosca
+ mountPath: /opt/tosca
+ volumes:
+ - name: bng-in-fabric-tosca
+ configMap:
+ name: bng-in-fabric-tosca
diff --git a/helm-charts/profile/bng-in-fabric/values.yaml b/helm-charts/profile/bng-in-fabric/values.yaml
new file mode 100644
index 0000000..c436529
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/values.yaml
@@ -0,0 +1,38 @@
+---
+# 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.
+
+# Default values for the bng-in-fabric profile.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+replicaCount: 1
+
+nameOverride: ""
+fullnameOverride: ""
+
+imagePullPolicy: 'Always'
+
+tosca_loaderImage: "xosproject/tosca-loader:1.0.1"
+
+xos_api_testerImage: 'xosproject/xos-api-tester:2.0.1'
+
+xosAdminUser: "admin@opencord.org"
+xosAdminPassword: "letmein"
+
+volt:
+ kafkaService: "nem-core-kafka.default.svc.cluster.local"
+onos-service:
+ kafkaService: "nem-core-kafka.default.svc.cluster.local"
+ onosFabricRestService: "seba-substrate-onos-fabric-ui.default.svc.cluster.local"