github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/controlplane.cluster.x-k8s.io/AWSManagedControlPlane/health.lua (about)

     1  local health_status = {
     2      status = "Progressing",
     3      message = "Provisioning..."
     4  }
     5  
     6  -- If .status is nil or doesn't have conditions, then the control plane is not ready
     7  if obj.status == nil or obj.status.conditions == nil then
     8      return health_status
     9  end
    10  
    11  -- Accumulator for the error messages (could be multiple conditions in error state)
    12  err_msg = ""
    13  
    14  -- Iterate over the conditions to determine the health status
    15  for i, condition in ipairs(obj.status.conditions) do
    16      -- Check if the Ready condition is True, then the control plane is ready
    17      if condition.type == "Ready" and condition.status == "True" then
    18          health_status.status = "Healthy"
    19          health_status.message = "Control plane is ready"
    20          return health_status
    21      end
    22  
    23      -- If we have a condition that is False and has an Error severity, then the control plane is in a degraded state
    24      if condition.status == "False" and condition.severity == "Error" then
    25          health_status.status = "Degraded"
    26          err_msg = err_msg .. condition.message .. " "
    27      end
    28  end
    29  
    30  -- If we have any error conditions, then the control plane is in a degraded state
    31  if health_status.status == "Degraded" then
    32      health_status.message = err_msg
    33      return health_status
    34  end
    35  
    36  -- If .status.ready is False, then the control plane is not ready
    37  if obj.status.ready == false then
    38      health_status.status = "Progressing"
    39      health_status.message = "Control plane is not ready (.status.ready is false)"
    40      return health_status
    41  end
    42  
    43  -- If we reach this point, then the control plane is not ready and we don't have any error conditions
    44  health_status.status = "Progressing"
    45  health_status.message = "Control plane is not ready"
    46  
    47  return health_status