Commit Graph

281 Commits (release-1.22)

Author SHA1 Message Date
Roberto Bonafiglia 2b13d70afd Updated flannel to v0.19.1
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-08-08 09:58:39 +02:00
Roberto Bonafiglia bdb35433c5 Added NodeIP autodect in case of dualstack connection
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-08-04 18:47:30 +02:00
Manuel Buil cab1822b31 Check if user has a correct cluster-cidr and service-cidr config
Signed-off-by: Manuel Buil <mbuil@suse.com>
2022-08-04 18:47:30 +02:00
Michal Rostecki d426f13034 agent(netpol): Explicitly enable IPv4 when necessary
Before this change, kube-router was always assuming that IPv4 is
enabled, which is not the case in IPv6-only clusters. To enable network
policies in IPv6-only, we need to explicitly let kube-router know when
to disable IPv4.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2022-08-04 18:47:30 +02:00
Brad Davidson 07c436a643 Fix server systemd detection
* Use INVOCATION_ID to detect execution under systemd, since as of a9b5a1933f NOTIFY_SOCKET is now cleared by the server code.
* Set the unit type to notify by default for both server and agent, which is what Rancher-managed installs have done for a while.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit bd5fdfce33)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-08-04 09:40:01 -07:00
Brad Davidson ea615fb033 Bump remotedialer
Includes fix for recently identified memory leak.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-07-12 12:29:43 -07:00
Sjoerd Simons 94dbfebfc2 Add ability to pass configuration options to flannel backend
Allow the flannel backend to be specified as
backend=option=val,option2=val2 to select a given backend with extra options.

In particular this adds the following options to wireguard-native
backend:
* Mode - flannel wireguard tunnel mode
* PersistentKeepaliveInterval- wireguard persistent keepalive interval

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
2022-06-16 10:02:12 +02:00
Derek Nola c9a44790e1
Delay service readiness until after startuphooks have finished (#5724)
* Move startup hooks wg into a runtime pointer, check before notifying systemd
* Switch default systemd notification to server
* Add 1 sec delay to allow etcd to write to disk
Signed-off-by: Derek Nola <derek.nola@suse.com>
2022-06-15 13:45:26 -07:00
Brad Davidson edd2fb9535 Ensure that CONTAINERD_ variables are not shadowed by later entries
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-06-15 10:58:29 -07:00
Manuel Buil 05592ad015 Add FlannelConfCNI flag
Signed-off-by: Manuel Buil <mbuil@suse.com>
2022-06-14 10:27:22 +02:00
Brad Davidson bc726e2cba Remove control-plane egress context and fix agent mode.
The control-plane context handles requests outside the cluster and
should not be sent to the proxy.

In agent mode, we don't watch pods and just direct-dial any request for
a non-node address, which is the original behavior.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-06-10 10:14:51 -07:00
Brad Davidson 28eb743905 Refactor egress-selector pods mode to watch pods
Watching pods appears to be the most reliable way to ensure that the
proxy routes and authorizes connections.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-06-08 09:35:56 -07:00
Brad Davidson b24c7e2330 Update CNI version in config file
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit e6385b2341)
2022-05-20 16:39:13 -07:00
Brad Davidson aaeb37b506 Move auto-generated resolv.conf out of /tmp to prevent accidental cleanup
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 1d4f995edd)
2022-05-20 16:39:13 -07:00
Brad Davidson b330ce340a Add support for configuring the EgressSelector mode
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 9d7230496d)
2022-05-20 16:39:13 -07:00
Brad Davidson 3fa5619d73 Replace DefaultProxyDialerFn dialer injection with EgressSelector support
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit ce5b9347c9)
2022-05-20 16:39:13 -07:00
Brad Davidson ea09106737 Ensure that WaitForAPIServerReady always re-dials through the loadbalancer
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit e763fadbba)
2022-05-20 16:39:13 -07:00
Brad Davidson 2217002c8f Use ListWatch helpers instead of bare List/Watch
Reduces code complexity a bit and ensures we don't  have to handle closed watch channels on our own

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 13ca10664f)
2022-05-20 16:39:13 -07:00
Brad Davidson e1ba7a299f Drop unnecessary intermediate variable
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit a69d635c9b)
2022-05-20 16:39:13 -07:00
Brad Davidson c1d1ab674d Add systemd cgroup controller support
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 333311c7ee)
2022-05-20 16:39:13 -07:00
Brad Davidson 7168f7282c Move IPv4/v6 selection into helpers
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit b12cd62935)
2022-05-20 16:39:13 -07:00
Derek Nola 0663681a3d
Replace rancher with k3s-io (#5585)
Signed-off-by: Derek Nola <derek.nola@suse.com>
2022-05-19 15:54:21 -07:00
Hussein Galal beaed3c5ed
[Release-1.22] Add systemd cgroup controller support (#5555)
* Add systemd cgroup controller support

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>

* Drop unnecessary intermediate variable

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>

Co-authored-by: Brad Davidson <brad.davidson@rancher.com>
2022-05-12 22:20:50 +02:00
Brad Davidson 8b0b50a5e8
[release-1.22] Fix issue with datastore corruption on cluster-reset (#5517)
* Bump etcd to v3.5.4-k3s1
* Fix issue with datastore corruption on cluster-reset
* Disable unnecessary components during cluster reset

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-04-27 15:11:41 -07:00
Michal Rostecki 33d61bdb26 netpol: Add dual-stack support
This change allows to define two cluster CIDRs for compatibility with
Kubernetes dual-stuck, with an assumption that two CIDRs are usually
IPv4 and IPv6.

It does that by levearaging changes in out kube-router fork, with the
following downstream release:

https://github.com/k3s-io/kube-router/releases/tag/v1.3.2%2Bk3s

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2022-04-15 14:23:28 -07:00
Brad Davidson c33aa20831 Fix issue with RKE2 servers hanging on listing apiserver addresses
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 7e447692c5)
2022-04-15 11:15:00 -07:00
Brad Davidson b61cdce8c6 Allow agents to query non-apiserver supervisors for apiserver endpoints
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 49544e0d49)
2022-04-15 11:15:00 -07:00
Roberto Bonafiglia d7e7ddf168 Updated wireguard-native options and added log message
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-11 09:54:42 +02:00
Roberto Bonafiglia e24e6446fd Added new flannel backend to use wireguard from flannel
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-11 09:54:26 +02:00
Euan Kemp d4a3edf728 Allow using flannel wireguard backend in a custom config
Ideally we'd have fully fleshed out support for it (i.e. #5011), but
that's a potentially breaking change and taking a little while to merge.

This is a much simpler change which won't break anything, but will allow
a "Type": "wireguard" reference in the "--flannel-conf" custom config
file to work.

Signed-off-by: Euan Kemp <euank@euank.com>
2022-04-11 09:53:23 +02:00
Roberto Bonafiglia ba0270c6bc Fixed loadbalancer in case of IPv6 addresses
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-05 10:22:34 +02:00
Roberto Bonafiglia a8fdf93e15 Updated localhost address on IPv6 only setup
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-05 10:18:58 +02:00
Luther Monson 4a97a7c8da add a wrapper around the containerd.New call to fix and pass the proper npipe connector
Signed-off-by: Luther Monson <luther.monson@gmail.com>
2022-03-29 18:07:57 -07:00
Brad Davidson 11ac5a87b7 Bootstrap the executor even when the agent is disabled
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit f090bf2d5e)
2022-03-15 18:08:33 -07:00
Brad Davidson 5cb6b1ecbc Fix adding etcd-only node to existing cluster
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 5014c9e0e8)
2022-03-15 18:08:33 -07:00
Roberto Bonafiglia 7d555489c0 Changed ipv6 config on flannel setup
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-03-14 11:57:49 +01:00
Roberto Bonafiglia 82d5f52719 Added ipv6 only support with flannel
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-03-14 11:57:49 +01:00
Roberto Bonafiglia 7bae0481ef Fixed log in case of ipv6 only config
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-03-14 11:57:49 +01:00
Roberto Bonafiglia 29324439b8 Added switch case to check netMode
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-03-14 11:57:49 +01:00
Roberto Bonafiglia 2b83753b3c Fixed in case of empty address
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-03-14 11:57:49 +01:00
Roberto Bonafiglia 1187c3573d Updated flannel to 0.17
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-03-14 11:57:49 +01:00
Olli Janatuinen ec59241777 Add support for IPv6 only mode
Automatically switch to IPv6 only mode if first node-ip is IPv6 address

Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-03-14 11:57:48 +01:00
Manuel Buil 1b29b96e49 Fix annoying netpol log
Signed-off-by: Manuel Buil <mbuil@suse.com>
2022-02-10 20:13:58 +01:00
Michal Rostecki 8798c42886 netpol: Use kube-router as a library
Before this change, we were copying a part of kube-router code to
pkg/agent/netpol directory with modifications, from which the biggest
one was consumption of k3s node config instead of kube-router config.

However, that approach made it hard to follow new upstream versions.
It's possible to use kube-router as a library, so it seems like a better
way to do that.

Instead of modifying kube-router network policy controller to comsume
k3s configuration, this change just converts k3s node config into
kube-router config. All the functionality of kube-router except netpol
is still disabled.

Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
Signed-off-by: Manuel Buil <mbuil@suse.com>
2022-02-07 19:21:57 +01:00
Brad Davidson 4acbbcad01 Move containerd wait into exported function
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-01-25 13:09:48 -08:00
Manuel Buil 45365943e1 Move flannel logs to logrus
Signed-off-by: Manuel Buil <mbuil@suse.com>
2022-01-18 14:38:03 +01:00
Roberto Bonafiglia db4d0466e5 Added debug log for IPv6 Masquerading rule
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@gmail.com>
2022-01-18 13:10:38 +01:00
Roberto Bonafiglia f5475bf6a8 Added flannel-ipv6-masq flag to enable IPv6 nat
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@gmail.com>
2022-01-18 13:10:25 +01:00
Roberto Bonafiglia 4f7fa01730 Added iptables masquerade rules for ipv6 on flannel
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@gmail.com>
2022-01-18 13:10:14 +01:00
Brad Davidson 8b05c21d58 Update wharfie usage in windows code path
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2021-12-09 13:17:27 -08:00