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

Update README #9

Merged
merged 3 commits into from
Nov 20, 2023
Merged

Update README #9

merged 3 commits into from
Nov 20, 2023

Conversation

atanasdinov
Copy link
Collaborator

@atanasdinov atanasdinov commented Nov 10, 2023

Closes #4

Signed-off-by: Atanas Dinov <[email protected]>
@atanasdinov atanasdinov marked this pull request as ready for review November 10, 2023 18:16
Copy link

@rdoxenham rdoxenham left a comment

Choose a reason for hiding this comment

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

Great work on this @atanasdinov! Just a few minor things that I ran into with a few suggestions. Cheers!

README.md Outdated Show resolved Hide resolved
README.md Outdated
```shell
$ git clone https://github.com/suse-edge/nm-configurator.git
$ cd nm-configurator
$ cargo build --release # optionally specify --target flag if cross compiling

Choose a reason for hiding this comment

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

Minor, but I can't get this code to compile at present.

Copy link
Collaborator Author

@atanasdinov atanasdinov Nov 13, 2023

Choose a reason for hiding this comment

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

It will not compile on macOS. There are differences between libc on Mac and on Linux but I didn't dive deeper into it since I didn't think we'd perform tests on macOS. Should we look further into this?

Choose a reason for hiding this comment

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

Or maybe just put a disclaimer that this tool is intended to be executed on linux only.

README.md Outdated
Each file contains the desired state for a single network interface (e.g. `eth0`).
Configurations for all interfaces for all known hosts must be generated using `nmstate`.
```shell
$ curl -o nmc -L https://github.com/suse-edge/nm-configurator/releases/latest/download/nmc-x86_64

Choose a reason for hiding this comment

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

The latest flag here is not currently functioning. Also, do you think we should create an aarch64-apple-darwin release for local development and testing? Reason being, the aarch64 binary that we ship in the releases is seemingly only functioning on Linux?

rdo@tiw nm-configurator % uname -a
Darwin tiw.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:23 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6020 arm64
rdo@tiw nm-configurator % file nmc
nmc: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=7BwBJnNJlJRnUbl2thQQ/28-rOLaTmUNHHZPy7ci2/Xvgxmzw6_9BSBXz0oYxI/u3jZiVKC7Vy47aHuefd5, with debug_info, not stripped
rdo@tiw nm-configurator % ./nmc
zsh: exec format error: ./nmc

Whereas it works just fine on Linux:

rdo@tw-aarch64-build:~> uname -a
Linux tw-aarch64-build.rdo.wales 6.5.6-1-default #1 SMP PREEMPT_DYNAMIC Fri Oct  6 11:20:48 UTC 2023 (c97c2df) aarch64 aarch64 aarch64 GNU/Linux
rdo@tw-aarch64-build:~> ./nmc
INFO[2023-11-11T11:59:48Z] starting network manager configurator...
FATA[2023-11-11T11:59:48Z] failed to load static host configuration: open config/host_config.yaml: no such file or directory

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The latest flag is not working because we haven't tagged (and produced a release) yet. It'll work once we do so.

The binaries indeed are compiled for Linux x86_64 and aarch64 targets, not Darwin. Please take a look at this comment.

Choose a reason for hiding this comment

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

I'd say to call it nmc-linux-x86_64 just in case (and do the same for aarch64)

Choose a reason for hiding this comment

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

And maybe replace the instructions as per

curl -o nmc -L https://github.com/suse-edge/nm-configurator/releases/latest/download/nmc-linux-$(uname -m)
chmod +x nmc

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice suggestion, I'll go with this, thanks!

README.md Outdated
In order to generate these config (*.nmconnection) files, NMC uses the
[nmstate](https://github.com/nmstate/nmstate) library and requires a configuration directory as an input.
This directory must contain the desired network state for all hosts in a <i>hostname</i>.yaml file format.
Please refer to the official nmstate docs for [examples](https://nmstate.io/examples.html).

Choose a reason for hiding this comment

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

Great, but I think we should probably provide a really simple example here in the docs rather than referring to the upstream documentation. What do you think?

Choose a reason for hiding this comment

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

+1

```
$ ls -R _out
_out:
host_config.yaml node1 node2 node3

Choose a reason for hiding this comment

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

Are we missing instructions on how to build the host_config.yaml here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is automatically generated. We list the results of nmc generate here.

INFO[2023-08-17T17:32:23+03:00] storing file /etc/NetworkManager/system-connections/eth1.nmconnection...
INFO[2023-08-17T17:32:23+03:00] successfully configured network manager
```yaml
- hostname: node1

Choose a reason for hiding this comment

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

OK, so the host_config.yaml is here, but shouldn't it be defined/documented prior to the generate above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just an example of how it looks. Users shouldn't be creating or modifying it. Do you think specifying a label of some kind will make this more clear?

README.md Outdated
[2023-11-08T21:18:12Z INFO nmc::generate_conf] Generating config from "config/node1.yaml"...
[2023-11-08T21:18:12Z INFO nmc::generate_conf] Generating config from "config/node2.yaml"...
[2023-11-08T21:18:12Z INFO nmc::generate_conf] Generating config from "config/node3.yaml"...
[2023-11-08T21:18:12Z INFO nmc] Successfully generated and stored network config

Choose a reason for hiding this comment

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

I can't seem to get this to work as expected, that's why I think that we need a simple example:

rdo@tw-aarch64-build:~/nmc-example> tree config/
config/
├── host_config.yaml
├── node1.example.com
├── node2.example.com
└── node3.example.com

1 directory, 4 files

rdo@tw-aarch64-build:~/nmc-example> cat config/host_config.yaml
- hostname: node1.example.com
  interfaces:
    - logical_name: eth0
      mac_address: FE:C4:05:42:8B:AA
- hostname: node2.example.com
  interfaces:
    - logical_name: eth0
      mac_address: FE:C4:05:42:8B:AB
- hostname: node3.example.com
  interfaces:
    - logical_name: eth0
      mac_address: FE:C4:05:42:8B:AC

rdo@tw-aarch64-build:~/nmc-example> cat config/node1.example.com
interfaces:
- name: eth0
  type: ethernet
  state: up
  ipv4:
    address:
    - ip: 192.168.122.250
      prefix-length: 24
    enabled: true
  ipv6:
    address:
    - ip: 2001:db8::1:1
      prefix-length: 64
    enabled: true

rdo@tw-aarch64-build:~/nmc-example> ./nmc generate --config-dir config --output-dir _out
INFO[2023-11-11T12:13:37Z] starting network manager configurator...
FATA[2023-11-11T12:13:37Z] failed to load static host configuration: yaml: unmarshal errors:
  line 1: cannot unmarshal !!seq into config.Config

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just drop the host_config.yaml file. It is not expected to be created manually.

Copy link
Collaborator Author

@atanasdinov atanasdinov Nov 13, 2023

Choose a reason for hiding this comment

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

Actually, you're also running the old Go version one. As mentioned, we haven't produced a tag yet so the v0.1.0 release contains the Go binaries.

Please use this one in the meantime.

NetworkManager settings for a given host out of the pool of predefined desired states.

Typically used with [Combustion](https://documentation.suse.com/sle-micro/5.5/single-html/SLE-Micro-deployment/#cha-images-combustion)
in order to bootstrap multiple nodes using the same provisioning artefact instead of depending on different custom images per machine.

Choose a reason for hiding this comment

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

I take it that the next step here will be to push this into EIB with an example of how to integrate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The next step would be to integrate NMC into EIB but I don't believe we should be documenting that here. The highlighted text is more of a guideline as to how the apply command would commonly be used.

```

**NOTE:** Interface names during the installation of nodes might differ from the preconfigured logical ones.

Choose a reason for hiding this comment

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

Do I understand correctly that the code will compensate for network interface name changes, and will use the MAC address of each interface as the unique identifier and will update the network connection name to the system identified one, rather than the one from nmc configuration?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, exactly.

Copy link

@e-minguez e-minguez left a comment

Choose a reason for hiding this comment

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

Some comments.

README.md Outdated Show resolved Hide resolved
README.md Outdated
Each file contains the desired state for a single network interface (e.g. `eth0`).
Configurations for all interfaces for all known hosts must be generated using `nmstate`.
```shell
$ curl -o nmc -L https://github.com/suse-edge/nm-configurator/releases/latest/download/nmc-x86_64

Choose a reason for hiding this comment

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

I'd say to call it nmc-linux-x86_64 just in case (and do the same for aarch64)

README.md Outdated
Each file contains the desired state for a single network interface (e.g. `eth0`).
Configurations for all interfaces for all known hosts must be generated using `nmstate`.
```shell
$ curl -o nmc -L https://github.com/suse-edge/nm-configurator/releases/latest/download/nmc-x86_64

Choose a reason for hiding this comment

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

And maybe replace the instructions as per

curl -o nmc -L https://github.com/suse-edge/nm-configurator/releases/latest/download/nmc-linux-$(uname -m)
chmod +x nmc

README.md Outdated
```shell
$ git clone https://github.com/suse-edge/nm-configurator.git
$ cd nm-configurator
$ cargo build --release # optionally specify --target flag if cross compiling

Choose a reason for hiding this comment

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

Or maybe just put a disclaimer that this tool is intended to be executed on linux only.

README.md Outdated
In order to generate these config (*.nmconnection) files, NMC uses the
[nmstate](https://github.com/nmstate/nmstate) library and requires a configuration directory as an input.
This directory must contain the desired network state for all hosts in a <i>hostname</i>.yaml file format.
Please refer to the official nmstate docs for [examples](https://nmstate.io/examples.html).

Choose a reason for hiding this comment

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

+1

```shell
$ curl -o nm-configurator -L https://github.com/suse-edge/nm-configurator/releases/latest/download/nm-configurator-amd64
$ chmod +x nm-configurator
$ export RUST_LOG=info # set log level ("error" by default)

Choose a reason for hiding this comment

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

I miss a "this is how my config looks like before I run nmc" section :)

README.md Show resolved Hide resolved
Signed-off-by: Atanas Dinov <[email protected]>
Signed-off-by: Atanas Dinov <[email protected]>

`nm-configurator` depends on having the desired network state for all known nodes beforehand.
```shell
$ curl -o nmc -L https://github.com/suse-edge/nm-configurator/releases/latest/download/nmc-linux-$(uname -m)

Choose a reason for hiding this comment

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

👏🏻

$ cd nm-configurator
$ go build . # optionally specify GOOS and GOARCH flags if cross compiling
```
$ ls -R network-config

Choose a reason for hiding this comment

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

Personal preference but I find find (pun intended) output better

Each of these contains the configuration files for the desired network interfaces (e.g. `eth0`).

The `host_config.yaml` file on the root level maps the hosts to all of their preconfigured interfaces.
This is necessary in order for NMC to identify which host it is running on when applying the network configurations later.

Choose a reason for hiding this comment

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

Suggested change
This is necessary in order for NMC to identify which host it is running on when applying the network configurations later.
This is required in order for NMC to identify which host it is running on when applying the network configurations later.

Copy link

@rdoxenham rdoxenham left a comment

Choose a reason for hiding this comment

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

Awesome job, buddy!

@e-minguez e-minguez merged commit 1d3b917 into suse-edge:main Nov 20, 2023
2 checks passed
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.

Extend docs
3 participants