github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/datadoghq.com/DatadogMetric/health.lua (about) 1 -- Reference CRD can be found here: 2 -- https://github.com/DataDog/helm-charts/blob/main/charts/datadog-crds/templates/datadoghq.com_datadogmetrics_v1.yaml 3 4 hs = {} 5 if obj.status ~= nil and obj.status.conditions ~= nil then 6 for i, condition in ipairs(obj.status.conditions) do 7 -- Check for the "Error: True" condition first 8 if condition.type == "Error" and condition.status == "True" then 9 hs.status = "Degraded" 10 local reason = condition.reason or "" 11 local message = condition.message or "DatadogMetric reported an error" 12 if reason ~= "" then 13 hs.message = reason .. ": " .. message 14 else 15 hs.message = message 16 end 17 return hs 18 end 19 end 20 for i, condition in ipairs(obj.status.conditions) do 21 -- Check for the "Valid: False" condition 22 if condition.type == "Valid" and condition.status == "False" then 23 hs.status = "Degraded" 24 hs.message = condition.message or "DatadogMetric is not valid" 25 return hs 26 end 27 end 28 end 29 -- If no "Degraded" conditions are found, default to Healthy 30 hs.status = "Healthy" 31 hs.message = "DatadogMetric is healthy" 32 return hs