Commit Graph

932 Commits

Author SHA1 Message Date
Derek Nola
dd3485c202 add support for pprof server (#5527) (#5691)
Signed-off-by: igor <igor@igor.io>
Signed-off-by: Derek Nola <derek.nola@suse.com>

Co-authored-by: Igor <igorwwwwwwwwwwwwwwwwwwww@users.noreply.github.com>
2022-06-14 17:50:21 -07:00
Brad Davidson
b004f4d578 Set default egress-selector-mode to agent
... until QA flakes can be addressed.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-06-10 10:14:51 -07: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
Derek Nola
b1a3ad0aa2 Add new k3s completion command for shell completion (#5592)
* Add shell completion CLI
Signed-off-by: Derek Nola <derek.nola@suse.com>
2022-05-23 08:36:15 -07:00
Donnie Adams
3be8dda856 Remove objects when removed from manifests (#5560)
* Remove objects when removed from manifests

If a user puts a file in /var/lib/rancher/k3s/server/manifests/ then the
objects contained therein are deployed to the cluster. If the objects
are removed from that file, they are not removed from the cluster.

This change tracks the GVKs in the files and will remove objects when
there are removed from the cluster.

Signed-off-by: Donnie Adams <donnie.adams@suse.com>
(cherry picked from commit c38a8c3b43)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-05-20 16:39:13 -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
b158411687 Don't start embedded kubelet until after apiserver is up
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit d93b750326)
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
4f78499cd4 Make supervisor errors parsable by Kubernetes client libs
This gives nicer errors from Kubernetes components during startup, and
reduces LOC a bit by using the upstream responsewriters module instead
of writing the headers and body by hand.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 3d01ca1309)
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
Brad Davidson
f5b8f4b46c Use core constants for cert user/group values
Also update cert gen to ensure leaf certs are regenerated if other key fields change.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 99851b0f84)
2022-05-20 16:39:13 -07:00
Brad Davidson
6a83c1e1b0 Fix log spam due to servicelb event recorder namespace conflict
Don't hardcode the event namespace when creating event recorders; some controllers want to create events in other namespaces.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 965d0a08ef)
2022-05-20 16:39:13 -07:00
Brad Davidson
e17ba49641 Support MixedProtocolLBService and clean up Daemonsets on type change.
Also add event support to increase visibility of change events.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 44c53743dd)
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
Manuel Buil
329b0c3f45 Add "ipFamilyPolicy: PreferDualStack" to have dual-stack ingress support
Signed-off-by: Manuel Buil <mbuil@suse.com>
2022-05-04 18:38:23 +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
Roberto Bonafiglia
e2c3b89ee5 Added default endpoint for IPv6 (#5510)
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-26 09:16:36 -07:00
Derek Nola
aac491c8bd [Release-1.22] Secrets Encryption: Add RetryOnConflict around updating nodes (#5498)
* Add RetryOnConflict around updating nodes

Signed-off-by: Derek Nola <derek.nola@suse.com>
2022-04-22 15:02:07 -07:00
Brad Davidson
b7c7a23e0f Fix issue with long-running apiserver endpoints watch (#5479)
Use ListWatch helpers to retry when the watch channel is closed.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-04-21 09:27:54 -07:00
Manuel Buil
d1ee2b6f1b Fix default ipv6 cidr (#5469)
Signed-off-by: Manuel Buil <mbuil@suse.com>
2022-04-20 08:41:54 -07:00
Derek Nola
7ea6f13154 [Release-1.22] Add s390x arch support for k3s (#5447)
* 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>
Signed-off-by: Derek Nola <derek.nola@suse.com>

* Add s390x arch support for k3s (#5018)

* Update docs to include s390x arch

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>

* Add s390x drone pipeline

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>

* Install trivy linux arch only for amd64

This is done so that trivy is not installed for s390x arch

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>

* Add s390x arch if condition for Dockerfile.test

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>

* Add s390x arch in install script

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>

* Add s390x GOARCH in build script

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>

* Add SUFFIX s390x in scripts

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>

* Skip image scan for s390x arch

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>

* Update klipper-lb to version v0.3.5

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>

* Update traefik version to v2.6.2

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>

* Update registry to v2.8.1 in tests which supports s390x

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>

* Skip compact tests for s390x arch

This is done because compact test require a previous k3s version which supports s390x and it is not available

Signed-off-by: Venkata Krishna Rohit Sakala <rohitsakala@gmail.com>
Signed-off-by: Derek Nola <derek.nola@suse.com>

* Increase k3s-root version to v0.10.0 which includes s390x support

Signed-off-by: Derek Nola <derek.nola@suse.com>

Co-authored-by: Michal Rostecki <vadorovsky@gmail.com>
Co-authored-by: Sakala Venkata Krishna Rohit <rohitsakala@gmail.com>
2022-04-19 14:43:28 -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
508a358d49 Print a helpful error when trying to join additional servers but etcd is not in use
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 5b2c14b123)
2022-04-15 11:15:00 -07:00
Brad Davidson
8408d19bd6 Use core constants for cert user/group values
Also update cert gen to ensure leaf certs are regenerated if other key fields change.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 99851b0f84)
2022-04-15 11:15:00 -07:00
Brad Davidson
059710df4e Don't print password conversion rate
Avoids divide-by-zero when the password file is empty

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 0bf7c09569)
2022-04-15 11:15:00 -07:00
Brad Davidson
70df1cc324 Move the apiserver addresses controller into the etcd package
This controller only needs to run when using managed etcd, so move it in
with the rest of the etcd stuff. This change also modifies the
controller to only watch the Kubernetes service endpoint, instead of
watching all endpoints in the entire cluster.

Fixes an error message revealed by use of a newer grpc client in
Kubernetes 1.24, which logs an error when the Put to etcd failed because
kine doesn't support the etcd Put operation. The controller shouldn't
have been running without etcd in the first place.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit f37e7565b8)
2022-04-15 11:15:00 -07:00
Brad Davidson
50390441bb Fix crash on early snapshot
Don't attempt to retrieve snapshot metadata configmap if the apiserver
isn't available. This could be triggered if the cron expression caused a
snapshot to be triggered before the apiserver is up.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 2a429aac65)
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
Brad Davidson
ff36514249 Add client certificate authentication support to core Authenticator
This is required to make the websocket tunnel server functional on
etcd-only nodes, and will save some code on the RKE2 side once pulled
through.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit af0b496ef3)
2022-04-15 11:15:00 -07:00
Brad Davidson
e0fa2972da Redact datastore and etcd snapshot config from serialization
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit e7437d4ad8)
2022-04-15 11:15:00 -07:00
Brad Davidson
856e7efea5 Bump etcd to 3.5.3-k3s1
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-04-15 02:00:15 -07:00
Roberto Bonafiglia
c030917272 Fixed flannel backend helper text
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-14 10:44:16 +02: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
15472506e1 Fixed gofmt format
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-05 12:55:27 +02:00
Roberto Bonafiglia
27264a45cb Fixed included modules
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-05 11:05:18 +02:00
Roberto Bonafiglia
29a761360b Fixed http URL on etcd
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-05 10:22:59 +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
80b22ded81 Fixed etcd register
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-05 10:19:34 +02:00
Roberto Bonafiglia
5df127ec72 Fixed client URL
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-05 10:19:21 +02:00