Commit Graph

804 Commits

Author SHA1 Message Date
Derek Nola
1e0507c6c0 [Release-1.21] Delay service readiness until after startuphooks have finished (#5725)
* 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 12:36:12 -07:00
Brad Davidson
ecddd26757 Sanitize filenames for use in configmap keys
If the user points S3 backups at a bucket containing other files, those
file names may not be valid configmap keys.

For example, RKE1 generates backup files with names like
`s3-c-zrjnb-rs-6hxpk_2022-05-05T12:05:15Z.zip`; the semicolons in the
timestamp portion of the name are not allowed for use in configmap keys.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-06-15 10:56:08 -07:00
Derek Nola
1db3ab5704 [Release-1.21] Secrets Encryption: Add RetryOnConflict around updating nodes (#5497)
* Add RetryOnConflict around updating nodes

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

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-04-21 09:24:24 -07:00
Brad Davidson
a8b9e7ef45 Fix initial start of etcd only nodes (#3748)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
(cherry picked from commit 2069cdf4ee)
2022-04-15 16:52:42 -07:00
Michal Rostecki
06fad1b0b7 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:41 -07:00
Brad Davidson
05a2ef7062 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:54 -07:00
Brad Davidson
b635663757 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:54 -07:00
Brad Davidson
6c08aab91d 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:54 -07:00
Brad Davidson
405ca3ca24 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:54 -07:00
Brad Davidson
594509c773 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:54 -07:00
Brad Davidson
8183d25e37 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:54 -07:00
Brad Davidson
9ac2dc3137 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:54 -07:00
Brad Davidson
ab004371f6 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:54 -07:00
Brad Davidson
8fdd9a0d8c 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:54 -07:00
Brad Davidson
b8026bb6ae Improve config retrieval messages
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 5ab3590d9b)
2022-04-15 11:15:54 -07:00
Brad Davidson
8b90dc9640 Sync DisableKubeProxy into control struct
Sync DisableKubeProxy from cfg into control before sending control to clients,
as it may have been modified by a startup hook.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 869b98bc4c)
2022-04-15 11:15:54 -07:00
Brad Davidson
c82679c88a Wait until server is ready before configuring kube-proxy (#3716)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 90445bd581)
2022-04-15 11:15:54 -07:00
Roberto Bonafiglia
f37bb416fe Fixed flannel backend helper text
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-14 10:43:57 +02:00
Roberto Bonafiglia
5d2469f28e Updated wireguard-native options and added log message
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-11 12:24:52 +02:00
Roberto Bonafiglia
5ab5368fbb Added new flannel backend to use wireguard from flannel
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2022-04-11 12:24:43 +02:00
Euan Kemp
ce8af52f8d 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 12:24:31 +02:00
Brad Davidson
4eb3a48862 Skip setting up client tls when etcd server does not have tls enabled
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-03-30 01:06:46 -07:00
Brad Davidson
98036cedf4 Defragment etcd datastore before clearing alarms
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-03-28 09:28:36 -07:00
Brad Davidson
4ca1f94786 Fix etcd-only secrets encryption rotation
Improve feedback when running secrets-encrypt commands on etcd-only nodes, and
allow etcd-only nodes to properly restart when effecting rotation.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit e811689df9)
2022-03-25 15:08:58 -07:00
Brad Davidson
e2510617d3 Ensure that apiserver ready channel checks re-dial every time
Closing idle connections isn't guaranteed to close out a pooled connection to a
loadbalancer endpoint that has been removed. Instead, ensure that requests used
to wait for the apiserver to become ready aren't reused.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-03-23 13:23:54 -07:00
Brad Davidson
e373d42a4f go generate
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-03-18 23:31:36 -07:00
Brad Davidson
3cd7a46b8f Defer ensuring node passwords on etcd-only nodes during initial cluster bootstrap
This allows secondary etcd nodes to bootstrap the kubelet before an
apiserver joins the cluster. Rancher waits for all the etcd nodes to
come up before adding the control-plane nodes, so this needs to be
handled properly.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 38706eeec0)
2022-03-18 13:50:43 -07:00
Brad Davidson
e750ee5070 Close additional leaked GPRC clients
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-03-15 18:09:26 -07:00
Brad Davidson
e032704684 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:09:26 -07:00
Brad Davidson
e078a2902f Fix etcd-snapshot commands by making setup more consistent.
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit a7878db17f)
2022-03-15 18:09:26 -07:00
Brad Davidson
570ff6ebf7 Ignore cluster membership errors when reconciling from temp etcd
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 9a48086524)
2022-03-15 18:09:26 -07:00
Brad Davidson
198057ac05 Move temporary etcd startup into etcd module
Reuse the existing etcd library code to start up the temporary etcd
server for bootstrap reconcile. This allows us to do proper
health-checking of the datastore on startup, including handling of
alarms.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit e4846c92b4)
2022-03-15 18:09:26 -07:00
Brad Davidson
100f4d1948 Pass context in to embedded etcd so that it can be stopped
Partial cherry-pick from 29c8b238e5

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-03-15 18:09:26 -07:00
Brad Davidson
8fdaa0eaca Add function to clear local alarms on etcd startup
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 555087b9b8)
2022-03-15 18:09:26 -07:00
Brad Davidson
5a7f5fc951 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:09:26 -07:00
Brad Davidson
197092a972 Remove unnecessary copies of etcdconfig struct
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit a1b800f0bf)
2022-03-15 18:09:26 -07:00
Brad Davidson
3f6b5c19d4 Remove unnecessary copies of runtime struct
Several types contained redundant references to ControlRuntime data. Switch to consistently accessing this via config.Runtime instead.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 2989b8b2c5)
2022-03-15 18:09:26 -07:00
Derek Nola
3368116172 [Release-1.21] Populate EtcdConfig in runtime from datastore when etcd is disabled (#5229)
* Populate EtcdConfig in runtime from datastore when etcd is disabled (#5222)

Fixes issue with secrets-encrypt rotate not having any etcd endpoints
available on nodes without a local etcd server.

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

* Revert to old Kine naming

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

Co-authored-by: Brad Davidson <brad.davidson@rancher.com>
2022-03-08 11:38:28 -08:00
Derek Nola
0ec1c41cd5 Add --json flag for k3s secrets-encrypt status (#5127) (#5197)
* Add json flag for secrets-encrypt status

Signed-off-by: Derek Nola <derek.nola@suse.com>
2022-03-03 10:25:29 -08:00
Derek Nola
04d44d005e Create encryption hash file if it doesn't exist (#5168)
Signed-off-by: Derek Nola <derek.nola@suse.com>
2022-02-28 09:06:06 -08:00
Brian Downs
1232cbcc3a add ability to specify etcd snapshot list output format (#5132) (#5178) 2022-02-26 12:28:46 -07:00
Hussein Galal
471f5eb3db Upgrade to V1.21.10+k3s1 (#5137)
* Update to v1.21.10

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

* Upgrade treafik image to 2.6.1

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

* Upgrade treafik image in image-list

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

* add debug to download script

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

* Enable make generate to use dapper and standardize go and gzip versions (#4861)

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

* fix go generate

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

* fix deep copy generated file

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

* Update go.mod

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

Co-authored-by: Derek Nola <derek.nola@suse.com>
2022-02-20 20:48:06 +02:00
Manuel Buil
5efd5f938f Fix annoying netpol log
Signed-off-by: Manuel Buil <mbuil@suse.com>
2022-02-10 20:16:36 +01:00
Manuel Buil
47c3ce842c Merge pull request #5089 from manuelbuil/kube-router-lib-1.21
[Release 1.21] netpol: Use kube-router as a library
2022-02-08 08:17:36 +01:00
Michal Rostecki
9de183fb0e 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:49:35 +01:00
Derek Nola
f586916c5f Check for --kubeconfig flag with embedded kubectl (#5064) (#5074)
* Check for kubeconfig flag

Signed-off-by: Derek Nola <derek.nola@suse.com>
2022-02-07 10:49:04 -08:00
Derek Nola
42bc5612ff [Release-1.21] Add --server flag to k3s secrets-encrypt (#5054)
* Add server flag to access nonlocal/nondefault k3s server (#5016)

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

* Update gitignore

Signed-off-by: Derek Nola <derek.nola@suse.com>
2022-02-01 10:45:00 -08:00
Brad Davidson
03bba66760 Move containerd wait into exported function
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2022-01-25 13:10:14 -08:00
Roberto Bonafiglia
dc970d27ca Merge pull request #4982 from rbrtbnfgl/ipv6-nat_release-1.21
[Release 1.21] Add IPv6 NAT
2022-01-19 08:45:33 +01:00