Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
local hs = {}

local amountOfNodes = 0
if obj.status ~= nil and obj.status.nodeStatuses ~= nil then
for _, _ in pairs(obj.status.nodeStatuses) do
amountOfNodes = amountOfNodes + 1
end
else
hs.status = "Degraded"
hs.message = "No nodeStatus in object's status"
return hs
end

if obj.spec ~= nil and obj.spec.size ~= nil then
if obj.spec.size == amountOfNodes then
hs.status = "Healthy"
return hs
else
hs.status = "Degraded"
hs.message = "Size in spec and number of nodes in status differ"
end
else
hs.status = "Degraded"
hs.message = "No size in object's spec"
return hs
end

return hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tests:
- healthStatus:
status: Healthy
inputPath: testdata/datacenter-ok.yaml
- healthStatus:
status: Degraded
message: "Size in spec and number of nodes in status differ"
inputPath: testdata/datacenter-missing-nodestatus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: cassandra.datastax.com/v1beta1
kind: CassandraDatacenter
spec:
size: 3
status:
nodeStatuses:
dti6001dbv-cluster-stage0-dti6001dbv-default-sts-0:
hostID: testID1
ip: 10.42.2.219
rack: default
dti6001dbv-cluster-stage0-dti6001dbv-default-sts-1:
hostID: testID2
ip: 10.42.5.37
rack: default
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: cassandra.datastax.com/v1beta1
kind: CassandraDatacenter
spec:
size: 3
status:
nodeStatuses:
dti6001dbv-cluster-stage0-dti6001dbv-default-sts-0:
hostID: testID1
ip: 10.42.2.219
rack: default
dti6001dbv-cluster-stage0-dti6001dbv-default-sts-1:
hostID: testID2
ip: 10.42.5.37
rack: default
dti6001dbv-cluster-stage0-dti6001dbv-default-sts-2:
hostID: testID3
ip: 10.42.4.198
rack: default

Loading