Skip to content

Commit f549a73

Browse files
committed
add support for ObjectBucketClaim and CephObjectStore
Signed-off-by: Arnaud Farbos <[email protected]>
1 parent a8e444c commit f549a73

File tree

10 files changed

+123
-0
lines changed

10 files changed

+123
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
-- CRD documentation: https://rook.github.io/docs/rook/latest-release/CRDs/Object-Storage/ceph-object-store-crd/
2+
-- Status documentation: https://github.com/rook/rook/blob/v1.17.7/pkg/apis/ceph.rook.io/v1/types.go#L1960
3+
local hs = {
4+
status = "Progressing",
5+
message = "Waiting for status to be reported"
6+
}
7+
8+
if obj.status == nil then
9+
return hs
10+
end
11+
12+
-- Check the phase status first - https://github.com/rook/rook/blob/v1.17.7/pkg/apis/ceph.rook.io/v1/types.go#L596
13+
if obj.status.phase ~= nil then
14+
hs.message = "Ceph object store phase is " .. obj.status.phase
15+
if obj.status.phase == "Ready" then
16+
hs.status = "Healthy"
17+
elseif obj.status.phase == "Failure" then
18+
hs.status = "Degraded"
19+
end
20+
end
21+
22+
if obj.status.info ~= nil and obj.status.info.endpoint ~= nil and obj.status.info.endpoint ~= "" then
23+
hs.message = hs.message .. " - endpoint: " .. obj.status.info.endpoint
24+
end
25+
26+
return hs
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tests:
2+
- healthStatus:
3+
status: Healthy
4+
message: "Ceph object store phase is Ready - endpoint: http://rook-ceph-rgw-ceph-objectstore.rook-ceph.svc:80"
5+
inputPath: testdata/healthy.yaml
6+
- healthStatus:
7+
status: Progressing
8+
message: "Ceph object store phase is Pending"
9+
inputPath: testdata/progressing.yaml
10+
- healthStatus:
11+
status: Degraded
12+
message: "Ceph object store phase is Failure"
13+
inputPath: testdata/degraded.yaml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: ceph.rook.io/v1
2+
kind: CephObjectStore
3+
metadata:
4+
name: ceph-objectstore
5+
spec: {}
6+
status:
7+
phase: Failure
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: ceph.rook.io/v1
2+
kind: CephObjectStore
3+
metadata:
4+
name: ceph-objectstore
5+
spec: {}
6+
status:
7+
phase: Ready
8+
info:
9+
endpoint: "http://rook-ceph-rgw-ceph-objectstore.rook-ceph.svc:80"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: ceph.rook.io/v1
2+
kind: CephObjectStore
3+
metadata:
4+
name: ceph-objectstore
5+
spec: {}
6+
status:
7+
phase: Pending
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- CRD documentation: https://doc.crds.dev/github.com/kube-object-storage/lib-bucket-provisioner/objectbucket.io/ObjectBucketClaim/[email protected]
2+
local hs = {
3+
status = "Progressing",
4+
message = "Waiting for status to be reported"
5+
}
6+
7+
-- Check the phase status - this is the only status field that exists - Source: https://github.com/kube-object-storage/lib-bucket-provisioner/blob/ffa47d5/pkg/apis/objectbucket.io/v1alpha1/objectbucketclaim_types.go#L58
8+
if obj.status ~= nil then
9+
if obj.status.phase ~= nil then
10+
hs.message = "Object bucket claim phase is " .. obj.status.phase
11+
if obj.status.phase == "Bound" then
12+
hs.status = "Healthy"
13+
elseif obj.status.phase == "Failed" then
14+
hs.status = "Degraded"
15+
end
16+
else
17+
hs.message = "Waiting for phase to be reported"
18+
end
19+
end
20+
21+
return hs
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tests:
2+
- healthStatus:
3+
status: Healthy
4+
message: "Object bucket claim phase is Bound"
5+
inputPath: testdata/healthy.yaml
6+
- healthStatus:
7+
status: Progressing
8+
message: "Object bucket claim phase is Pending"
9+
inputPath: testdata/progressing.yaml
10+
- healthStatus:
11+
status: Degraded
12+
message: "Object bucket claim phase is Failed"
13+
inputPath: testdata/degraded.yaml
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: objectbucket.io/v1alpha1
2+
kind: ObjectBucketClaim
3+
metadata:
4+
name: test-bucket-claim
5+
spec:
6+
bucketName: test-bucket
7+
storageClassName: ceph-bucket
8+
status:
9+
phase: Failed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: objectbucket.io/v1alpha1
2+
kind: ObjectBucketClaim
3+
metadata:
4+
name: test-bucket-claim
5+
spec:
6+
bucketName: test-bucket
7+
storageClassName: ceph-bucket
8+
status:
9+
phase: Bound
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: objectbucket.io/v1alpha1
2+
kind: ObjectBucketClaim
3+
metadata:
4+
name: test-bucket-claim
5+
spec:
6+
bucketName: test-bucket
7+
storageClassName: ceph-bucket
8+
status:
9+
phase: Pending

0 commit comments

Comments
 (0)