[SEBA-83]

Create charts/docs for Persistent Storage
- Ceph (block volumes, and shared filesystem) using Rook
- Local mounted volumes with local-provisioner
- Local directories with local-directory

Change-Id: I65e8a55ca4fbdb6c9754beec6b7ce5ea010ad642
diff --git a/storage/rook-cluster/Chart.yaml b/storage/rook-cluster/Chart.yaml
new file mode 100644
index 0000000..0c80d0f
--- /dev/null
+++ b/storage/rook-cluster/Chart.yaml
@@ -0,0 +1,18 @@
+---
+# 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.
+
+description: Sets up Rook for Ceph storage in testing environments
+name: rook-cluster
+version: 0.1.0-dev0
diff --git a/storage/rook-cluster/templates/00_rook_rbac.yaml b/storage/rook-cluster/templates/00_rook_rbac.yaml
new file mode 100644
index 0000000..9bb4fa6
--- /dev/null
+++ b/storage/rook-cluster/templates/00_rook_rbac.yaml
@@ -0,0 +1,74 @@
+---
+# 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.
+
+# For more information, see documentation:
+#  https://rook.io/docs/rook/v0.8/rbac.html
+#  https://github.com/rook/rook/blob/master/cluster/examples/kubernetes/ceph/cluster.yaml
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: {{ .Values.rookClusterNamespace }}
+
+---
+# Next 3 items: Allow the pods in this namespace to work with configmaps
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: rook-ceph-cluster
+  namespace: {{ .Values.rookClusterNamespace }}
+
+---
+kind: Role
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: rook-ceph-cluster
+  namespace: {{ .Values.rookClusterNamespace }}
+rules:
+- apiGroups: [""]
+  resources: ["configmaps"]
+  verbs: [ "get", "list", "watch", "create", "update", "delete" ]
+
+---
+kind: RoleBinding
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: rook-ceph-cluster
+  namespace: {{ .Values.rookClusterNamespace }}
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: Role
+  name: rook-ceph-cluster
+subjects:
+- kind: ServiceAccount
+  name: rook-ceph-cluster
+  namespace: {{ .Values.rookClusterNamespace }}
+
+---
+# Allow the operator to create resources in this cluster's namespace
+kind: RoleBinding
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: rook-ceph-cluster-mgmt
+  namespace: {{ .Values.rookClusterNamespace }}
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: rook-ceph-cluster-mgmt
+subjects:
+- kind: ServiceAccount
+  name: rook-ceph-system
+  namespace: {{ .Values.rookSystemNamespace }}
+
diff --git a/storage/rook-cluster/templates/NOTES.txt b/storage/rook-cluster/templates/NOTES.txt
new file mode 100644
index 0000000..ede3f63
--- /dev/null
+++ b/storage/rook-cluster/templates/NOTES.txt
@@ -0,0 +1,11 @@
+This chart creates a Ceph cluster using Rook (similar to Rook's cluster.yaml)
+
+Ceph data is stored in this directory on all nodes: {{ .Values.cephDataDir }}
+
+The Ceph pool name is: {{ .Values.rookPoolName }}
+
+StorageClasses provided:
+
+ Rados Block Device (volumes): {{ .Values.rbdStorageClassName }}
+ Shared CephFS Filesystem: {{ .Values.fsStorageClassName }}, of size: {{ .Values.rookCephfsPersistentVolumeSize }}
+
diff --git a/storage/rook-cluster/templates/ceph_cluster.yaml b/storage/rook-cluster/templates/ceph_cluster.yaml
new file mode 100644
index 0000000..99d939a
--- /dev/null
+++ b/storage/rook-cluster/templates/ceph_cluster.yaml
@@ -0,0 +1,60 @@
+---
+# 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.
+
+# reference: https://rook.github.io/docs/rook/v0.8/ceph-cluster-crd.html
+# Modeled after "Storage Configuration: Cluster wide Directories"
+
+apiVersion: ceph.rook.io/v1beta1
+kind: Cluster
+metadata:
+  name: rook-ceph
+  namespace: {{ .Values.rookClusterNamespace }}
+spec:
+  dataDirHostPath: /var/lib/rook
+  serviceAccount: rook-ceph-cluster
+  # cluster level storage configuration and selection
+  storage:
+    useAllNodes: true
+    useAllDevices: false
+    config:
+      databaseSizeMB: "1024" # this value can be removed for environments with normal sized disks (100 GB or larger)
+      journalSizeMB: "1024"  # this value can be removed for environments with normal sized disks (20 GB or larger)
+    directories:
+      - path: {{ .Values.cephDataDir | quote }}
+
+---
+# reference: https://rook.io/docs/rook/v0.8/ceph-pool-crd.html
+
+apiVersion: ceph.rook.io/v1beta1
+kind: Pool
+metadata:
+  name: {{ .Values.rookPoolName }}
+  namespace: {{ .Values.rookClusterNamespace }}
+spec:
+  replicated:
+    size: 2
+
+---
+# reference: https://rook.io/docs/rook/v0.8/block.html
+
+apiVersion: storage.k8s.io/v1
+kind: StorageClass
+metadata:
+   name: {{ .Values.rbdStorageClassName }}
+provisioner: ceph.rook.io/block
+parameters:
+  pool:  {{ .Values.rookPoolName }}
+  clusterNamespace: {{ .Values.rookClusterNamespace }}
+
diff --git a/storage/rook-cluster/templates/ceph_fs.yaml b/storage/rook-cluster/templates/ceph_fs.yaml
new file mode 100644
index 0000000..e53d1d3
--- /dev/null
+++ b/storage/rook-cluster/templates/ceph_fs.yaml
@@ -0,0 +1,58 @@
+---
+# 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.
+
+# reference: https://rook.github.io/docs/rook/v0.8/filesystem.html
+
+apiVersion: ceph.rook.io/v1beta1
+kind: Filesystem
+metadata:
+  name: {{ .Values.rookCephfsName }}
+  namespace: {{ .Values.rookClusterNamespace }}
+spec:
+  metadataPool:
+    replicated:
+      size: 2
+  dataPools:
+    - replicated:
+        size: 2
+  metadataServer:
+    activeCount: 1
+    activeStandby: true
+
+---
+apiVersion: storage.k8s.io/v1
+kind: StorageClass
+metadata:
+  name: {{ .Values.fsStorageClassName }}
+provisioner: kubernetes.io/no-provisioner
+
+---
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: {{ .Values.rookCephfsPersistentVolumeName }}
+spec:
+  storageClassName: {{ .Values.fsStorageClassName }}
+  capacity:
+    storage: {{ .Values.rookCephfsPersistentVolumeSize }}
+  accessModes:
+    - ReadWriteMany
+  flexVolume:
+    driver: ceph.rook.io/rook
+    fsType: ceph
+    options:
+      fsName:  {{ .Values.rookCephfsName }}
+      clusterNamespace: {{ .Values.rookClusterNamespace }}
+
diff --git a/storage/rook-cluster/values.yaml b/storage/rook-cluster/values.yaml
new file mode 100644
index 0000000..04470a9
--- /dev/null
+++ b/storage/rook-cluster/values.yaml
@@ -0,0 +1,33 @@
+---
+# 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.
+
+# values file for rook-cluster
+
+# directory on k8s nodes that holds ceph data
+cephDataDir: "/mnt/ceph"
+
+rookSystemNamespace: "rook-ceph-system"
+rookClusterNamespace: "rook-ceph"
+
+rookPoolName: "cord-ceph-pool"
+rookCephfsName: "cord-ceph-filesystem"
+
+rookCephfsPersistentVolumeName: "cord-cephfs-pv"
+rookCephfsPersistentVolumeSize: 20Gi
+
+# StorageClass used by other charts to create PersistentVolumeClaims
+rbdStorageClassName: "cord-ceph-rbd"
+fsStorageClassName: "cord-cephfs"
+