Commit graph

1629 commits

Author SHA1 Message Date
Brad Davidson
d582a0da84 Reorganize flannel consts and fields
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-08 12:53:10 -08:00
Brad Davidson
d1989567ea Use patch helper for secrets-encryption labels and annotations
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-08 12:53:10 -08:00
Brad Davidson
1cb80fbe75 Use patch helper for spegel annotations and labels
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-08 12:53:10 -08:00
Brad Davidson
57210b87cc Use patch helper for node labels and annotations
Move flannel annotations into flannel setup, and use patch helpers to manage other node labels and annotations

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-08 12:53:10 -08:00
Brad Davidson
713cf8fbde Use patch helper for etcd labels and annotations
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-08 12:53:10 -08:00
Brad Davidson
2b39b6808a Use patch helper for etcd member controller
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-08 12:53:10 -08:00
Brad Davidson
785cfad963 Use patch helper for etcd snapshot annotation patch
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-08 12:53:10 -08:00
Brad Davidson
ceebaade3e Add JSON patch helper
Adds helper function for building JsonPatch operation lists,
which allows modifying a resource without having to manually
refresh the object and retry the change on conflict.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-08 12:53:10 -08:00
Brad Davidson
efcf8eb7ac Move embedded flannel and vpn config setup into embedded executor
Flannel and VPN setup shouldn't be done in generic agent config as it is only
used with embeded executor's flannel CNI.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-08 12:53:10 -08:00
Brad Davidson
ec3cc04214 Move CNI execution into executor
Allows properly delegating CNI startup to executor, so that it can be plugged in as platform and distro specific implimentation without relying on cli flag hacks

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-08 12:53:10 -08:00
Brad Davidson
b7ca944774 Move etcd metrics to separate package
Allows importing pkg/metrics without pulling in pkg/etcd, which was causing an import loop in a follow-up commit.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-08 12:53:10 -08:00
Derek Nola
543b6307a6
Define DefaultHelmJobImage in K3s, overriding what helm-controller defaults to. (#13258)
Signed-off-by: Derek Nola <derek.nola@suse.com>
2025-12-08 12:44:05 -08:00
Brad Davidson
f783052df2 Fix airgap-extra-registry flag
It is hidden and undocumented, but also apparently broken.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-11-21 09:25:00 -08:00
Brad Davidson
1037dcbff4 Add digests and source labels for imported images
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-11-21 09:25:00 -08:00
Brad Davidson
9806524a48 Fix spegel ready checks to give server more time to find a peer
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-11-21 09:25:00 -08:00
Brad Davidson
f0d54528d0 Stop waiting on CRI ready if context is cancelled
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-11-21 09:25:00 -08:00
jvassev
913005658c
tunnel: handle pod IP reuse (#13212)
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
* tunnel: handle pod IP reuse

a valid tunnel/session may be deleted when an IP is reused while a
Complete pod (for example a job) was using that IP but is being gc'ed.

This causes timeouts to webhooks after directDial is attempted because
session was removed.

Solution is to track the owner of the IP and delete the entry only when
the the owner pod is deleted.

Signed-off-by: Julian Vassev <jvassev@gmail.com>
2025-11-19 20:43:36 -08:00
Brad Davidson
ed57fb5e61
Fix windows build os (#13201)
Some checks failed
govulncheck / govulncheck (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
* Pass GOOS into Dockerfile.local build args
  Fixes issue with build-windows job not actually building for windows
* Remove `go generate` from package-cli
  We no longer use codegen in this repo
* Fix go:embed path separator on Windows
* Bump hcsshim for containerd 2.1 compat on windows
* Include failing lister in error message
* Bump k3s-io/api and k3s-io/helm-controller for embedded CRD windows path fix

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-11-15 02:02:12 -08:00
Roberto Bonafiglia
3530ab5915 Fix tailscale setup in case of an already running configuration
Some checks are pending
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2025-11-11 12:58:21 +01:00
Brad Davidson
7146e2000e Fix apiserver starting before remote etcd is up
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Fixes issue where the apiserver on control-plane-only nodes does not
actually wait for a connection to etcd to be available before starting.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-11-07 10:32:02 -08:00
Brad Davidson
858b109b92 Fix adding OwnerReferences to Nodes seen from initial list
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
govulncheck / govulncheck (push) Has been cancelled
Apparently Kubernetes objects may not have TypeMeta (APIVersion and Kind) fields set if they come from a List response - so we can't count on the objects passed to the handler having these properly set.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-11-06 19:41:14 -08:00
Brad Davidson
d8790220ff Move node password secrets into dedicated controller
Some checks are pending
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Move the node password secret cleanup into its own dedicated controller
that also handles auth. We now use a filtered cache of only
node-password secrets, instead of using the wrangler secret cache,
which stores all secrets from all namespaces.

The coredns node-hosts controller also now uses a single-resource
watch cache on the coredns configmap, instead of reading it from
the apiserver every time a node changes.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-10-27 15:06:45 -07:00
Brad Davidson
139d64c129 Create node-password secrets with custom Type
Allows list/watch node password secrets with fieldselector

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-10-27 15:06:45 -07:00
Brad Davidson
d622b18c20 Remove node password file migration code
K3s stopped using node password files in v1.19 (92d04355f4), so we do not need to support migrating off these any longer.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-10-27 15:06:45 -07:00
Brad Davidson
0d9ef273d8 Remove node addresses from filter when node is deleted
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-10-27 15:06:45 -07:00
Brad Davidson
171644cf0c Replace raw ListWatch with NewListWatchFromClient
NewListWatchFromClient replaces a bunch of boilerplate, and is also context-aware

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-10-27 15:06:45 -07:00
Jarett Stevens
6381cad10f rootless ports: add support for udp
Some checks are pending
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Signed-off-by: Jarett Stevens <jarett.stevens@gmail.com>
2025-10-20 10:44:18 -07:00
Roberto Bonafiglia
09762a57df Update flannel, kube-router and cni plugins
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2025-10-08 09:31:31 +02:00
Brad Davidson
89adabb672 Drop calls to rand.Seed
The rng has been automatically seeded since go1.20, and explicitly seeding it has been a no-op since go1.24. Ref: https://go.dev/doc/godebug#go-120 and https://go.dev/doc/godebug#go-124

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-10-02 09:47:25 -07:00
Brad Davidson
7a41cce152 Fix ability to rotate server token to an invalid format
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-30 10:16:04 -07:00
Ashiq N
565d50a3b1 Create dynamic-cert-regenerate file in CA cert rotation handler
Signed-off-by: Ashiq N <ashiqmoh70@gmail.com>
2025-09-30 10:10:56 -07:00
Brad Davidson
6edbae331b Fix bootstrap charts
Use https port for helm-controller bootstrap charts instead of apiserver internal port, which does not listen on all address families in K3s since it is just set to avoid having the apiserver conflict with the supervisor port.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-30 09:53:43 -07:00
Brad Davidson
d6e84ba2d1 Fix kine metrics registration without --kine-tls
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-24 15:18:34 -07:00
Brad Davidson
8347597031 Bump spegel to v0.4.0
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-24 09:55:04 -07:00
Brad Davidson
bfdcc7bcc8 Fix etcd member promotion
The `continue` was incorrectly changed to `return` when converting the
loop to an inline function in 4974fc7c24

Also addresses unnecessary creation of a new kubernetes client every
time the promotion check runs.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-18 16:31:15 -07:00
Derek Nola
14e919804d
Fix garbled CLI (#12899)
Signed-off-by: Derek Nola <derek.nola@suse.com>
2025-09-17 11:27:35 -07:00
Brad Davidson
4974fc7c24 Use sync.WaitGroup to avoid exiting before components have shut down
Currently only waits on etcd and kine, as other components
are stateless and do not need to shut down cleanly.

Terminal but non-fatal errors now request shutdown via context
cancellation, instead of just logging a fatal error.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-17 09:37:08 -07:00
Brad Davidson
7e028854e7 Fix signal handling when pid 1
When running K3s as a subprocess for reaping or logging purposes, properly wire up signals to send it SIGINT instead of just exiting immediately.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-17 09:37:08 -07:00
Brad Davidson
274498fb4d Add pkg/signals for signal handler setup
Adds some additional functionality and prevents having to take a dep on wrangler in CLI code

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-17 09:37:08 -07:00
Brad Davidson
b61d6f3b81 Transfer cluster leadership before removing leader member
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-17 09:37:08 -07:00
Brad Davidson
659f2a7014 Fix perpetual etcd member removal
Fixes issue where member removal would be requeud until the node was deleted, or rejoined with a new name.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-17 09:37:08 -07:00
Brad Davidson
a7d3c8559f Fix IPv6 handling for loadbalancer addresses
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-16 11:04:22 -07:00
Brad Davidson
7e253dbf02 Fix netpol fatal error when changing node IP
Wait for updated ready condition before starting netpol controller, to ensure that node IPs have been updated following a restart. The current checks only ensure that the taint is removed, which works for the initial join - but does not handle changing node IPs on restarts.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-10 10:27:52 -07:00
Brad Davidson
f3a036a9b1
Bump kine for compact_rev_key watch fix
Fix apiserver-managed compact, and enable it

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-05 00:04:41 +00:00
Derek Nola
9314d84714
Bump grpc and update resolver
Signed-off-by: Derek Nola <derek.nola@suse.com>
2025-09-04 17:33:42 -06:00
Derek Nola
56ef1cd3a2
Update etcd to v3.6.4-k3s3
* Raft is now an independent dependency, with a seperate release version
* errors moved into their own subpackage
* set a default WarningUnaryRequestDuration

Signed-off-by: Derek Nola <derek.nola@suse.com>
Co-authored-by: Michael Fritch <mfritch@suse.com>
2025-09-04 17:33:10 -06:00
Michael Fritch
f248751dbd
make format 2025-09-04 14:41:58 -06:00
Brad Davidson
c837bfcdc7 Bump kine for metrics panic fix
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-03 09:52:51 -07:00
Brad Davidson
d08bf6c9b6 Wire up remotedialer metrics
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-08-27 13:42:17 -07:00
Brad Davidson
f1c82392d0 Fix etcd join timeout handling
Error is deadline exceeded, not cancelled

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-08-27 13:41:54 -07:00