Commit graph

425 commits

Author SHA1 Message Date
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
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
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
795091a809 Wire up kine metrics
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-08-27 13:41:16 -07:00
Brad Davidson
0ec47408e9 Do not bootstrap etcd-only nodes from existing supervisor
Changes to how we bootstrap the agent and apiserver address list have
made this unnecessary since 5014c9e was merged, and it is creating
problems due to only etcd-only nodes not using their own config.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-08-25 22:16:48 -07:00
Vitor Savian
a238f33cdd
Add retention flag specific for s3
* Add retention flag specific for s3
* Add retention for the unit tests:

Signed-off-by: Vitor Savian <vitor.savian@suse.com>
2025-07-28 13:42:09 -03:00
Brad Davidson
5ce3db779d Update kine and use config defaults helper
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-07-11 10:10:13 -07:00
Vitor Savian
66102c5651
Refac shell completion to a better command structure
* Refac for shell completion

Signed-off-by: Vitor Savian <vitor.savian@suse.com>

* Change FLAGS to OPTIONS

Signed-off-by: Vitor Savian <vitor.savian@suse.com>

* Refac bash and zsh func names

Signed-off-by: Vitor Savian <vitor.savian@suse.com>

* Refac bash and zsh func names

Signed-off-by: Vitor Savian <vitor.savian@suse.com>

---------

Signed-off-by: Vitor Savian <vitor.savian@suse.com>
2025-07-10 13:38:54 -03:00
Manuel Buil
e6e301959f
Add usage description for etcd-snapshot (#12557) 2025-07-02 09:24:13 -07:00
haruna
d256968ee4 Improve shebang of bash completion script
Signed-off-by: haruna <w10776e8w@yahoo.co.jp>
2025-05-30 10:18:42 -07:00
Brad Davidson
dad64705d3 Fix startuphooks race condition panic
Ensure startup hooks WaitGroup is initialized before starting goroutine that will wait on it

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-05-15 14:27:40 -07:00
Brad Davidson
10e3d40bf3 Sync datastore config defaults with kine CLI
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-05-09 15:32:53 -07:00
bo.jiang
4c1f014d27 Optimize certificate status check
Signed-off-by: bo.jiang <bo.jiang@daocloud.io>
2025-05-08 11:57:29 -07:00
Brad Davidson
a8f0acbe52 Add CLI flag and config file for s3 bucket lookup type
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-05-07 11:50:22 -07:00
Vitor Savian
dc03cb4b3f
Update k8s version to 1.33
* Update to 1.33

Signed-off-by: Vitor Savian <vitor.savian@suse.com>

* Fix prints that broke unit tests

Signed-off-by: Vitor Savian <vitor.savian@suse.com>

* Change binary max size to 75

Signed-off-by: Vitor Savian <vitor.savian@suse.com>

* Change containerd version to fix misspelling

Signed-off-by: Vitor Savian <vitor.savian@suse.com>

* Address binary size comment

Signed-off-by: Vitor Savian <vitor.savian@suse.com>

* Update Dependencies

Signed-off-by: Vitor Savian <vitor.savian@suse.com>

* Remove dependencie not used anymore

Signed-off-by: Vitor Savian <vitor.savian@suse.com>

---------

Signed-off-by: Vitor Savian <vitor.savian@suse.com>
2025-04-30 04:43:37 -03:00
manuelbuil
9505f7ff3b Add error in certificate check
Signed-off-by: manuelbuil <mbuil@suse.com>
2025-04-10 13:22:43 +02:00
Derek Nola
fa69c45926 Align Value CLI
Signed-off-by: Derek Nola <derek.nola@suse.com>
2025-04-07 09:08:22 -07:00
Derek Nola
786efd1bff Mark rotate-keys as GA
Signed-off-by: Derek Nola <derek.nola@suse.com>
2025-04-07 09:08:22 -07:00
Derek Nola
aea3703f68 Implement secrets-encryption secretbox provider
- Add testlet for new provider switch
- Handle migration between providers
- Add exception for criticalcontrolargs
Signed-off-by: Derek Nola <derek.nola@suse.com>
2025-04-07 09:08:22 -07:00
Brad Davidson
ee036f7bc9 Fix issue caused by default authorization-mode apiserver arg
Move arg-parsing helper functions into util, and use them to see if the user has set an authorization-config flag - and do not set authorization-mode if so.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-03-31 17:09:43 -07:00
Brad Davidson
d45006be66 Move etcd ready channel into executor
This eliminates the final channel that was being passed around in an internal struct. The ETCD management code passes in a func that can be polled until etcd is ready; the executor is responsible for polling this after etcd is started and closing the etcd ready channel at the correct time.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-03-24 12:42:29 -07:00
Brad Davidson
a8bc412422 Move container runtime ready channel into executor
Move the container runtime ready channel into the executor interface, instead of passing it awkwardly between server and agent config structs

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-03-24 12:42:29 -07:00
Brad Davidson
529e748ac7 Move apiserver ready wait into common channel
Splits server startup into prepare/start phases. Server's agent is now
started after server is prepared, but before it is started. This allows
us to properly bootstrap the executor before starting server components,
and use the executor to provide a shared channel to wait on apiserver
readiness.

This allows us to replace four separate callers of WaitForAPIServerReady
with reads from a common ready channel.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-03-24 12:42:29 -07:00
Derek Nola
ac38633c71
Migrate to UrfaveCLI v2 (#11831)
* Bump rootlesskit tov 1.1.1, last of the v1 line
* Migrate to urfavecli v2
* Disable StringSlice seperattion

Signed-off-by: Derek Nola <derek.nola@suse.com>
2025-03-12 09:02:45 -07:00
Brad Davidson
d694dd1db9 Add periodic background snapshot reconcile
Interval is configurable with new etcd-snapshot-reconcile-interval flag

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-03-05 12:18:19 -08:00
Brad Davidson
bed1f66880 Avoid use of github.com/pkg/errors functions that capture stack
We are not making use of the stack traces that these functions capture, so we should avoid using them as unnecessary overhead.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-03-05 00:41:38 -08:00
Brad Davidson
5894af30ff Move CR APIs to k3s-io/api
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-02-24 11:17:27 -08:00
Brad Davidson
124e46bccf Upgrade containerd to v2.0.2
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-02-07 12:03:48 -08:00
Brad Davidson
85987ac23f Fix default pause image on windows
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-02-07 07:46:19 -08:00
Brad Davidson
838d68777f Fix permissions checks on windows
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-02-07 07:46:19 -08:00
Brad Davidson
0d028a2283 Add support for AWS shared credentials file
Also adds a CLI flag and fields for session token, which must be passed
alongside the access key and secret when using temporary credentials.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-01-29 00:45:56 -08:00
manuelbuil
2b00ef5b46 Correct the k3s token command help
Signed-off-by: manuelbuil <mbuil@suse.com>
2025-01-29 07:46:58 +01:00
Maja Bojarska
646e3135bc Align etcd-snapshot-dir default path description
The effective snapshot dir is "${data-dir}/server/db/snapshots". The
server segment is missing in the CLI-reported default path, potentially
misleading the user about the actual default snapshot destination.

Signed-off-by: Maja Bojarska <majabojarska98@gmail.com>
2025-01-13 11:32:56 -08:00
Brad Davidson
2e4e7cf2c1 Move request handlers out of server package
The servers package, and router.go in particular, had become quite
large. Address this by moving some things out to separate packages:
* http request handlers all move to pkg/server/handlers.
* node password bootstrap auth handler goes into pkg/nodepassword with
  the other nodepassword code.

While we're at it, also be more consistent about calling variables that
hold a config.Control struct or reference `control` instead of `config` or `server`.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-01-09 00:51:19 -08:00
Derek Nola
c3460fce73
Add "k3s certificate check" clause for better test coverage (#11485)
* Add "k3s certificate check" clause for better test coverage

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

* Add table support to cert check

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

---------

Signed-off-by: Derek Nola <derek.nola@suse.com>
2025-01-07 10:19:23 -08:00
Hyouka
e64e2fcfd4
add IPv6 to cluster-dns Usage Docs (#11498)
Signed-off-by: rivolity <hamdaouiomar1@gmail.com>
2025-01-03 09:30:31 -08:00
Brad Davidson
e143e0fa12 Add hidden flag/var for supervisor/apiserver listen config
Add flags supervisor and apiserver ports and bind address so that we can add an e2e to cover supervisor and apiserver on separate ports, as used by rke2

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-12-10 09:31:18 -08:00
Derek Nola
69c310d68b
Remove experimental from embedded-registry flag (#11443)
Signed-off-by: Derek Nola <derek.nola@suse.com>
2024-12-10 08:37:13 -08:00
Brad Davidson
71918e0d69 Use helper to set consistent rest.Config rate limits and timeouts
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-12-06 11:45:34 -08:00
Brad Davidson
56fb3b0991 Add nonroot-devices flag to agent CLI
Add new flag that is passed through to the device_ownership_from_security_context parameter in the containerd CRI config. This is not possible to change without providing a complete custom containerd.toml template so we should add a flag for it.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-11-05 11:36:55 -08:00
Brad Davidson
bc60ff79f6 Set kine EmulatedETCDVersion from embedded etcd version
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-11-05 09:07:11 -08:00
Brad Davidson
c9e7b05971 Bump kine
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-10-03 10:54:03 -07:00
Arne Winter
c4c11e51f1
add node-internal-dns/node-external-dns address pass-through support (#10852)
* add --node-internal-dns and --node-external-dns

Signed-off-by: Arne Winter <github@arnewinter.dev>
Co-authored-by: Brad Davidson <brad@oatmail.org>
2024-09-06 14:15:19 -07:00
galal-hussein
20b50426ab Update to v1.31.0
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-08-22 14:23:34 -07:00
Brad Davidson
9111b1f77e Add K3S_DATA_DIR as env var for --data-dir flag
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-07-29 15:23:52 -07:00
Brad Davidson
37830fe170 Don't use server and token values from config file for etcd-snapshot commands
Fixes an issue where running etcd-snapshot commands on a node that has a server address set in the config will manage snapshots on that server, instead of on the local node as intended.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-07-15 10:12:50 -07:00
Brad Davidson
c36db53e54 Add etcd s3 config secret implementation
* Move snapshot structs and functions into pkg/etcd/snapshot
* Move s3 client code and functions into pkg/etcd/s3
* Refactor pkg/etcd to track snapshot and s3 moves
* Add support for reading s3 client config from secret
* Add minio client cache, since S3 client configuration can now be
  changed at runtime by modifying the secret, and don't want to have to
  create a new minio client every time we read config.
* Add tests for pkg/etcd/s3

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-07-10 13:13:55 -07:00