---
# 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 }}

