A keepalived FIFO notification handler
Go to file
Paul Stemmet dc343acf44
systemd: add kdnotify.service, kdnotify.socket
As we expect this project to be mostly run as a system service, provide
out of the box configuration files for systemd.

Notably, we add a .socket file allowing systemd to lazily start kdnotify
when a notify event is received on its socket.

We also hardlink the socket out into the /run/ directory, such that
keepalived does not need to peak inside kdnotify runtime dir.

We also link the lifecycle of kdnotify to keepalived, as once it has
been stopped it is unlikely we'll receive new messages.
2022-12-10 19:01:35 +00:00
buildinfo buildinfo: compile time variables 2022-12-09 18:06:00 +00:00
cmd cmd: add CLI 2022-12-09 18:06:01 +00:00
config config: tests for WatchConfig 2022-12-09 18:05:57 +00:00
doc doc: add example config file for kdnotify watch 2022-12-10 08:25:17 +00:00
fifo fifo/mock: MockEvents 2022-12-09 18:05:57 +00:00
handler handler: tests for exec.Cmd and templating 2022-12-09 18:06:00 +00:00
schema/notify schema/notify: add tests for Message parsing 2022-12-10 17:01:44 +00:00
systemd systemd: add kdnotify.service, kdnotify.socket 2022-12-10 19:01:35 +00:00
tool tool/fmtck: gofmt err exit wrapper 2022-12-09 18:07:23 +00:00
watcher watcher: add tests for EventWatcher 2022-12-09 18:05:59 +00:00
.gitignore systemd: add kdnotify.service, kdnotify.socket 2022-12-10 19:01:35 +00:00
LICENSE repo: Genesis 2022-11-24 12:43:17 +00:00
Makefile Makefile: tidy remaining LDFLAGS refs 2022-12-09 19:22:19 +00:00
README.md doc: update README with Usage and Development sections 2022-12-10 08:50:00 +00:00
go.mod go.mod: add shellwords + tidy 2022-12-09 18:05:54 +00:00
go.sum go.mod: add shellwords + tidy 2022-12-09 18:05:54 +00:00
main.go main: wire up CLI 2022-12-09 18:06:01 +00:00

README.md

kdnotify - A keepalived FIFO handler

This is a utility that is primary focused on integrating with Keepalived's vrrp_notify_fifo_script and vrrp_notify_fifo configuration options.

It provides a more structured approach than Keepalived's suggested shell script, allowing users to specify rules for processing events, rather than requiring tedious and error prone handling of parsing and processing each event individually.

Usage

The primary usage of this binary requires two things:

  1. A configuration file in /etc/kdnotify/config.yaml
  2. Enabling Keepalived to use this project for notifications via:
# Or in any other block where vrrp_notify_fifo_script is legal
global {
  vrrp_notify_fifo_script "/bin/kdnotify watch" [username [groupname]]
}

Development

You can run make help in the repo root to get a list of available targets, but these are the most useful:

Target Description
build Build the binary to build/kdnotify
check Run project checks and lints
install Install project to the provided Prefix= (defaults to /bin)
clean Cleans build directory

Make sure you run check before merging to master.