`gomnd` disabled, as it complains about every number used in the code,
and `wsl` became much more thorough.
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This DRYs up the interface configuration and adds in an error channel to capture
any issues that come up from interface configuration. These errors are still
treated as non-fatal, but should provide some additional insight.
Signed-off-by: Brad Beam <brad.beam@b-rad.info>
This implements an actual health check for networkd. We use the arp table ( ip neighbors )
to determine if the machine is actively sending traffic. We should see at least one entry
with a REACHABLE/STALE/DELAY state during normal operating conditions.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This introduces a health/ready api for networkd. This
will allow us to better determine the state of networkd
and allow for some level of monitoring.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
If nameserver is missing, `net.ParseIP` parses it as `nil` `net.IP` and
later on this `<nil>` address is pushed to `resolv.conf`.
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This modifies the way the hostname gets set. Previously, we would run
through the entire addressing and resolver configuration and then set the
hostname. This is problematic because the resolver depends on the functionality
of Hostname() ( resolver configuration relies on the domainname of the host ).
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This fixes a condition where a dhcp response does not provide a hostname. Previously
this would cause the default hostname ( talos-127-0-1-1 ) to be used. This catches
the condition and changes it to compute the hostname via talos-ip.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
Minor fix to error string format that also uses %q instead of %s. The
quoted format helps when there are hidden characters.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
This brings in an updated library along with some tweaks on our side to allow for
better decision making when it comes to the scope of routes. This also fixes an
issue where multiple configuration definitions for an interface were not properly
merged and instead were overwritten.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This should allow us to correctly differentiate between IFF_UP ( admin up ) and
IFF_RUNNING ( link ready ). This means that we should now wait for the link to
be up and running before proceeding with addressing which should allow for more
reliable results in the dhcp configuration and avoid any race issues in static
configuration.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
Using `SafePath` function from `runc` (but had to create local copy as
`runc` doesn't build on OS X).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This PR brings our protobuf files into conformance with the protobuf
style guide, and community conventions. It is purely renames, along with
generated docs.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
These timeouts were initially increased to handle long times for links to be ready. I think
with the updated link ready check in networkd these timers are unnecessary.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This should disregard the loopback from the hostname decision since it will always be hardcoded
to the default talos hostname.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This moves all the hostname aggregation and setting into networkd so we can
get a correct response.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This adds support for parsing/honoring the `ip=` kernel argument that can
be supplied to configure an interface on the host.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This change sets bonded devices to ignored if there is no user supplied
configuration. Without configuration, a bonded interfaces doesnt provide
any value. This should speed up initial boot times by preventing address
discovery on this interface.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This includes a healthy refactor of the networkd code as well.
- Move netlink functionality to nic package
- Networkd facilitates the orchestration of the underlying interface configuration
- Networkd now stores the state of each interface configuration. This
should allow us to expose this information via api in the future.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This introduces the ability to reset the network interface during the bootup sequence.
This allows for user defined static networking to be the only configuration on the
network interface instead of potentially dhcp+static.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
Logging is pretty simple and bare minimum is being logged. I believe
better logging can be provided for apid when it does fan-out, but that
is beyond the scope for the first PR.
Sample logs:
```
$ osctl-linux-amd64 logs machined-api
machined 2019/11/11 21:16:43 OK [/machine.Machine/ServiceList] 0.000ms unary Success (:authority=unix:/run/system/machined/machine.sock;content-type=application/grpc;user-agent=grpc-go/1.23.0)
machined 2019/11/11 21:17:09 Unknown [/machine.Machine/Logs] 0.000ms stream open /run/system/log/machined.log: no such file or directory (:authority=unix:/run/system/machined/machine.sock;content-type=application/grpc;user-agent=grpc-go/1.23.0)
```
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This adds support for specify nameservers in the config.
When I was adding tests I noticed the netconf code for setting
the MTU caused a panic. Given how we retrieve the data ( device centric )
in the static addressing method, I think this is safe to remove.
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This removes the github.com/pkg/errors package in favor of the official
error wrapping in go 1.13.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
This should provide a better UX around misconfigured Talos nodes. It is
just the start of something we can expand on.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
Memory usage reduced around 8-10x: now it stays stable at 1GB.
I disabled some of the new linters, and one rule which is violated a
lot.
I might make sense to go back and enable `wsl` fixing all the issues
(leaving that for another PR).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This moves from translating a config into an internal config
representation, to using an interface. The idea is that an interface
gives us stronger compile time checks, and will prevent us from having to copy
from on struct to another. As long as a concrete type implements the
Configurator interface, it can be used to provide instructions to Talos.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
In order for other projects to make use of our APIs, they must not
reside underneath the internal directory. This moves the protobuf
definitions to a top-level "api" directory and scopes them according to
their domain. This change also removes generated code from the gitignore
file so that users don't have to generate the code themseleves.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
The gofumports does everything that gofumpt does with the addition of
formatting imports. This change proposes the use of the `-local` flag so
that we can have imports separated in the following order:
- standard library
- third party
- Talos specific
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
The gofumpt linter is a stricter drop-in replacement for gofmt. The
rules are ones that I strongly agree with and I think it would be better
if we added this linter instead of nit picking every PR.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
Added a property to userdata to allow a network interface to be ignored,
such that Talos will perform no operations on it (including DHCP).
Also added kernel commandline parameter (talos.network.interface.ignore)
to specify a network interface should be ignored.
Also allows chaining of kernel cmdline parameter Contains() where the
parameter in question does not exist.
Fixes#1124
Signed-off-by: Seán C McCord <ulexus@gmail.com>
Increased retry count to 6 for DHCP. In my testing, this worked
reliably in my setup, where the default (3) did not.
Ultimately, this should probably be configurable from the userdata.
Instead, this just makes it work for me.
Fixes#1099
Signed-off-by: Seán C McCord <ulexus@gmail.com>
If multiple interfaces exist on a node, but the first interface was unsuccessful
in getting a dhcp response, we would seg fault when trying to retrieve the hostname
for that interface. This was due to d.Ack being nil and us having no guard around it
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
This is a major rewrite of our network subsystem.
- This changes networkd to run as a standalone app versus internal goroutine
- This changes out the netlink package with the more idiomatic netlink/rtnetlink
packages
- This changes the initial network bootstrap/discovery from using a single
interface to attempting to bring up all interfaces
- This moves us back on to the upstream dhcp library
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>