Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/keepalived: Implemented vrrp-instance track scripts and track interfaces #39671

Merged
merged 1 commit into from May 9, 2018

Conversation

johanot
Copy link
Contributor

@johanot johanot commented Apr 29, 2018

Motivation for this change

It would be nice to be able to explicitly declare keepalived virtual IP healthcheck scripts and interfaces, in order for failover to make sense.

Furthermore; tracking scripts in particular, cannot be included with keepalived.extraConfig, because VRRP scripts must be declared above script usage in keepalived.conf , otherwise keepalived will complain with something like:

Keepalived_vrrp[4265]: check_script no match, ignoring...

See: http://www.askmrisp.com/2017/04/17/solved-keepalived-not-running-track_script/ for details.

Things done
  • Tested full backward-compatibility in that keepalived.conf is not changed if no track scripts or track interfaces are added to the config, and that all new top-level options have default values.
  • Tested track scripts and track interfaces on NixOS 17.09 + 18.03, both with keepalived v1.3.6
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions - Ubuntu 17.10
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@srhb
Copy link
Contributor

srhb commented Apr 29, 2018

@mbrgm care to review?

Copy link
Member

@mbrgm mbrgm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not using keepalived on NixOS right now, so I only did a code review without actual testing. See my comments for some minor points, otherwise LGTM and thank you! :-)

type = types.bool;
default = false;
description = ''
Don't run scripts configured to be run as root if any part of the path.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be "Don't run scripts configured to be run as root if any part of the path is writable by a non-root user."

weight = mkOption {
type = int;
default = 0;
description = "Following a failure, adjust the priority with this weight.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest "with" -> "by".

description = "Required number of failures for KO transition.";
};

execUser = mkOption {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I too think that execUser would be a better name for this parameter, but the keepalived.conf file uses user. I wonder if it'd be better to stick as close to the original parameters as possible... would be happy to have your opinion on that.

description = "Name of user to run the script under.";
};

execGroup = mkOption {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change execUser -> user, then this one should be called group.

…rfaces.

Tracking scripts in particular, cannot be included in extraOpts, because script declaration has to be above script usage in keepalived.conf.
Changes are fully backward compatible.
@johanot johanot force-pushed the keepalived-vrrpInstanceTracking branch from d0f4ef8 to 41d4bd2 Compare May 8, 2018 09:27
@johanot
Copy link
Contributor Author

johanot commented May 8, 2018

@mbrgm All of your suggestions have been incorporated in latest squash. :-)

@srhb
Copy link
Contributor

srhb commented May 8, 2018

@GrahamcOfBorg eval

Copy link
Member

@mbrgm mbrgm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@srhb srhb merged commit 3befef8 into NixOS:master May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants