github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/cluster.x-k8s.io/MachinePool/health.lua (about) 1 -- Reference CRD can be found here: 2 -- https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/MachinePool/v1beta1@v1.8.1 3 4 function getStatusBasedOnPhase(obj, hs) 5 -- Phases can be found here: 6 -- https://github.com/kubernetes-sigs/cluster-api/blob/release-1.8/exp/api/v1beta1/machinepool_types.go#L139-L182 7 if obj.status ~= nil and obj.status.phase ~= nil then 8 hs.message = "MachinePool is " .. obj.status.phase 9 if obj.status.phase == "Running" or obj.status.phase == "Scaling" then 10 hs.status = "Healthy" 11 end 12 if obj.status.phase == "Failed" or obj.status.phase == "Unknown" then 13 hs.status = "Degraded" 14 end 15 end 16 return hs 17 end 18 19 function getConditionStatuses(obj, hs) 20 local extraInfo = "" 21 if obj.status ~= nil and obj.status.conditions ~= nil then 22 for i, condition in ipairs(obj.status.conditions) do 23 if condition.type ~= nil and condition.status == "False" then 24 if extraInfo ~= "" then 25 extraInfo = extraInfo .. ", " 26 end 27 extraInfo = extraInfo .. "Not " .. condition.type 28 if condition.reason ~= nil then 29 extraInfo = extraInfo .. " (" .. condition.reason .. ")" 30 end 31 end 32 end 33 end 34 if extraInfo ~= "" then 35 hs.message = hs.message .. ": " .. extraInfo 36 end 37 38 return hs 39 end 40 41 local hs = {} 42 hs.status = "Progressing" 43 hs.message = "" 44 45 getStatusBasedOnPhase(obj, hs) 46 getConditionStatuses(obj, hs) 47 48 return hs