Commit Graph

1240 Commits

Author SHA1 Message Date
Lex Rivera
080ec8148d Add more paths to crun runtime detection (#9086)
* add usr/local paths for crun detection

Signed-off-by: Lex Rivera <me@lex.io>
(cherry picked from commit 5fe074b540)
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
915095fe1c Fix nil map in full snapshot configmap reconcile
If a full reconcile wins the race against sync of an individual snapshot resource, or someone intentionally deletes the configmap, the data map could be nil and cause a crash.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 319dca3e82)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-01-11 19:10:42 -08:00
Brad Davidson
c51aa9eb09 Handle logging flags when parsing kube-proxy args
Also adds a test to ensure this continues to work.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit db7091b3f6)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-01-11 19:10:42 -08:00
Brad Davidson
1765646550 Fix the OTHER log message that prints the wrong variable
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 1e663622d2)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-01-11 19:10:42 -08:00
Brad Davidson
cf82b4033f Add ServiceLB support for PodHostIPs FeatureGate
If the feature-gate is enabled, use status.hostIPs for dual-stack externalTrafficPolicy=Local support

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit a27d660a24)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-01-11 19:10:42 -08:00
Brad Davidson
a70399b0d0 Remove GA feature-gates (#8970)
Remove KubeletCredentialProviders and JobTrackingWithFinalizers feature-gates, both of which are GA and cannot be disabled.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 231cb6ed20)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2024-01-11 19:10:42 -08:00
Vitor Savian
724fb0d6e2 Handle etcd status condition when cluster reset and disable etcd
Signed-off-by: Vitor Savian <vitor.savian@suse.com>

Set condition if node is unhealthy

Signed-off-by: Vitor Savian <vitor.savian@suse.com>
2024-01-09 12:00:33 -03:00
Manuel Buil
e7f9175fe7 Wait for taint to be gone in the node before starting the netpol controller
Signed-off-by: Manuel Buil <mbuil@suse.com>
2024-01-09 09:59:33 +01:00
Derek Nola
140345869d Added support for env *_PROXY variables for agent loadbalancer (#9116)
Signed-off-by: Yodo <pierre@azmed.co>
Signed-off-by: Derek Nola <derek.nola@suse.com>
Co-authored-by: Pierre <129078893+pierre-az@users.noreply.github.com>
2024-01-06 19:58:34 -07:00
Derek Nola
8a00e7ab32 Add a retry around updating a secrets-encrypt node annotations (#9123)
* Add a retry around updating a se node annotations

Signed-off-by: Derek Nola <derek.nola@suse.com>
2024-01-04 09:51:30 -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
Brad Davidson
8690ab0de7 Bump containerd/runc to v1.7.10-k3s1/v1.1.10
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-12-08 18:17:39 -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
Brad Davidson
6c6b275503 Print key instead of file path in snapshot metadata log message
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-11-21 15:23:32 -08:00
Brad Davidson
e48cc250b3 Don't apply s3 retention if S3 client failed to initialize
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-11-21 15:23:32 -08:00
Brad Davidson
2ecafd94b4 Don't request metadata when listing objects
While some implementations may support it, it appears that most don't,
and some may in fact return an error if it is requested.

We already stat the object to get the metadata anyway, so this was
unnecessary if harmless on most implementations.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-11-21 15:23:32 -08:00
Brad Davidson
39878deab5 Reorder snapshot configmap reconcile to reduce log spew during initial startup
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-11-17 19:47:23 -08:00
Manuel Buil
280a0ee8b1 Improve dualStack log
Signed-off-by: Manuel Buil <mbuil@suse.com>
2023-11-17 09:17:52 +01:00
Vitor Savian
fcdfbd5d3c Handle nil pointer when runtime core is not ready in etcd
Signed-off-by: Vitor <vitor.savian@suse.com>
2023-11-16 15:58:24 -08: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
Brad Davidson
b723eea80c Go generate
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-11-16 09:56:05 -08:00
Brad Davidson
dba56d046c Add jitter to client config retry
Also:
* Replaces labeled for/continue RETRY loops with wait helpers for improved readability
* Pulls secrets and nodes from cache for node password verification
* Migrate nodepassword tests to wrangler mocks for better code reuse

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-11-16 09:56:05 -08: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
Jason Costello
fa3f5ee868 Tweaked order of ingress IPs in ServiceLB (#8711)
* Tweaked order of ingress IPs in ServiceLB
    Previously, ingress IPs were only string-sorted when returned
    Sorted by IP family and string-sorted in each family as part of
    filterByIPFamily method
* Update pkg/cloudprovider/servicelb.go
* Formatting

Signed-off-by: Jason Costello <jason@hazy.com>
Co-authored-by: Brad Davidson <brad@oatmail.org>
(cherry picked from commit 07ee854914)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-11-16 09:56:05 -08:00
Brad Davidson
b61aae1764 Skip initial datastore reconcile during cluster-reset
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 7ecd5874d2)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-11-16 09:56:05 -08:00
Brad Davidson
822cbf7163 Fix issue with snapshot metadata configmap
Omit snapshot list configmap entries for snapshots without extra metadata; reduce log level of warnings about missing s3 metadata files.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 2088218c5f)
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
Oliver Larsson
67c0ab6aed QoS-class resource configuration
Problem:
Configuring qos-class features in containerd requres a custom containerd configuration template.

Solution:
Look for configuration files in default locations and configure containerd to use them if they exist.

Signed-off-by: Oliver Larsson <larsson.e.oliver@gmail.com>
(cherry picked from commit 30c8ad926d)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-11-16 09:56:05 -08:00
Vitor Savian
8ca155edd2 Added etcd status condition
* Added ADR for etcd status

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

* Added etcd status condition

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

---------

Signed-off-by: Vitor <vitor.savian@suse.com>
2023-11-16 04:19:35 -08:00
Hussein Galal
cb5cb5557f Update traefik to fix registry value (#8790)
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2023-11-07 00:39:38 +02:00
Hussein Galal
2d883cd537 [release-1.26] Update traefik chart to v25.0.0 (#8776)
* Upgrade traefik chart to v25.0.0

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

* go generate

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

---------

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2023-11-03 18:54:52 +02:00
Derek Nola
ab100ad17a Fix SystemdCgroup in templates_linux.go (#8766)
Signed-off-by: Derek Nola <derek.nola@suse.com>
2023-11-02 13:41:34 -07:00
Brad Davidson
a6687b59e1 Don't try to read token hash and cluster id during cluster-reset
These fields are only necessary when saving snapshots to S3, and will block restoration if attempted

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-27 15:07:02 -07:00
Brad Davidson
43d998604f Manually requeue configmap reconcile when no nodes have reconciled snapshots
Silences error message from lasso - this is a normal startup condition
when no snapshots exist so we shouldn't log nasty looking errors.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-18 17:13:27 -07:00
Brad Davidson
8222767428 Re-enable etcd endpoint auto-sync
Removing this in 002e6c43ee regressed
control-plane-only nodes, as we rely on the etcd client to update its
endpoint list internally so that we can use it to sync the load-balancer
address list.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-18 17:13:27 -07: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
9d5873bbe3 Start etcd client before ensuring self removal
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-14 00:39:33 -07:00
Brad Davidson
931efc4b7d Bump traefik, golang.org/x/net, google.golang.org/grpc
Fixes exposure to CVE-2023-39325

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-13 10:23:51 -07:00
Brad Davidson
ff8193b9bd Add server token hash to CR and S3
This required pulling the token hash stuff out of the cluster package, into util.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit d885162967)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-13 10:23:51 -07:00
Brad Davidson
e3ea7b7445 Switch to managing ETCDSnapshotFile resources
Reconcile snapshot CRs instead of ConfigMap; manage ConfigMap downstream from CR list

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 550ab36ab7)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-13 10:23:51 -07:00
Brad Davidson
26db504dd7 Move snapshot delete into local/s3 functions
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 5cd4f69bfa)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-13 10:23:51 -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
Brad Davidson
d3335b5093 Move s3 snapshot list functionality to s3.go
Also, don't list ONLY s3 snapshots if S3 is enabled.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 80f909d0ca)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-13 10:23:51 -07:00
Brad Davidson
7c9a1f3535 Consistently set snapshotFile timestamp
Attempt to use timestamp from creation or filename instead of file/object modification times

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 8d47645312)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-13 10:23:51 -07:00
Brad Davidson
2459d99cbc Tidy s3 upload functions
Consistently refer to object keys as such, simplify error handling.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit f1afe153a3)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-13 10:23:51 -07:00
Brad Davidson
d1f2836375 Elide old snapshot data when apiserver rejects configmap with ErrRequestEntityTooLarge
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 2b0e2e8ada)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-10-13 10:23:51 -07:00