github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/policy.open-cluster-management.io/ConfigurationPolicy/health.lua (about)

     1  hs = {}
     2  if obj.status == nil or obj.status.compliant == nil then
     3    hs.status = "Progressing"
     4    hs.message = "Waiting for the status to be reported"
     5    return hs
     6  end
     7  if obj.status.lastEvaluatedGeneration ~= obj.metadata.generation then
     8    hs.status = "Progressing"
     9    hs.message = "Waiting for the status to be updated"
    10    return hs  
    11  end
    12  if obj.status.compliant == "Compliant" then
    13    hs.status = "Healthy"
    14  else
    15    hs.status = "Degraded"
    16  end
    17  if obj.status.compliancyDetails ~= nil then
    18    messages = {}
    19    for i, compliancy in ipairs(obj.status.compliancyDetails) do
    20      if compliancy.conditions ~= nil then
    21        for i, condition in ipairs(compliancy.conditions) do
    22          if condition.message ~= nil and condition.type ~= nil then
    23            table.insert(messages, condition.type .. " - " .. condition.message)
    24          end
    25        end
    26      end
    27    end
    28    hs.message = table.concat(messages, "; ")
    29    return hs
    30  end
    31  hs.status = "Progressing"
    32  hs.message = "Waiting for compliance"
    33  return hs