Commit Graph

343 Commits

Author SHA1 Message Date
Brad Davidson
0f21471d95 Move snapshot-retention to EtcdSnapshotFlags in order to support loading from config
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 0b3593205a)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-03-07 17:25:43 -08:00
Brad Davidson
dbfb77c43c Fix issue with etcd node name missing hostname
* Set ServerNodeName in snapshot CLI setup
* Raise errer if ServerNodeName ends up empty some other way
* Fix status controller to use etcd node name annotation instead of prefix checking

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 82432a2df7)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-03-07 17:25:43 -08:00
Derek Nola
1c3795d1cf Rename AgentReady to ContainerRuntimeReady for better clarity
Signed-off-by: Derek Nola <derek.nola@suse.com>
2024-02-21 14:21:18 -08:00
Brooks Newberry
37a4429519 Update Kubernetes to v1.26.14 (#9490)
Signed-off-by: Brooks Newberry <brooks@newberry.com>
2024-02-15 13:14:17 -08:00
Hussein Galal
62448e1e27 Update flannel to v0.24.0 and remove multiclustercidr flag (#9075)
* update flannel to v0.24.0

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

* remove multiclustercidr flag

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

---------

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-02-11 17:14:47 +01:00
Brad Davidson
4379b27314 Bump kine and set NotifyInterval to what the apiserver expects
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit de825845b2)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-02-10 00:49:54 -08:00
Brad Davidson
b1453351e0 Fix ipv6 endpoint address selection for on-demand snapshots
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 8224a3a7f6)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-02-10 00:49:54 -08:00
Brad Davidson
d6355d7bea Add embedded registry implementation
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 37e9b87f62)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-01-11 19:10:42 -08:00
Brad Davidson
d15bd074f4 Add server CLI flag and config fields for embedded registry
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit ef90da5c6e)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-01-11 19:10:42 -08:00
Brad Davidson
bbcf71315b Add runtime checking of golang version
Forces other groups packaging k3s to intentionally choose to build k3s with an unvalidated golang version

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit b297996b92)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-01-11 19:10:42 -08:00
Brad Davidson
0831de59e9 Add support for containerd cri registry config_path
Render cri registry mirrors.x.endpoints and configs.x.tls into config_path; keep
using mirrors.x.rewrites and configs.x.auth those do not yet have an
equivalent in the new format.

The new config file format allows disabling containerd's fallback to the
default endpoint when using mirror endpoints; a new CLI flag is added to
control that behavior.

This also re-shares some code that was unnecessarily split into parallel
implementations for linux/windows versions. There is probably more work
to be done on this front but it's a good start.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit c45524e662)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-01-11 19:10:42 -08:00
Brad Davidson
3b40d860b8 Allow setting default-runtime on servers
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-12-08 18:20:01 -08:00
Flavio Castelli
a8cd920cf1 Added runtimes for wasm/crun/nvidia
Create a generic helper function that finds extra containerd runtimes.
The code was originally inside of the nvidia container discovery file.

Signed-off-by: Flavio Castelli <fcastelli@suse.com>

Discover the containerd shims based on runwasi that are already
available on the node.

The runtimes could have been installed either by a package manager or by
the kwasm operator.

Signed-off-by: Flavio Castelli <fcastelli@suse.com>

The containerd configuration on a Linux system now handles the nvidia
and the WebAssembly runtimes.

Signed-off-by: Flavio Castelli <fcastelli@suse.com>

Added runtime classes for crun/wasm/nvidia

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

Added default runtime flag

Signed-off-by: Vitor Savian <vitor.savian@suse.com>
2023-12-08 15:49:52 -03:00
Hussein Galal
2d2891ece4 Add warning for multiclustercidr flag (#8760)
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2023-11-16 23:20:27 +02:00
Harsimran Singh Maan
0c9b48f4ef Disable helm CRD installation for disable-helm-controller (#8702)
* Disable helm CRD installation for disable-helm-controller
    The NewContext package requires config as input which would
    require all third-party callers to update when the new go module
    is published.

    This change only affects the behaviour of installation of helm
    CRDs. Existing helm crds installed in a cluster would not be removed
    when disable-helm-controller flag is set on the server.

    Addresses #8701
* address review comments
* remove redundant check

Signed-off-by: Harsimran Singh Maan <maan.harry@gmail.com>
(cherry picked from commit abc2efdd57)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-11-16 09:56:05 -08:00
chenk008
c3a0f9c649 add agent flag disable-apiserver-lb (#8717)
* add node flag disable-agent-lb
* add agent flag disable-apiserver-lb

Co-authored-by: Brad Davidson <brad@oatmail.org>
Signed-off-by: chenk008 <kongchen28@gmail.com>
(cherry picked from commit b47cbbfd42)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-11-16 09:56:05 -08:00
Edgar Lee
4e77f40d59 Add --image-service-endpoint flag (#8279)
* Add --image-service-endpoint flag

Problem:
External container runtime can be set but image service endpoint is unchanged
and also is not exposed as a flag. This is useful for using containerd
snapshotters outside of the ones that have built-in support like
stargz-snapshotter.

Solution:
Add a flag --image-service-endpoint and also default image service endpoint to
container runtime endpoint if set.

Signed-off-by: Edgar Lee <edgarhinshunlee@gmail.com>
(cherry picked from commit fe18b1fce9)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-17 10:44:52 -07:00
Sean Yen
727071c6e8 Windows support
Signed-off-by: Sean Yen <seanyen@microsoft.com>
2023-10-16 23:15:28 +02:00
Derek Nola
c9ee52b4ee Use version.Program not K3s in log (#8655)
Signed-off-by: Derek Nola <derek.nola@suse.com>
2023-10-16 11:47:16 -07:00
Brad Davidson
ce5cd41631 Sort snapshots by time and key in tabwriter output
Fixes snapshot list coming out in non-deterministic order

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit a15b804e00)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-13 10:23:51 -07:00
Brad Davidson
09ab9b7e21 Store extra metadata and cluster ID for snapshots
Write the extra metadata both locally and to S3. These files are placed such that they will not be used by older versions of K3s that do not make use of them.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 7464007037)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-13 10:23:51 -07:00
Derek Nola
ad6579a43f [Release-1.26] Clear remove annotations on cluster reset (#8590)
* Use admin kubeconfig instead of supervisor for etcd snapshot CLI

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

* Skip creating CRDs and setting up event recorder for CLI controller context

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

* Don't export functions not needed outside the etcd package

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

* Reorganize Driver interface and etcd driver to avoid passing context and config into most calls

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

* Clear remove annotations on cluster reset; refuse to delete last member from cluster

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

---------

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Co-authored-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-11 16:17:44 -07:00
Derek Nola
8acba4a627 Server Token Rotation (#8577)
* Consolidate NewCertCommands
* Add support for user defined new token
* Add E2E testlets



* Ensure agent token also changes

Signed-off-by: Derek Nola <derek.nola@suse.com>
2023-10-10 09:45:36 -07:00
Roberto Bonafiglia
cfb2ef5e3a Fixed tailscale node IP dualstack mode in case of IPv4 only node
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2023-10-10 10:37:54 +02:00
Manuel Buil
8869aab229 Take IPFamily precedence based on order
Signed-off-by: Manuel Buil <mbuil@suse.com>
2023-10-02 18:40:30 +02:00
Manuel Buil
915120c1f0 ipFamilyPolicy:PreferDualStack for coredns and metrics-server
Signed-off-by: Manuel Buil <mbuil@suse.com>
2023-10-02 11:34:55 +02:00
Manuel Buil
3483aa87e7 Merge pull request #8465 from manuelbuil/vpnExtraArgs126
[Release-1.26] Add extraArgs to tailscale
2023-09-28 10:05:48 +02:00
Vitor Savian
3dd36d2012 Added error when cluster reset while using server flag
Signed-off-by: Vitor Savian <vitor.savian@suse.com>
2023-09-27 16:42:36 -03:00
Manuel Buil
76bee4bd55 Add extraArgs to tailscale
Signed-off-by: Manuel Buil <mbuil@suse.com>
2023-09-27 11:38:38 +02:00
Manuel Buil
f8f888f4b6 Include the interface name in the error message
Signed-off-by: Manuel Buil <mbuil@suse.com>
2023-09-26 11:07:44 +02:00
Brad Davidson
685aadb8ed Add new CLI flag to enable TLS SAN CN filtering
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-08-29 08:35:09 -07:00
Vitor Savian
bd98112cbd Fix for cluster-reset backup from s3 when etcd snapshots are disabled (#8155)
* Fixed when the user disable the etcd snapshots, but want to backup from s3

Signed-off-by: Vitor <vitor.savian@suse.com>
2023-08-10 16:34:08 -03:00
Derek Nola
60bd5c5b3f [Release-1.26] August Test Backports (#8126)
* Unit test for MustFindString (#8013)
* Consolidate CopyFile functions (#8079)
* Remove unnecessary E2E envs
* Cleanup unnecessary "sudo" in commands
* Add additonal s3 coverage clause

Signed-off-by: Derek Nola <derek.nola@suse.com>
2023-08-04 11:39:01 -07:00
Manuel Buil
a1ff4612e8 Fix tailscale bug with ip modes
Signed-off-by: Manuel Buil <mbuil@suse.com>
2023-08-02 11:43:08 +02:00
Vitor Savian
e200425876 Adding cli to custom klipper helm image (#7682)
Adding cli to custom klipper helm image

Signed-off-by: Vitor Savian <vitor.savian@suse.com>
(cherry picked from commit 0809187cff)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-07-07 16:28:01 -07:00
LeiLei
a704a12e23 Add --data-dir to the k3s certificate rotate-ca cli (#7791)
Need to add a cli flag for this. Also, should probably have config file loading support for the certificate commands.

Signed-off-by: leilei.zhai <leilei.zhai@qingteng.cn>
(cherry picked from commit 72d50b1f7c)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-07-07 13:18:45 -07:00
Denys Smirnov
729ce73fca Support setting control server URL for Tailscale.
This change enables the use of Headscale - open source implementation of the Tailscale control server.

Signed-off-by: Denys Smirnov <dennwc@pm.me>
2023-07-07 12:30:43 +02:00
Manuel Buil
3ee5c0c39d Check if we are on ipv4, ipv6 or dualStack when doing tailscale
Signed-off-by: Manuel Buil <mbuil@suse.com>
2023-07-06 11:12:30 +02:00
Brad Davidson
1853afe124 Create new kubeconfig for supervisor use
Only actual admin actions should use the admin kubeconfig; everything done by the supervisor/deploy/helm controllers will now use a distinct account for audit purposes.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 64a5f58f1e)
2023-06-12 10:53:09 -07:00
Manuel Buil
ab07b36ccd VPN PoC
Signed-off-by: Manuel Buil <mbuil@suse.com>
2023-06-09 19:11:36 +02:00
Brad Davidson
14ebfa814f Improve egress selector handling on agentless servers
Don't set up the agent tunnel authorizer on agentless servers, and warn when agentless servers won't have a way to reach in-cluster endpoints.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 31a6386994)
2023-05-10 17:37:14 -07:00
Manuel Buil
b8619527a2 Migrate netutil methods into /utils/net.go
Signed-off-by: Manuel Buil <mbuil@suse.com>
2023-05-05 07:23:41 +02:00
Derek Nola
5ddb3ccaff [Release-1.26] CLI + Config Enhancement (#7403)
* Handle multiple arguments with StringSlice flags (#7380)
* Cleanup server setup with util function

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

* Enable FindString to search dotD config files (#7323)
* Address multiple arg cases

Signed-off-by: Derek Nola <derek.nola@suse.com>
2023-05-02 15:09:35 -07:00
Roberto Bonafiglia
15ee88964b Added multiClusterCidr feature
Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
2023-03-14 18:30:52 +01:00
Brad Davidson
23d98cec22 Fix CACertPath stripping trailing path components
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-02-14 09:39:41 -08:00
Brad Davidson
3d146d2f1b Allow for multiple sets of leader-elected controllers
Addresses an issue where etcd controllers did not run on etcd-only nodes

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-02-10 10:46:48 -08:00
Brad Davidson
32d62c5786 Use default address family when adding kubernetes service address to SAN list
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-02-09 15:17:21 -08:00
Byron Ruth
a92f163c9d Add NATS to the list of supported data stores (#6876)
Signed-off-by: Byron Ruth <byron@nats.io>
2023-02-08 09:37:23 -08:00
Brad Davidson
992e64993d Add support for kubeadm token and client certificate auth
Allow bootstrapping with kubeadm bootstrap token strings or existing
Kubelet certs. This allows agents to join the cluster using kubeadm
bootstrap tokens, as created with the `k3s token create` command.

When the token expires or is deleted, agents can successfully restart by
authenticating with their kubelet certificate via node authentication.
If the token is gone and the node is deleted from the cluster, node auth
will fail and they will be prevented from rejoining the cluster until
provided with a valid token.

Servers still must be bootstrapped with the static cluster token, as
they will need to know it to decrypt the bootstrap data.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-02-07 14:55:04 -08:00
Brad Davidson
373df1c8b0 Add support for k3s token command
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-02-07 14:55:04 -08:00