Initial managed-container HA resource agent baseline
This commit is contained in:
Executable
+64
@@ -0,0 +1,64 @@
|
||||
# Engine API 1. Selection is an allowlist of packaged implementations, never a
|
||||
# filename, shell fragment or a plugin downloaded from cluster configuration.
|
||||
mc_engine_load()
|
||||
{
|
||||
local plugin hook
|
||||
if [ "${OCF_RESKEY_application:-postgresql}" != postgresql ] ||
|
||||
[ "${OCF_RESKEY_container_runtime:-podman}" != podman ] ||
|
||||
[ "${OCF_RESKEY_lifecycle_manager:-systemd}" != systemd ]; then
|
||||
ocf_exit_reason "Supported plugin combination: application=postgresql container_runtime=podman lifecycle_manager=systemd"
|
||||
return "${OCF_ERR_CONFIGURED}"
|
||||
fi
|
||||
|
||||
unset MC_RUNTIME_API MC_LIFECYCLE_API MC_APPLICATION_API
|
||||
for plugin in runtimes/podman lifecycles/systemd applications/postgresql/plugin; do
|
||||
if ! . "${MC_MODULE_DIR}/${plugin}.sh"; then
|
||||
ocf_exit_reason "Unable to load resource-agent module ${MC_MODULE_DIR}/${plugin}.sh"
|
||||
return "${OCF_ERR_CONFIGURED}"
|
||||
fi
|
||||
done
|
||||
if [ "${MC_RUNTIME_API:-}" != 1 ] || [ "${MC_LIFECYCLE_API:-}" != 1 ] ||
|
||||
[ "${MC_APPLICATION_API:-}" != 1 ]; then
|
||||
ocf_exit_reason "Incompatible plugin interface; API 1 required"
|
||||
return "${OCF_ERR_CONFIGURED}"
|
||||
fi
|
||||
for hook in mc_runtime_exec mc_runtime_exec_bounded mc_runtime_inspect mc_runtime_info \
|
||||
mc_lifecycle_start mc_lifecycle_stop mc_lifecycle_running mc_lifecycle_cat \
|
||||
mc_application_monitor mc_application_standby_score mc_application_validate \
|
||||
mc_application_metadata mc_application_notify mc_application_action; do
|
||||
if ! declare -F "${hook}" >/dev/null; then
|
||||
ocf_exit_reason "Required plugin hook is missing: ${hook}"
|
||||
return "${OCF_ERR_CONFIGURED}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
mc_engine_metadata()
|
||||
{
|
||||
# Metadata discovery works without configured resource instance attributes.
|
||||
# Capture the plugin's status before transforming XML; avoid a pipeline
|
||||
# masking a metadata failure. No runtime/service/cluster access is required.
|
||||
local metadata
|
||||
metadata="$(mc_application_metadata)" || return "$?"
|
||||
printf '%s\n' "${metadata}" | sed '/<\/parameters>/i\
|
||||
<parameter name="application" unique="0" required="0">\
|
||||
<longdesc lang="en">Packaged application plugin. Only postgresql is supported.</longdesc>\
|
||||
<shortdesc lang="en">Application plugin</shortdesc>\
|
||||
<content type="string" default="postgresql"/>\
|
||||
</parameter>\
|
||||
<parameter name="container_runtime" unique="0" required="0">\
|
||||
<longdesc lang="en">Packaged runtime adapter. Only podman is supported.</longdesc>\
|
||||
<shortdesc lang="en">Container runtime</shortdesc>\
|
||||
<content type="string" default="podman"/>\
|
||||
</parameter>\
|
||||
<parameter name="lifecycle_manager" unique="0" required="0">\
|
||||
<longdesc lang="en">Container lifecycle owner. Only systemd with the existing user service is supported.</longdesc>\
|
||||
<shortdesc lang="en">Lifecycle manager</shortdesc>\
|
||||
<content type="string" default="systemd"/>\
|
||||
</parameter>\
|
||||
<parameter name="proxy_failure_grace_seconds" unique="0" required="0">\
|
||||
<longdesc lang="en">Bounded control-plane grace after managed-containerd becomes unavailable. A recent healthy daemon-authoritative role may be temporarily preserved. Unpromoted instances have promotion eligibility withdrawn during the grace. Default 15 seconds; 0 disables the grace.</longdesc>\
|
||||
<shortdesc lang="en">managed-containerd failure grace</shortdesc>\
|
||||
<content type="integer" default="15"/>\
|
||||
</parameter>'
|
||||
}
|
||||
Reference in New Issue
Block a user