github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/cloudfront.aws.crossplane.io/Distribution/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  
     8      for i, condition in ipairs(obj.status.conditions) do
     9  
    10        if condition.type == "Ready" then
    11          ready = condition.status == "True"
    12          ready_message = condition.reason
    13        elseif condition.type == "Synced" then
    14          synced = condition.status == "True"
    15          if condition.reason == "ReconcileError" then
    16            synced_message = condition.message
    17          elseif condition.reason == "ReconcilePaused" then
    18            suspended = true
    19            suspended_message = condition.reason
    20          end
    21        end
    22      end
    23      if ready and synced then
    24        hs.status = "Healthy"
    25        hs.message = ready_message
    26      elseif synced == false and suspended == true then
    27        hs.status = "Suspended"
    28        hs.message = suspended_message
    29      elseif ready == false and synced == true and suspended == false then
    30        hs.status = "Progressing"
    31        hs.message = "Waiting for distribution to be available"
    32      else
    33        hs.status = "Degraded"
    34        hs.message = synced_message
    35      end
    36      return hs
    37    end
    38  end
    39  
    40  hs.status = "Progressing"
    41  hs.message = "Waiting for distribution to be created"
    42  return hs