Skip to content

Commit a3ed9a7

Browse files
authored
Add recipe for rook-ceph operator (#2)
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
1 parent d020a5c commit a3ed9a7

1 file changed

Lines changed: 236 additions & 0 deletions

File tree

recipes/rook-ceph-operator.yaml

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
apiVersion: v1
2+
kind: kbrew
3+
app:
4+
repository:
5+
name: rook-ceph-operator
6+
url: https://raw.githubusercontent.com/rook/rook/v1.5.8/cluster/examples/kubernetes/ceph/operator.yaml
7+
type: raw
8+
name: rook-ceph-operator
9+
namespace: rook-ceph
10+
sha256:
11+
version: v1.5.8
12+
pre_install:
13+
# Install CRDs and RBAC
14+
- steps:
15+
- kubectl apply -f https://raw.githubusercontent.com/rook/rook/v1.5.8/cluster/examples/kubernetes/ceph/common.yaml
16+
- kubectl apply -f https://raw.githubusercontent.com/rook/rook/v1.5.8/cluster/examples/kubernetes/ceph/crds.yaml
17+
post_install:
18+
# Create CephCluster
19+
- steps:
20+
- |
21+
# Set correct storageclass
22+
storageclass="gp2"
23+
kubectl apply --namespace rook-ceph -f - <<EOF
24+
apiVersion: ceph.rook.io/v1
25+
kind: CephCluster
26+
metadata:
27+
name: rook-ceph
28+
namespace: rook-ceph # namespace:cluster
29+
spec:
30+
dataDirHostPath: /var/lib/rook
31+
mon:
32+
# Set the number of mons to be started. Must be an odd number, and is generally recommended to be 3.
33+
count: 3
34+
# The mons should be on unique nodes. For production, at least 3 nodes are recommended for this reason.
35+
# Mons should only be allowed on the same node for test environments where data loss is acceptable.
36+
allowMultiplePerNode: false
37+
# A volume claim template can be specified in which case new monitors (and
38+
# monitors created during fail over) will construct a PVC based on the
39+
# template for the monitor's primary storage. Changes to the template do not
40+
# affect existing monitors. Log data is stored on the HostPath under
41+
# dataDirHostPath. If no storage requirement is specified, a default storage
42+
# size appropriate for monitor data will be used.
43+
volumeClaimTemplate:
44+
spec:
45+
storageClassName: ${storageclass}
46+
resources:
47+
requests:
48+
storage: 10Gi
49+
cephVersion:
50+
image: ceph/ceph:v15.2.9
51+
allowUnsupported: false
52+
skipUpgradeChecks: false
53+
continueUpgradeAfterChecksEvenIfNotHealthy: false
54+
mgr:
55+
modules:
56+
- name: pg_autoscaler
57+
enabled: true
58+
dashboard:
59+
enabled: true
60+
ssl: true
61+
crashCollector:
62+
disable: false
63+
storage:
64+
storageClassDeviceSets:
65+
- name: set1
66+
# The number of OSDs to create from this device set
67+
count: 3
68+
# IMPORTANT: If volumes specified by the storageClassName are not portable across nodes
69+
# this needs to be set to false. For example, if using the local storage provisioner
70+
# this should be false.
71+
portable: true
72+
# Certain storage class in the Cloud are slow
73+
# Rook can configure the OSD running on PVC to accommodate that by tuning some of the Ceph internal
74+
# Currently, "gp2" has been identified as such
75+
tuneDeviceClass: true
76+
# Certain storage class in the Cloud are fast
77+
# Rook can configure the OSD running on PVC to accommodate that by tuning some of the Ceph internal
78+
# Currently, "managed-premium" has been identified as such
79+
tuneFastDeviceClass: false
80+
# whether to encrypt the deviceSet or not
81+
encrypted: false
82+
# Since the OSDs could end up on any node, an effort needs to be made to spread the OSDs
83+
# across nodes as much as possible. Unfortunately the pod anti-affinity breaks down
84+
# as soon as you have more than one OSD per node. The topology spread constraints will
85+
# give us an even spread on K8s 1.18 or newer.
86+
placement:
87+
topologySpreadConstraints:
88+
- maxSkew: 1
89+
topologyKey: kubernetes.io/hostname
90+
whenUnsatisfiable: ScheduleAnyway
91+
labelSelector:
92+
matchExpressions:
93+
- key: app
94+
operator: In
95+
values:
96+
- rook-ceph-osd
97+
preparePlacement:
98+
podAntiAffinity:
99+
preferredDuringSchedulingIgnoredDuringExecution:
100+
- weight: 100
101+
podAffinityTerm:
102+
labelSelector:
103+
matchExpressions:
104+
- key: app
105+
operator: In
106+
values:
107+
- rook-ceph-osd
108+
- key: app
109+
operator: In
110+
values:
111+
- rook-ceph-osd-prepare
112+
topologyKey: kubernetes.io/hostname
113+
topologySpreadConstraints:
114+
- maxSkew: 1
115+
topologyKey: topology.kubernetes.io/zone
116+
whenUnsatisfiable: ScheduleAnyway
117+
labelSelector:
118+
matchExpressions:
119+
- key: app
120+
operator: In
121+
values:
122+
- rook-ceph-osd-prepare
123+
resources:
124+
# These are the OSD daemon limits. For OSD prepare limits, see the separate section below for "prepareosd" resources
125+
# limits:
126+
# cpu: "500m"
127+
# memory: "4Gi"
128+
# requests:
129+
# cpu: "500m"
130+
# memory: "4Gi"
131+
volumeClaimTemplates:
132+
- metadata:
133+
name: data
134+
# if you are looking at giving your OSD a different CRUSH device class than the one detected by Ceph
135+
# annotations:
136+
# crushDeviceClass: hybrid
137+
spec:
138+
resources:
139+
requests:
140+
storage: 10Gi
141+
# IMPORTANT: Change the storage class depending on your environment (e.g. local-storage, gp2)
142+
storageClassName: ${storageclass}
143+
volumeMode: Block
144+
accessModes:
145+
- ReadWriteOnce
146+
# dedicated block device to store bluestore database (block.db)
147+
# - metadata:
148+
# name: metadata
149+
# spec:
150+
# resources:
151+
# requests:
152+
# # Find the right size https://docs.ceph.com/docs/master/rados/configuration/bluestore-config-ref/#sizing
153+
# storage: 5Gi
154+
# # IMPORTANT: Change the storage class depending on your environment (e.g. local-storage, io1)
155+
# storageClassName: io1
156+
# volumeMode: Block
157+
# accessModes:
158+
# - ReadWriteOnce
159+
# dedicated block device to store bluestore wal (block.wal)
160+
# - metadata:
161+
# name: wal
162+
# spec:
163+
# resources:
164+
# requests:
165+
# # Find the right size https://docs.ceph.com/docs/master/rados/configuration/bluestore-config-ref/#sizing
166+
# storage: 5Gi
167+
# # IMPORTANT: Change the storage class depending on your environment (e.g. local-storage, io1)
168+
# storageClassName: io1
169+
# volumeMode: Block
170+
# accessModes:
171+
# - ReadWriteOnce
172+
# Scheduler name for OSD pod placement
173+
# schedulerName: osd-scheduler
174+
resources:
175+
# prepareosd:
176+
# limits:
177+
# cpu: "200m"
178+
# memory: "200Mi"
179+
# requests:
180+
# cpu: "200m"
181+
# memory: "200Mi"
182+
disruptionManagement:
183+
managePodBudgets: false
184+
osdMaintenanceTimeout: 30
185+
pgHealthCheckTimeout: 0
186+
manageMachineDisruptionBudgets: false
187+
machineDisruptionBudgetNamespace: openshift-machine-api
188+
# security oriented settings
189+
# security:
190+
# To enable the KMS configuration properly don't forget to uncomment the Secret at the end of the file
191+
# kms:
192+
# # name of the config map containing all the kms connection details
193+
# connectionDetails:
194+
#KMS_PROVIDER: "vault"
195+
#VAULT_ADDR: VAULT_ADDR_CHANGE_ME # e,g: https://vault.my-domain.com:8200
196+
#VAULT_BACKEND_PATH: "rook"
197+
# # name of the secret containing the kms authentication token
198+
# tokenSecretName: rook-vault-token
199+
# UNCOMMENT THIS TO ENABLE A KMS CONNECTION
200+
# Also, do not forget to replace both:
201+
# * ROOK_TOKEN_CHANGE_ME: with a base64 encoded value of the token to use
202+
# * VAULT_ADDR_CHANGE_ME: with the Vault address
203+
# ---
204+
# apiVersion: v1
205+
# kind: Secret
206+
# metadata:
207+
# name: rook-vault-token
208+
# namespace: rook-ceph # namespace:cluster
209+
# data:
210+
# token: ROOK_TOKEN_CHANGE_ME
211+
EOF
212+
# Wait for cluster to be ready
213+
- steps:
214+
# Verify if the ceph cluster is ready
215+
- |
216+
echo "Waiting for ceph cluster to be ready"
217+
retry=0
218+
while true;
219+
do
220+
phase=$(kubectl get cephcluster -n rook-ceph rook-ceph -o jsonpath='{.status.phase}')
221+
if [ ! -z "${phase}" ] && [ "${phase}" = "Ready" ]; then break; fi
222+
if [ "${retry}" = 30 ]; then echo "timed out while waiting for cluster to be ready"; exit 1; fi
223+
sleep 5
224+
retry=$((retry+1))
225+
done
226+
# Create storageclass and volumesnapshotclass to support volumesnapshots
227+
- steps:
228+
- |
229+
# Create VolumeSnapshot CRDs if not exists
230+
# TODO: Skip creation if CRDs already exists
231+
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-4.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
232+
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-4.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
233+
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-4.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
234+
235+
- kubectl apply -f https://raw.githubusercontent.com/rook/rook/v1.5.8/cluster/examples/kubernetes/ceph/csi/rbd/storageclass.yaml
236+
- kubectl apply -f https://raw.githubusercontent.com/rook/rook/v1.5.8/cluster/examples/kubernetes/ceph/csi/rbd/snapshotclass.yaml

0 commit comments

Comments
 (0)