Skip to content
Merged
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
Expand Up @@ -20,49 +20,36 @@ if #obj.status.conditions == 0 then
end

local isEstablished
local isTerminating
local namesNotAccepted
local hasViolations
local conditionMsg = ""

for _, condition in pairs(obj.status.conditions) do

-- Check if CRD is terminating
if condition.type == "Terminating" and condition.status == "True" then
isTerminating = true
conditionMsg = condition.message
hs.status = "Progressing"
hs.message = "CRD is terminating: " .. condition.message
return hs
end

-- Check if K8s has accepted names for this CRD
if condition.type == "NamesAccepted" and condition.status == "False" then
namesNotAccepted = true
conditionMsg = condition.message
hs.status = "Degraded"
hs.message = "CRD names have not been accepted: " .. condition.message
return hs
end

-- Checking if CRD has violations
if condition.type == "NonStructuralSchema" and condition.status == "True" then
hs.status = "Degraded"
hs.message = "Schema violations found: " .. condition.message
return hs
end

-- Checking if CRD is established
if condition.type == "Established" and condition.status == "True" then
isEstablished = true
conditionMsg = condition.message
end

-- Checking if CRD has violations
if condition.type == "NonStructuralSchema" and condition.status == "True" then
hasViolations = true
conditionMsg = condition.message
end

end

if isTerminating then
hs.status = "Progressing"
hs.message = "CRD is terminating: " .. conditionMsg
return hs
end

if namesNotAccepted then
hs.status = "Degraded"
hs.message = "CRD names have not been accepted: " .. conditionMsg
return hs
end

if not isEstablished then
Expand All @@ -71,12 +58,6 @@ if not isEstablished then
return hs
end

if hasViolations then
hs.status = "Degraded"
hs.message = "Schema violations found: " .. conditionMsg
return hs
end

hs.status = "Healthy"
hs.message = "CRD is healthy"
return hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ status:
reason: NoConflicts
status: 'True'
type: NamesAccepted
- lastTransitionTime: '2024-05-19T23:35:28Z'
message: the initial names have been accepted
reason: InitialNamesAccepted
status: 'True'
type: Established
- lastTransitionTime: '2024-10-26T19:44:57Z'
message: 'spec.preserveUnknownFields: Invalid value: true: must be false'
reason: Violations
status: 'True'
type: NonStructuralSchema
- lastTransitionTime: '2024-05-19T23:35:28Z'
message: the initial names have been accepted
reason: InitialNamesAccepted
status: 'True'
type: Established
storedVersions:
- v1alpha1
Loading