Skip to content

Netplan docs rework #333

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

Merged
merged 13 commits into from
Mar 14, 2023
Merged

Netplan docs rework #333

merged 13 commits into from
Mar 14, 2023

Conversation

daniloegea
Copy link
Contributor

@daniloegea daniloegea commented Mar 7, 2023

Description

I tried to follow the ideas from diataxis.fr and adapted parts of our documentation to the framework.

  • Tutorial: I created a tutorial to guide the user that has very little knowledge about Netplan through a number of tasks they can execute in a virtual machine. Each task increments the previous one and introduce more things one can do with Netplan.
    • Should I introduce netplan status as well? I didn't use it because it's only available in Lunar at the moment...
  • How-tos: I changed the sets of examples to look more like how-tos. I removed or simplified some of the explanations to go straight to the point of the problem we are trying to solve. I also added a few more how-tos to the document. The indentation was normalized to 2 spaces.
  • Reference: I added a new initial section to the document that shows the general structure of a Netplan YAML file and changed the examples so they will be complete configuration files and the reader can easily see where each settings fits in the configuration.

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad.

Danilo Egea Gondolfo added 3 commits March 6, 2023 16:36
Also, decrese the YAML files indentation and add few more howtos.
Add one initial section describing the general structure of a Netplan
YAML file.

Improve the examples so the reader can see where a given setting fits in
the configuration.
Copy link
Collaborator

@slyon slyon left a comment

Choose a reason for hiding this comment

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

This is not yet a full review, but I had an initial look and left some inline comments.

I'd like to ask some real Diataxis expert like @tmihoc to do a full review.

The docs can be built and rendered locally from Danilo's branch, using cd doc/ && make install && make run

Now create a virtual machine called `netplan-lab0`:

```bash
lxc init --vm ubuntu:22.04 netplan-lab0
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we should use something newer here, like ubuntu-daily:devel to make the latest Netplan features (like "status" CLI) available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm I don't know, I think the focus should be stable releases, those are the ones users will install after all. We can update it to ubuntu:23.04 in a couple of months I guess. For now I think I will mention netplan status is only available in netplan 0.106.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree. And your suggestion wfm.

Once backported to Jammy, we can even drop it back to ubuntu:22.04 as using a LTS release in the tutorial sounds like a good idea.

Danilo Egea Gondolfo added 8 commits March 8, 2023 11:42
Also, link the new netplan-tutorial.md in the main page index.
Now the tutorial and how-tos sections will show up in the sidebar menu.
By linking the main file in the front page the reader will be sent
directly to the text instead of a page with only an index.
Sphinx was logging many warnings like "WARNING: Document headings start
at H2, not H1"
Also, add a new section about bonds to the tutorial.
@daniloegea daniloegea force-pushed the netplan_docs_rework branch from 35b8015 to 01761d8 Compare March 8, 2023 17:44
Copy link
Collaborator

@slyon slyon left a comment

Choose a reason for hiding this comment

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

Thank you, this is looking nice! +1 from my side, but let's wait for Teodora's comments before merging this.

Just a few more small suggestions/nitpicks inline.

```

To instead set a static IP address, use the addresses key, which takes a list of (IPv4 or IPv6), addresses along with the subnet prefix length (e.g. /24). DNS information can be provided as well, and the gateway can be defined via a default route:
# How to configure a static IP address on an interface
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion: I feel like we should remove the "How to " prefix here and on all the other instances below. They're all listed under the "How-to guides" sections after all. DRY.

Suggested change
# How to configure a static IP address on an interface
# Configure a static IP address on an interface

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As they are listed one after another the "How to" gets very repetitive... I followed the naming conventions from here though https://diataxis.fr/how-to-guides/#pay-attention-to-naming

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay. Let's wait and see how Teodora thinks about it!

Copy link
Member

Choose a reason for hiding this comment

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

About the "How to" bit in titles: Daniele said we should use it inside the docs but not in the navigation table. I.e., in this case,

  • inside the doc: "How to configure a static IP address on an interface"
  • in the navigation table: "Configure a static IP address on an interface"

Also, move nm-devices to the end of the list in the reference
document as they are not supposed to be used in a normal scenario.
try Try to apply a new netplan config to running system, with automatic rollback
```

As you can see, netplan has a number of sub commands. Let's explore some of them.
Copy link
Member

@tmihoc tmihoc Mar 13, 2023

Choose a reason for hiding this comment

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

The sections that follow are nicely done but I'm not sure they fit with Daniele's idea of a tutorial. To use a culinary metaphor, the tutorial should be about helping the user bake that first cake, not about giving the user an introduction to the ingredients, utensils, and basic procedures -- no matter how gentle that introduction may be, that is work that should be done in the Ref / How-to docs.

This file was automatically generated by `cloud-init` when the system was initialized. As noted in the comments, changes to this file will not persist.

# Enabling your second network interface with DHCP

Copy link
Member

Choose a reason for hiding this comment

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

This section is excellent -- as a How-to guide.

```

Use the command `cat` to see its content:

Copy link
Member

Choose a reason for hiding this comment

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

Depending on your audience, you might want to clarify that this is a Unix command. Maybe not necessary in this particular case but, as a rule of thumb, always try to help the user understand which pieces are a part of your product and which one are not.

```

In the output, the MAC address is the number in front of the `link/ether` property.
```
Copy link
Member

Choose a reason for hiding this comment

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

So, here, 1000? Always clarify. PS: This seems wrong. In the YAML below I see that the macaddress is 00:16:..., so I probably interpreted "the number in front of the link/ether property" wrong. That could be because I don't really know much about this. But, is there any chance someone else will make the same mistake? Either way, it's better to avoid unclear descriptions.

> `nm-devices` are used in situations where Netplan doesn't support the connection type. The raw configuration expected by NetworkManager can be defined and will be passed as is (passthrough) to the `.nmconnection` file. Users will not normally use this type of device.

All the properties for all the device types will be described in the next sections.

Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible / make sense to follow the structure in this doc https://juju.is/docs/sdk/metadata-yaml ?, where each top-level key gets its own section, which clarifies the status, purpose, and structure of the key, and also gives examples, e.g., https://juju.is/docs/sdk/metadata-yaml#heading--assumes ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to take care, as the same markdown file is also used to build our man pages (e.g. https://manpages.ubuntu.com/manpages/kinetic/man5/netplan.5.html) and the HTML documentation shipped in /usr/share/doc/netplan/netplan.html. And we need to make sure it is being rendered properly everywhere.

@tmihoc
Copy link
Member

tmihoc commented Mar 13, 2023

Hi! I think these are all great improvements, and I would publish them right away, using any comments to plan future work.

The comments amount to the following recommendations:

  1. In general: Help the user distinguish visually between main content and tangents (i.e., set off notes that give links to further information, or notes with caveats about edge-cases, etc.).
  2. In general: Help the user distinguish between content that pertains to your product and other types of content (e.g., netplan commands vs. lxc commands vs. general Unix commands etc.)
  3. In general (though especially in the Tutorial / How-to guides): Avoid making the user look back, ahead, or sideways (try to stick to "below" and nothing else).
  4. In a Tutorial / How-to guide, always keep the user in active mode. E.g., Use verbal (doc and) section titles ("Do x", not "Doing x"), where each title should be a step in the bigger story of the Tutorial / How-to guide.
  5. Distinguish between Tutorial and How-to guides / Reference docs. To use a culinary metaphor, even if it will inevitably involve mention of ingredients / utensils (Reference material), and procedures (How-to material), the Tutorial must always stay focused on baking the cake.
  6. In Reference docs: (a) Add a doc for every Netplan command. (b) For docs focused on giving the spec of a yaml file, structure the doc around the top-level keys.

Happy to clarify further.

@daniloegea daniloegea force-pushed the netplan_docs_rework branch from 3c9fbd0 to 79af7de Compare March 13, 2023 19:00
@daniloegea
Copy link
Contributor Author

I really appreciate the thorough review you provided, @tmihoc

We'll try to adopt all your suggestions in our documentation!

@slyon
Copy link
Collaborator

slyon commented Mar 14, 2023

Thank you very much @tmihoc and @daniloegea for your input!

I marked the "little things" that Danilo already fixed as "resolved" and will merge the PR as-is. We'll then work on a follow-up PR to fix the bigger things separately.

@slyon slyon merged commit 51fee38 into canonical:main Mar 14, 2023
@slyon slyon mentioned this pull request Apr 3, 2023
5 tasks
slyon pushed a commit that referenced this pull request Apr 3, 2023
Adding man pages for all the commands.

Improving the network types descriptions a little.

Follow-up for #333

COMMITS:
* docs: add missing manpages

Add manpages for the commands "info", "ip", "rebind" and "status".

* docs: improve the Netplan reference

The list of network keys are indexing their respective sections.

Each section was expanded with a short description and explanation about
the network type with a small example.

* doc: refine wording & formatting
daniloegea pushed a commit that referenced this pull request May 17, 2023
I tried to follow the ideas from diataxis.fr and adapted parts of our documentation to the framework.

* Tutorial: I created a tutorial to guide the user that has very little knowledge about Netplan through a number of tasks they can execute in a virtual machine. Each task increments the previous one and introduce more things one can do with Netplan.
* How-tos: I changed the sets of examples to look more like how-tos. I removed or simplified some of the explanations to go straight to the point of the problem we are trying to solve. I also added a few more how-tos to the document. The indentation was normalized to 2 spaces.
* Reference: I added a new initial section to the document that shows the general structure of a Netplan YAML file and changed the examples so they will be complete configuration files and the reader can easily see where each settings fits in the configuration.

COMMITS:

* docs: Add a "getting started" netplan tutorial

* docs: Make the examples look more like howtos

Also, decrese the YAML files indentation and add few more howtos.

* docs: Add more details to the reference manual

Add one initial section describing the general structure of a Netplan
YAML file.

Improve the examples so the reader can see where a given setting fits in
the configuration.

* docs: remove old tutorials.md file

Also, link the new netplan-tutorial.md in the main page index.

* docs: fix man page rendering

* docs: improve the new sections visualization

Now the tutorial and how-tos sections will show up in the sidebar menu.

* docs: use netplan status in the tutorial

* docs: link the main howtos file in the main page

By linking the main file in the front page the reader will be sent
directly to the text instead of a page with only an index.

* docs: fix formating and typos

* docs: fix some warning from Sphinx

Sphinx was logging many warnings like "WARNING: Document headings start
at H2, not H1"

* docs: Improve examples for consistency

Also, add a new section about bonds to the tutorial.

* docs: fix typos and formatting

Also, move nm-devices to the end of the list in the reference
document as they are not supposed to be used in a normal scenario.

* docs: minor adjustments to the text
daniloegea pushed a commit that referenced this pull request May 17, 2023
Adding man pages for all the commands.

Improving the network types descriptions a little.

Follow-up for #333

COMMITS:
* docs: add missing manpages

Add manpages for the commands "info", "ip", "rebind" and "status".

* docs: improve the Netplan reference

The list of network keys are indexing their respective sections.

Each section was expanded with a short description and explanation about
the network type with a small example.

* doc: refine wording & formatting
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.

3 participants