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/cri-o: add networkDir option #98086

Merged
merged 1 commit into from Sep 23, 2020
Merged

Conversation

saschagrunert
Copy link
Member

@saschagrunert saschagrunert commented Sep 16, 2020

Motivation for this change

The new option can be used to specify the network directory for CNI
plugin configurations.

Required by #96084

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • 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 nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@saschagrunert
Copy link
Member Author

cc @NixOS/podman

Copy link
Contributor

@zowoq zowoq left a comment

Choose a reason for hiding this comment

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

Sorry, I forgot about this.

Comment on lines 123 to 124
# Loopback should be always added independently if a custom network dir is used or not
environment.etc."cni/net.d/99-loopback.conf".source = copyFile "${pkgs.cri-o-unwrapped.src}/contrib/cni/99-loopback.conf";
Copy link
Member Author

Choose a reason for hiding this comment

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

Referencing to https://github.com/NixOS/nixpkgs/pull/98086/files#r493229379

Do you see any good way how we can make this point to /etc/cni/net.d by default and if cfg.networkDir != null to the target location?

I'd tried it with something like environment."${cfg.networkDir}/99-loopback.conf".source but this would not work at all.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could use networkDir as an internal option that is only set by other modules and expose a cni_default_network option to users to let them choose a non-default config in /etc/cni/net.d if networkDir isn't already set by another module?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, how would this look like? I now have the networkDir set in the config, but how to make the option only internally available?

Copy link
Contributor

Choose a reason for hiding this comment

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

This should work:

    networkDir = mkOption {
      type = types.nullOr types.path;
      default = null;
      description = "...";
      internal = true;
    };

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, thank you! 🙏 Changed as suggested.

The new option can be used to specify the network directory for CNI
plugin configurations.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
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

2 participants