github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/iam.aws.crossplane.io/RolePolicyAttachment/health.lua (about)

     1  local hs = {}
     2  if obj.status ~= nil then
     3    if obj.status.conditions ~= nil then
     4      local ready = false
     5      local synced = false
     6      local suspended = false
     7      for i, condition in ipairs(obj.status.conditions) do
     8  
     9        if condition.type == "Ready" then
    10          ready = condition.status == "True"
    11          ready_message = condition.reason
    12        elseif condition.type == "Synced" then
    13          synced = condition.status == "True"
    14          if condition.reason == "ReconcileError" then
    15            synced_message = condition.message
    16          elseif condition.reason == "ReconcilePaused" then
    17            suspended = true
    18            suspended_message = condition.reason
    19          end
    20        end
    21      end
    22      if ready and synced then
    23        hs.status = "Healthy"
    24        hs.message = ready_message
    25      elseif synced == false and suspended == true then
    26        hs.status = "Suspended"
    27        hs.message = suspended_message
    28      elseif ready == false and synced == true and suspended == false then
    29        hs.status = "Progressing"
    30        hs.message = "Waiting for RolePolicyAttachment to be available"
    31      else
    32        hs.status = "Degraded"
    33        hs.message = synced_message
    34      end
    35      return hs
    36    end
    37  end
    38  
    39  hs.status = "Progressing"
    40  hs.message = "Waiting for RolePolicyAttachment to be created"
    41  return hs