There were two problems:
* `configureInterfaces` was always failing if interface is already set
up, as the routes already exist
* `renew` was halving the renew interval each time `configureInterface`
fails, which starts at (LeaseTime/2) and goes effectively to zero
This was leading to high networkd CPU usage, storm of DHCP requests on
the network.
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This allows config to be written to disk without being applied
immediately.
Small refactoring to extract common code paths.
At first, I tried to implement this via the sequencer, but looks like
it's too hard to get it right, as sequencer lacks context and config to
be written is not applied to the runtime.
Fixes#2828
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
While IPv6 were mostly supported already, there was a single segment in
the interface setup which forced everything into an IPv4 route.
This limitation has been removed.
In so doing, route metrics have been cleaned up a small amount.
This change allows the specification of the route metric from the
config.
Fixes#2772
Signed-off-by: Seán C McCord <ulexus@gmail.com>
Fixes were applied automatically.
Import ordering might be questionable, but it's strict:
* stdlib
* other packages
* same package imports
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This PR makes use of a new merge into the upstream rtnetlink library
that introduces functional args for adding routes.
Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
This covers most of the packages except for those we have to keep on
hold (etcd and grpc because of etcd).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This PR updates the behavior of our machine configs with respect to
DHCP-enabled interfaces. Now, if MTU is specified by the user, that
value will take precedence over any setting provided by the DHCP server.
Additionally, any routes specified will be appended to routes specified
by the DHCP server.
Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
This PR adds a "DHCPOptions" field to the config. This field contains a
single subfield currently, "RouteMetric". Setting this well ensure that
any routes provided from the DHCP server are given this metric upon
injection into the routing table.
Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
This PR allows for the ability to specify neither CIDR nor DHCP in the
talos machine config. The result here should allow for things like SLAAC
addressing with ipv6.
Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
In order to perform upgrades the way we would like, it is important that
we avoid any bind mounts into containers. This change ensures that all
system services get their config via stdin.
Signed-off-by: Andrew Rynhard <andrew@rynhard.io>
This moves `pkg/config`, `pkg/client` and `pkg/constants`
under `pkg/machinery` umbrella.
And `pkg/machinery` is published as Go module inside Talos repository.
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This make the config provider a pure interface definition by removing
all concrete internal types, and making them an interface.
Signed-off-by: Andrew Rynhard <andrew@rynhard.io>
This makes `pkg/config` directly importable from other projects.
There should be no functional changes.
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
Fixes#2272
`gofumpt` is now included into `golangci-lint`, but not the
`gofumports`, so we keep it using it as separate binary, but we keep
versions in sync with `golangci-lint`.
This contains fixes from:
* `gofumpt` (automated, mostly around octal constants)
* `exhaustive` in `switch` statements
* `noctx` (adding context with default timeout to http requests)
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This linter makes sure tests are excercising only public package API.
I fixed all the tests which touch only public API of the packages. For
other test packages I added proper `//nolint` directive.
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This PR will introduce a new field to v1alpha1 configs that allows users
to set `dummy: true` when specifying interfaces. If present, we will
create a dummy interface with the CIDR information given. This is useful
for users that don't want to use loopback for things like ECMP (or want
more than one dummy interface).
The created dummy interface looked like this with `ip a`:
```
3: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1000
link/ether 66:4a:e3:5f:38:10 brd ff:ff:ff:ff:ff:ff
inet 10.254.0.5/32 brd 10.254.0.5 scope global dummy0
valid_lft forever preferred_lft forever
```
Will close#2186.
Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
The source address is set by default, which leads to RNETLINK
errors, when the Global Unicast Address is passed as a Source
to a LL Unicast Gateway. Errors of RTNETLINK are now logged.
Signed-off-by: Frederik Schwan <frederik.schwan@linux.com>
This is a rewrite of machined. It addresses some of the limitations and
complexity in the implementation. This introduces the idea of a
controller. A controller is responsible for managing the runtime, the
sequencer, and a new state type introduced in this PR.
A few highlights are:
- no more event bus
- functional approach to tasks (no more types defined for each task)
- the task function definition now offers a lot more context, like
access to raw API requests, the current sequence, a logger, the new
state interface, and the runtime interface.
- no more panics to handle reboots
- additional initialize and reboot sequences
- graceful gRPC server shutdown on critical errors
- config is now stored at install time to avoid having to download it at
install time and at boot time
- upgrades now use the local config instead of downloading it
- the upgrade API's preserve option takes precedence over the config's
install force option
Additionally, this pulls various packes in under machined to make the
code easier to navigate.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
This fixes random markdown linting issues. The previous `sentences-per-line`
library seems to be broken now, and unmaintained. This moves to using
`textlint` instead.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
This PR will fix some unexpected behavior where we were using Interfaces
as an unordered map, which led to varying behavior with hostname
determination. We will now go through the list of interfaces
alphabetically by name.
Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
This PR will allow users to configure /etc/hosts through the network
config section, as opposed to having to use a file append operation.
Example usage might look something like:
```
...
...
machine:
...
...
network:
extraHostEntries:
- ip: 192.168.1.100
aliases:
- test
- test.wtf.bbq
...
...
```
Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
We saw strange behavior in this health check, and think that it is due
to ARP table cache. In practice, the health check caused nodes to hang.
We decided to not use the ARP table to determine the health of networkd.
The fact that networkd can respond to the health API should be
sufficient enough since network will fail to start upon any error in the
initial setup of the network.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
Adding VLAN as option to machine config under devices.
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
feat: Add addressing support for VLAN devices.
- Refactors static addressing to not be dependent on machine.Device
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
feat: Add addressing support for VLAN devices.
- Support of VLAN being the default network to use by removing need of addressing on master device.
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
fix: Fix the fmt of go files
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
fix: refactor based on review comment.
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
fix: remove unused function
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
feat: initial work for supporting vlans
Adding VLAN as option to machine config under devices.
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
feat: Add addressing support for VLAN devices.
- Refactors static addressing to not be dependent on machine.Device
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
feat: Add addressing support for VLAN devices.
- Support of VLAN being the default network to use by removing need of addressing on master device.
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
fix: Fix the fmt of go files
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
fix: refactor based on review comment.
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
fix: fix test case function arguments
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
fix: Add log for debugging address configuration failures
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
fix: fix lint issues.
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
fix: fix the lint error.
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
fix: Fix when addressing set with kernel options
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
According to `rtnetlink(7)` field `state` is a bitmask of states, so
update the check to test accordingly.
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This fixes a case when the domain name DHCP option is set, but hostname
is missing, causing the node to be setup without a hostname.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
This PR will allow users to set the `persist: true` value in their
config data to tell talos not to re-pull the config data at each reboot.
The default will still remain as a "pull every time" methodolgy in order
to encourage immutability by default.
Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
This makes use of the external procfs pacakge that is based on the
pacakge we are removing here.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
The default gRPC dialer honors proxy environment variables, which causes
local unix socket connections to attempt to go through the proxy. This
fixes that by using a custom dialer.
Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
When `ip=dhcp` (as well as a few other conditions), the
buildKernelOptions function returns empty. In these cases, this empty
network config should not be added to the common list for iteration.
fixes#1869
Signed-off-by: Seán C McCord <ulexus@gmail.com>
`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>