github.com/argoproj/argo-cd/v2@v2.10.9/resource_customizations/apps.kruise.io/AdvancedCronJob/health.lua (about) 1 hs = { status = "Progressing", message = "AdvancedCronJobs has active jobs" } 2 -- Extract lastScheduleTime and convert to time objects 3 lastScheduleTime = nil 4 5 if obj.status.lastScheduleTime ~= nil then 6 local year, month, day, hour, min, sec = string.match(obj.status.lastScheduleTime, "(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+)Z") 7 lastScheduleTime = os.time({year=year, month=month, day=day, hour=hour, min=min, sec=sec}) 8 end 9 10 11 if lastScheduleTime == nil and obj.spec.paused == true then 12 hs.status = "Suspended" 13 hs.message = "AdvancedCronJob is Paused" 14 return hs 15 end 16 17 -- AdvancedCronJobs are progressing if they have any object in the "active" state 18 if obj.status.active ~= nil and #obj.status.active > 0 then 19 hs.status = "Progressing" 20 hs.message = "AdvancedCronJobs has active jobs" 21 return hs 22 end 23 -- AdvancedCronJobs are Degraded if they don't have lastScheduleTime 24 if lastScheduleTime == nil then 25 hs.status = "Degraded" 26 hs.message = "AdvancedCronJobs has not run successfully" 27 return hs 28 end 29 -- AdvancedCronJobs are healthy if they have lastScheduleTime 30 if lastScheduleTime ~= nil then 31 hs.status = "Healthy" 32 hs.message = "AdvancedCronJobs has run successfully" 33 return hs 34 end 35 36 return hs