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/vpp: init module #347797

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

nixos/vpp: init module #347797

wants to merge 2 commits into from

Conversation

romner-set
Copy link
Contributor

@romner-set romner-set commented Oct 10, 2024

Description of changes

Module & associated tests for #346281.

Includes an RFC42 settings option using a custom parser based on znc's and support for multiple instances similar to authelia's module. The test is pretty basic and verifies routing functionality between 2 hosts with VPP acting as the router.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation This PR adds or changes documentation 8.has: changelog 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` labels Oct 10, 2024
@romner-set romner-set marked this pull request as draft October 10, 2024 20:26
@romner-set romner-set force-pushed the vpp-service branch 2 times, most recently from 3cad8ad to e0dc519 Compare October 10, 2024 20:40
@github-actions github-actions bot removed 8.has: documentation This PR adds or changes documentation 8.has: changelog labels Oct 10, 2024
@romner-set romner-set mentioned this pull request Oct 10, 2024
13 tasks
@romner-set romner-set force-pushed the vpp-service branch 2 times, most recently from 8a3d670 to 35dd879 Compare October 10, 2024 23:10
@romner-set romner-set marked this pull request as ready for review October 10, 2024 23:54
@romner-set romner-set marked this pull request as draft October 10, 2024 23:55
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Oct 11, 2024
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/4668

@romner-set romner-set mentioned this pull request Oct 11, 2024
13 tasks
@h7x4 h7x4 added 8.has: module (new) This PR adds a module in `nixos/` 8.has: tests This PR has tests labels Oct 11, 2024
@romner-set romner-set force-pushed the vpp-service branch 4 times, most recently from ef5b42f to c93df1d Compare October 12, 2024 22:17
@github-actions github-actions bot removed the 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` label Oct 12, 2024
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/4895

@romner-set romner-set force-pushed the vpp-service branch 2 times, most recently from 9da97c6 to 047ca1c Compare November 29, 2024 18:53
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 30, 2024
@romner-set romner-set removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 30, 2024
Copy link
Contributor

@TheRealGramdalf TheRealGramdalf left a comment

Choose a reason for hiding this comment

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

Some initial food for thought. I'll have to revisit this on my laptop so I can make some further suggestions, there's some stuff I need to take a closer look at.

nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved

# make sure VPP initialized correctly
# the sleep is necessary since startupConfig executes *after* the service starts
router.sleep(2)
Copy link
Member

Choose a reason for hiding this comment

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

This could easily fail on hydra. Is it not enough to wait for the socket above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

VPP reads startupConfig right after actually starting up, the 4 commands should execute near-instantaneously so I don't think it'll be an issue with 2s. It does feel like a bit of a hack, but I can't come up with any better solution.

nixos/tests/vpp.nix Outdated Show resolved Hide resolved
nixos/tests/vpp.nix Outdated Show resolved Hide resolved
nixos/tests/vpp.nix Outdated Show resolved Hide resolved
nixos/tests/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Show resolved Hide resolved
gid = config.services.vpp.instances.\${name}.group;
};
'';
example = lib.literalExpression ''
Copy link
Member

Choose a reason for hiding this comment

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

We should try to condense this, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed a bunch of unnecessary options, is this short enough? I'd prefer keeping the comment in there since I think it's pretty useful.

nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved
Comment on lines +446 to +424
autoSetup = mkOption {
default = false;
example = true;
description = ''
Whether to automatically setup hugepages for use with FD.io's Vector Packet Processor.

If any programs other than VPP use hugepages or you want to use 1GB hugepages, it's recommended
to keep this `false` and set them up manually using {option}`boot.kernel.sysctl` or {option}`boot.kernelParams`.
'';
};
Copy link
Member

Choose a reason for hiding this comment

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

For example redis sets this up. Would this work together to make things easy for end users?

Copy link
Contributor Author

@romner-set romner-set Dec 9, 2024

Choose a reason for hiding this comment

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

That I don't know, depends on how exactly VPP and redis use explicit hugepages. The autosetup is only here since VPP requires hugepages to even start up properly, and using it is significantly easier than having to add all the sysctls for a trivial deployment. More complicated setups like having 2 services that use hugepages are out of scope for this option & indicated as such in the description.

@romner-set
Copy link
Contributor Author

@TheRealGramdalf @SuperSandro2000 Thanks for the reviews! Integrated most of the suggestions, commented on the rest.

@TheRealGramdalf
Copy link
Contributor

No problem! I still have some thoughts but I'm busy for a while, I'll have to take a look at the end of today or possibly tomorrow.

@romner-set romner-set removed the needs_reviewer (old Marvin label, do not use) label Dec 11, 2024
Copy link
Contributor

@TheRealGramdalf TheRealGramdalf left a comment

Choose a reason for hiding this comment

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

Mostly some more nitpicks about with, I think the descriptions are much more concise now. I would be content to leave the descriptions as is for now and see how they look rendered on search/in the manual, making further adjustments if necessary - I'm not sure how or if you could render those locally for testing.

I'm mostly trying to make things as clean as possible, since having readable code makes it much easier to debug and wrap your head around, since most repeated data is redundant - if I have an option with type = types.str, the types. doesn't convey any more valuable information. And since it's using inherit, it's still easy enough to tell where str came from since it's defined explicitly at the top of the file.

nixos/tests/vpp.nix Show resolved Hide resolved
nixos/tests/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Show resolved Hide resolved
nixos/modules/services/networking/vpp.nix Show resolved Hide resolved
pkgs/by-name/vp/vpp/package.nix Show resolved Hide resolved
@TheRealGramdalf
Copy link
Contributor

Sorry it took me a while to get to this review, I've been fairly busy recently. Given that, don't feel the need to wait for further review/hold up this PR on my account.

@romner-set romner-set force-pushed the vpp-service branch 2 times, most recently from 115d59b to 1c707ec Compare December 15, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog 8.has: documentation This PR adds or changes documentation 8.has: module (new) This PR adds a module in `nixos/` 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: tests This PR has tests 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants