github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/capabilities.3scale.net/Tenant/health.lua (about) 1 local hs = {} 2 3 if obj ~= nil and obj.status ~= nil then 4 local tenant_id = obj.status.tenantId 5 local admin_id = obj.status.adminId 6 local has_tenant_id = (tenant_id ~= nil and type(tenant_id) == "number" and tenant_id > 0) 7 local has_admin_id = (admin_id ~= nil and type(admin_id) == "number" and admin_id > 0) 8 9 local is_ready = false 10 if obj.status.conditions ~= nil then 11 for _, condition in ipairs(obj.status.conditions) do 12 if condition.type == "Ready" and condition.status == "True" then 13 is_ready = true 14 break 15 end 16 end 17 end 18 19 if is_ready and has_tenant_id and has_admin_id then 20 hs.status = "Healthy" 21 hs.message = "3scale Tenant is ready" 22 return hs 23 end 24 25 if obj.status.conditions ~= nil then 26 for _, condition in ipairs(obj.status.conditions) do 27 if condition.type == "Ready" and condition.status ~= "True" then 28 hs.status = "Degraded" 29 hs.message = condition.message or "3scale Tenant is degraded" 30 return hs 31 end 32 end 33 end 34 end 35 36 hs.status = "Progressing" 37 hs.message = "Waiting for 3scale Tenant status..." 38 return hs