networking/netns: rename default netns to init netns
This commit is contained in:
parent
886f8c4031
commit
0c28d393fa
|
@ -7,7 +7,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
allNetns = config.networking.netns;
|
allNetns = config.networking.netns;
|
||||||
nonDefaultNetns = filterAttrs (name: _cfg: name != "default") allNetns;
|
nonDefaultNetns = filterAttrs (name: _cfg: name != "init") allNetns;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.networking.netns = mkOption {
|
options.networking.netns = mkOption {
|
||||||
|
@ -18,7 +18,7 @@ in
|
||||||
options = {
|
options = {
|
||||||
netnsPath = mkOption {
|
netnsPath = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = if name == "default" then "/proc/1/ns/net" else "/run/netns/${name}";
|
default = if name == "init" then "/proc/1/ns/net" else "/run/netns/${name}";
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
description = ''
|
description = ''
|
||||||
Path to the network namespace.
|
Path to the network namespace.
|
||||||
|
@ -62,7 +62,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
networking.netns.default = { };
|
networking.netns.init = { };
|
||||||
|
|
||||||
systemd.services = mapAttrs' (
|
systemd.services = mapAttrs' (
|
||||||
name: cfg:
|
name: cfg:
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
allNetns = config.networking.netns;
|
allNetns = config.networking.netns;
|
||||||
nonDefaultNetns = filterAttrs (name: _cfg: name != "default") allNetns;
|
nonDefaultNetns = filterAttrs (name: _cfg: name != "init") allNetns;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.networking.netns = mkOption {
|
options.networking.netns = mkOption {
|
||||||
|
@ -18,7 +18,7 @@ in
|
||||||
options = {
|
options = {
|
||||||
mntnsPath = mkOption {
|
mntnsPath = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = if name == "default" then "/proc/1/ns/mnt" else "/run/${name}/mntns/${name}";
|
default = if name == "init" then "/proc/1/ns/mnt" else "/run/${name}/mntns/${name}";
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
description = ''
|
description = ''
|
||||||
Path to the auxiliary mount namespace.
|
Path to the auxiliary mount namespace.
|
||||||
|
@ -40,7 +40,7 @@ in
|
||||||
hostPath = mkOption {
|
hostPath = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = ''
|
description = ''
|
||||||
Location of the path to be mounted in the default mount namespace.
|
Location of the path to be mounted in the init mount namespace.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
isReadOnly = mkOption {
|
isReadOnly = mkOption {
|
||||||
|
@ -62,7 +62,7 @@ in
|
||||||
serviceConfig = mkOption {
|
serviceConfig = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
default =
|
default =
|
||||||
if name == "default" then
|
if name == "init" then
|
||||||
{ }
|
{ }
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
allNetns = config.networking.netns;
|
allNetns = config.networking.netns;
|
||||||
nftablesEnabledNetns = filterAttrs (name: cfg: name != "default" && cfg.nftables.enable) allNetns;
|
nftablesEnabledNetns = filterAttrs (name: cfg: name != "init" && cfg.nftables.enable) allNetns;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.networking.netns = mkOption {
|
options.networking.netns = mkOption {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
allNetns = config.networking.netns;
|
allNetns = config.networking.netns;
|
||||||
dnsIsolatedNetns = filterAttrs (name: cfg: name != "default" && cfg.enableDNSIsolation) allNetns;
|
dnsIsolatedNetns = filterAttrs (name: cfg: name != "init" && cfg.enableDNSIsolation) allNetns;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.networking.netns = mkOption {
|
options.networking.netns = mkOption {
|
||||||
|
|
|
@ -31,7 +31,7 @@ in
|
||||||
};
|
};
|
||||||
netns = mkOption {
|
netns = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "default";
|
default = "init";
|
||||||
description = ''
|
description = ''
|
||||||
The network namespace to forward ports from.
|
The network namespace to forward ports from.
|
||||||
'';
|
'';
|
||||||
|
@ -78,7 +78,7 @@ in
|
||||||
;
|
;
|
||||||
netnsPath = config.networking.netns.${netns}.netnsPath;
|
netnsPath = config.networking.netns.${netns}.netnsPath;
|
||||||
serviceDeps = map (ns: "netns-${ns}.service") (
|
serviceDeps = map (ns: "netns-${ns}.service") (
|
||||||
filter (ns: ns != "default") [
|
filter (ns: ns != "init") [
|
||||||
name
|
name
|
||||||
netns
|
netns
|
||||||
]
|
]
|
||||||
|
|
|
@ -35,7 +35,7 @@ in
|
||||||
|
|
||||||
networking.netns.enthalpy.forwardPorts = singleton {
|
networking.netns.enthalpy.forwardPorts = singleton {
|
||||||
protocol = "tcp";
|
protocol = "tcp";
|
||||||
netns = "default";
|
netns = "init";
|
||||||
source = "[::1]:${toString config.networking.ports.enthalpy-gost}";
|
source = "[::1]:${toString config.networking.ports.enthalpy-gost}";
|
||||||
target = "[::1]:${toString config.networking.ports.socks}";
|
target = "[::1]:${toString config.networking.ports.socks}";
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
networking.netns.enthalpy.forwardPorts = lib.optionals config.services.openssh.enable [
|
networking.netns.enthalpy.forwardPorts = lib.optionals config.services.openssh.enable [
|
||||||
{
|
{
|
||||||
protocol = "tcp";
|
protocol = "tcp";
|
||||||
netns = "default";
|
netns = "init";
|
||||||
source = "[::]:${toString config.networking.ports.ssh}";
|
source = "[::]:${toString config.networking.ports.ssh}";
|
||||||
target = "[::]:${toString config.networking.ports.ssh}";
|
target = "[::]:${toString config.networking.ports.ssh}";
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ in
|
||||||
wantedBy = [ "netns-enthalpy.service" ];
|
wantedBy = [ "netns-enthalpy.service" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.netns.default.forwardPorts = lib.singleton {
|
networking.netns.init.forwardPorts = lib.singleton {
|
||||||
protocol = "tcp";
|
protocol = "tcp";
|
||||||
netns = "enthalpy";
|
netns = "enthalpy";
|
||||||
source = "127.0.0.1:${toString config.networking.ports.prometheus-ping-exporter}";
|
source = "127.0.0.1:${toString config.networking.ports.prometheus-ping-exporter}";
|
||||||
|
|
Loading…
Reference in a new issue