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

container backend: allow setting {local,host}Address #1164

Closed

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Jun 13, 2019

With that patch it's possible to deploy containers and assign those to
different IPs rather than the next available /24 subnet from 10.233.0.0/16.
This patch depends on #60029[1] and can only be used with NixOS 19.09
(a.k.a nixos-unstable at the time of writing).

The behavior can be tested using a simple deployment like this:

{
  container = { resources, ... }:
    { deployment.targetEnv = "container";
      deployment.container.host = resources.machines.horst;
      deployment.container.localAddress = "10.235.1.2";
      deployment.container.hostAddress = "10.235.1.1";
    };

  # the feature is optional, by default the next free addresses
  # from 10.233.0.0/16 will be used here.
  container2 = { resources, ... }:
    { deployment.targetEnv = "container";
      deployment.container.host = resources.machines.horst;
    };

  horst = { ... }:
    { deployment.targetEnv = "libvirtd";
    };
}

[1] NixOS/nixpkgs#60029

With that patch it's possible to deploy containers and assign those to
different IPs rather than the next available /24 subnet from `10.233.0.0/16`.
This patch depends on #60029[1] and can only be used with NixOS 19.09
(a.k.a nixos-unstable at the time of writing).

The behavior can be tested using a simple deployment like this:

``` nix
{
  container = { resources, ... }:
    { deployment.targetEnv = "container";
      deployment.container.host = resources.machines.horst;
      deployment.container.localAddress = "10.235.1.2";
      deployment.container.hostAddress = "10.235.1.1";
    };

  # the feature is optional, by default the next free addresses
  # from 10.233.0.0/16 will be used here.
  container2 = { resources, ... }:
    { deployment.targetEnv = "container";
      deployment.container.host = resources.machines.horst;
    };

  horst = { ... }:
    { deployment.targetEnv = "libvirtd";
    };
}
```

[1] NixOS/nixpkgs#60029
@Ma27 Ma27 force-pushed the set-host-and-local-address-for-container branch from 0fec492 to d78bce7 Compare June 14, 2019 17:18
@Ma27
Copy link
Member Author

Ma27 commented Dec 22, 2019

Closing for now. The container backend isn't part of nixops anymore and I don't intend to spend more time on this (the mid-term plan is to implement an improved backend for nixos-containers with networkd in nixpkgs).

In case anyone else is interested in that change - feel free to pick it up (or to ping me for questions if necessary).

@Ma27 Ma27 closed this Dec 22, 2019
@Ma27 Ma27 deleted the set-host-and-local-address-for-container branch December 22, 2019 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants