2025-12-10 11:15:08 +00:00
|
|
|
local actions = {}
|
2026-03-08 13:47:43 +00:00
|
|
|
|
|
|
|
|
-- https://github.com/cloudnative-pg/cloudnative-pg/tree/main/internal/cmd/plugin/restart
|
2025-12-10 11:15:08 +00:00
|
|
|
actions["restart"] = {
|
|
|
|
|
["iconClass"] = "fa fa-fw fa-recycle",
|
|
|
|
|
["displayName"] = "Rollout restart Cluster"
|
|
|
|
|
}
|
2026-03-08 13:47:43 +00:00
|
|
|
|
|
|
|
|
-- https://github.com/cloudnative-pg/cloudnative-pg/tree/main/internal/cmd/plugin/reload
|
2025-12-10 11:15:08 +00:00
|
|
|
actions["reload"] = {
|
|
|
|
|
["iconClass"] = "fa fa-fw fa-rotate-right",
|
|
|
|
|
["displayName"] = "Reload all Configuration"
|
|
|
|
|
}
|
2026-03-08 13:47:43 +00:00
|
|
|
|
|
|
|
|
-- https://github.com/cloudnative-pg/cloudnative-pg/tree/main/internal/cmd/plugin/promote
|
2025-12-10 11:15:08 +00:00
|
|
|
actions["promote"] = {
|
|
|
|
|
["iconClass"] = "fa fa-fw fa-angles-up",
|
|
|
|
|
["displayName"] = "Promote Replica to Primary",
|
|
|
|
|
["disabled"] = (not obj.status.instancesStatus or not obj.status.instancesStatus.healthy or #obj.status.instancesStatus.healthy < 2),
|
|
|
|
|
["params"] = {
|
|
|
|
|
{
|
|
|
|
|
["name"] = "instance",
|
|
|
|
|
["default"] = "any"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 13:47:43 +00:00
|
|
|
-- Suspend reconciliation loop for a cluster
|
|
|
|
|
-- https://cloudnative-pg.io/docs/1.28/failure_modes/#disabling-reconciliation
|
2025-12-10 11:15:08 +00:00
|
|
|
local isSuspended = false
|
2026-03-08 13:47:43 +00:00
|
|
|
if obj.metadata and obj.metadata.annotations and obj.metadata.annotations["cnpg.io/reconciliationLoop"] == "disabled" then
|
2025-12-10 11:15:08 +00:00
|
|
|
isSuspended = true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Add suspend/resume actions based on current state
|
|
|
|
|
if isSuspended then
|
|
|
|
|
actions["resume"] = {
|
|
|
|
|
["iconClass"] = "fa fa-fw fa-play",
|
|
|
|
|
["displayName"] = "Resume Reconciliation"
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
actions["suspend"] = {
|
|
|
|
|
["iconClass"] = "fa fa-fw fa-pause",
|
|
|
|
|
["displayName"] = "Suspend Reconciliation"
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return actions
|