COMAC-166 Use official casssandra chart for hssdb

Change-Id: I4d0dcb757bc5ceb5697ef4d1367c918a8ef67878
diff --git a/mcord-release/mcord-services/.gitignore b/mcord-release/mcord-services/.gitignore
new file mode 100644
index 0000000..ee3892e
--- /dev/null
+++ b/mcord-release/mcord-services/.gitignore
@@ -0,0 +1 @@
+charts/
diff --git a/mcord-release/mcord-services/requirements.yaml b/mcord-release/mcord-services/requirements.yaml
new file mode 100644
index 0000000..ec39473
--- /dev/null
+++ b/mcord-release/mcord-services/requirements.yaml
@@ -0,0 +1,19 @@
+# Copyright 2019-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: cassandra
+    version: 0.13.1
+    repository: https://kubernetes-charts-incubator.storage.googleapis.com/
+    condition: cassandra.deploy
diff --git a/mcord-release/mcord-services/templates/hss.yaml b/mcord-release/mcord-services/templates/hss.yaml
index 4ed1a1d..10288a6 100644
--- a/mcord-release/mcord-services/templates/hss.yaml
+++ b/mcord-release/mcord-services/templates/hss.yaml
@@ -18,6 +18,10 @@
 This is a YAML-formatted file.
 Declare variables to be passed into your templates.
 */}}
+
+{{- if not (hasKey .Values.config.hss "hssdb") -}}
+{{- $_ := .Values.cassandra.fullnameOverride | set .Values.config.hss "hssdb" -}}
+{{- end }}
 ---
 apiVersion: v1
 kind: ConfigMap
@@ -255,7 +259,7 @@
           until data_provisioning_mme.sh 1 19136246000 smsrouter.test3gpp.net test3gpp.net 0 $HSSDB_ADDR; do echo "setting up smsrouter"; sleep 2; done;
         env:
         - name: HSSDB_ADDR
-          value: hssdb
+          value: {{ .Values.config.hss.hssdb }}
         - name: MME_HOST
           value: {{ tuple "mme" "host" . | include "mcord-services.endpoint_lookup" | quote }}
         - name: MME_REALM
@@ -268,7 +272,7 @@
         tty: true
         env:
         - name: HSSDB_ADDR
-          value: hssdb
+          value: {{ .Values.config.hss.hssdb }}
         - name: MME_IDENTITY
           value: {{ tuple "mme" "identity" . | include "mcord-services.endpoint_lookup" | quote }}
         command: ["bash", "-c", "/opt/c3po/hss/launch.sh; sleep 3600"]
diff --git a/mcord-release/mcord-services/templates/hssdb.yaml b/mcord-release/mcord-services/templates/hssdb.yaml
deleted file mode 100644
index 7bd033b..0000000
--- a/mcord-release/mcord-services/templates/hssdb.yaml
+++ /dev/null
@@ -1,106 +0,0 @@
-{{/*
-Copyright 2018-present Open Networking Foundation
-Copyright 2018 Intel Corporation
-
-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: hssdb
-  labels:
-{{ tuple "hssdb" . | include "mcord-services.metadata_labels" | indent 4 }}
-data:
-  cassandra-rackdc.properties: |
-    dc=DC1
-    rack=RAC1
-    prefer_local=true
----
-apiVersion: v1
-kind: Service
-metadata:
-  name: hssdb
-  labels:
-{{ tuple "hssdb" . | include "mcord-services.metadata_labels" | indent 4 }}
-spec:
-  clusterIP: None
-  ports:
-  - name: cql
-    port: 9042
-  selector:
-{{ tuple "hssdb" . | include "mcord-services.metadata_labels" | indent 4 }}
----
-apiVersion: "apps/v1"
-kind: StatefulSet
-metadata:
-  name: hssdb
-  labels:
-{{ tuple "hssdb" . | include "mcord-services.metadata_labels" | indent 4 }}
-spec:
-  serviceName: hssdb
-  replicas: 1
-  selector:
-    matchLabels:
-{{ tuple "hssdb" . | include "mcord-services.metadata_labels" | indent 6 }}
-  template:
-    metadata:
-      labels:
-{{ tuple "hssdb" . | include "mcord-services.metadata_labels" | indent 8 }}
-    spec:
-    {{- if .Values.nodeSelectors.enabled }}
-      nodeSelector:
-        {{ .Values.nodeSelectors.hssdb.label }}: {{ .Values.nodeSelectors.hssdb.value }}
-    {{- end }}
-      securityContext:
-        runAsUser: 999
-        fsGroup: 999
-      containers:
-      - name: cassandra
-        image: {{ .Values.images.tags.hssdb }}
-        imagePullPolicy: {{ .Values.images.pullPolicy }}
-        ports:
-        - containerPort: 9042
-          name: cql
-        env:
-        - name: MAX_HEAP_SIZE
-          value: 512M
-        - name: HEAP_NEWSIZE
-          value: 100M
-        - name: CASSANDRA_SEEDS
-          value: {{ tuple "hssdb" "identity" . | include "mcord-services.endpoint_lookup" | quote }}
-        - name: CASSANDRA_CLUSTER_NAME
-          value: "HSS Cluster"
-        - name: CASSANDRA_RPC_ADDRESS
-          valueFrom:
-            fieldRef:
-              fieldPath: status.podIP
-        - name: CASSANDRA_ENDPOINT_SNITCH
-          value: "GossipingPropertyFileSnitch"
-        readinessProbe:
-          exec:
-            command: ["/bin/bash", "-c", "nodetool status -r | awk -v h=$(hostname) '$2==h {exit ($1==\"UN\" ? 0 : -1)}'"]
-          initialDelaySeconds: 15
-          timeoutSeconds: 5
-      {{- if .Values.resources.enabled }}
-        resources:
-{{ toYaml .Values.resources.hssdb | indent 10 }}
-      {{- end }}
-        volumeMounts:
-        - name: hssdb-config
-          mountPath: /etc/cassandra/cassandra-rackdc.properties
-          subPath: cassandra-rackdc.properties
-      volumes:
-      - name: hssdb-config
-        configMap:
-          name: hssdb
diff --git a/mcord-release/mcord-services/values.yaml b/mcord-release/mcord-services/values.yaml
index 876dcc7..32938fa 100644
--- a/mcord-release/mcord-services/values.yaml
+++ b/mcord-release/mcord-services/values.yaml
@@ -26,9 +26,6 @@
 
 nodeSelectors:
   enabled: false
-  hssdb:
-    label: omec-cp
-    value: enabled
   hss:
     label: omec-cp
     value: enabled
@@ -44,13 +41,6 @@
 
 resources:
   enabled: true
-  hssdb:
-    requests:
-      cpu: 2
-      memory: 4Gi
-    limits:
-      cpu: 2
-      memory: 4Gi
   hss:
     requests:
       cpu: 2
@@ -82,9 +72,31 @@
       cpu: 4
       memory: 8Gi
 
+cassandra:
+  deploy: true
+  fullnameOverride: cassandra
+  image:
+    tag: 2.1.20
+  #selector:
+  #  nodeSelector:
+  #    cassandra: enabled
+  persistence:
+    enabled: false
+  config:
+    #cluster_size: 1
+    endpoint_snitch: GossipingPropertyFileSnitch
+  resources: {}
+    #requests:
+    #  memory: 4Gi
+    #  cpu: 2
+    #limits:
+    #  memory: 4Gi
+    #  cpu: 2
+
 config:
-  hssdb: {}
   hss: {}
+    # hssdb will be set to cassandra if unset
+    #hssdb:
   mme:
     mme:
       name: vmmestandalone