Commit Graph

34 Commits

Author SHA1 Message Date
Marcus Ramberg
0aa644e317
k3s_1_31: 1.31.1+k3s1 -> 1.31.2+k3s1 (#352182) 2024-11-16 09:42:43 +01:00
Robert Rose
2a79402b1e nixos/k3s: use same k3s package in multi-node test
The test previously violated the Kubernetes version skew policy by
deploying a kubelet of hte most recent version in a cluster with an
older apiserver.
2024-11-14 16:04:29 -03:00
superherointj
7011a66b4d nixos/tests/k3s/etcd: add etcd health check 2024-10-31 10:54:17 -03:00
Artturin
e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
superherointj
e9002b6b54 nixosTests.k3s.{single-node,multi-node}: nixfmt 2024-09-20 13:08:41 -03:00
superherointj
05e13bffe1 nixosTests.k3s.{single-node,multi-node}: enable check-config for aarch64 2024-09-20 12:54:58 -03:00
Robert Rose
d506595e43 nixos/k3s: use jq instead of JSONpath to process test data
Although kubectl has builtin JSONpath support, it is only supported
partially and the support varies between different versions. While using
JSONpath in tests worked for some versions, it failed for others. This
contribution replaces the problematic JSONpath usages with the jq JSON
processor.
2024-08-16 08:37:15 +02:00
Robert Rose
69e2e82ba0 nixos/k3s: increase timeout in tests
Increase the timout for the import of container images in the `airgap-images`
test from 60s to 120s to counter flaky tests.
2024-08-14 21:01:19 +02:00
Tom McLaughlin
81c0783c0e nixos/k3s: add containerdConfigTemplate option 2024-08-12 14:58:18 -07:00
Robert Rose
3ac993566c nixos/k3s: add test for airgap images import
Add a nixos test that imports the airgap images
archive and checks whether all expected images are
successfully loaded by k3s.
2024-07-30 21:14:25 +02:00
Robert Rose
eeacf85fb9 k3s: add airgap images to passthru attributes
The k3s update script filters the assets of a
corresponding release for airgap images archives
and provides these as passthru attributes of the
k3s derivation. We use zstd archives, as these
offer the best compression ratios and decompression
speed. Furthermore, the `airgapImages` passthru
provides the images archive that matches the host
platform architecture, however, this only works
for aarch64 and x86_64. In addition, a txt file
listing all container images of a release is made
available via a passthru attribute. The airgap
images archives can be combined nicely with the
`services.k3s.images` option, e.g. to pre-provision
k3s nodes for environments without Internet
connectivity.
2024-07-30 21:14:17 +02:00
Robert Rose
c58c1e8f55 nixos/k3s: add options for graceful node shutdown and kubelet config
Allow to set kubelet configuration parameters
via an option. Additionally, expose the
respective options for graceful node
shutdown directly, as it is anticipated to
be used frequently.
2024-07-19 20:28:00 +02:00
Robert Rose
cc2790ff1e nixos/k3s: accept a list of extraFlags
Accept a list of strings for the extraFlags
option in addition to the previous single
string.
2024-07-16 08:20:32 +02:00
superherointj
e3e012325b k3s/tests/auto-deploy: fix race condition
Co-authored-by: wrmilling marcusramberg
2024-07-12 17:58:00 -03:00
superherointj
b298bbfce0 k3s/nixos/tests: move comments to test (clean-up) 2024-07-12 17:58:00 -03:00
superherointj
5266d2da66 k3s/tests/auto-deploy: fix auto-deploy reference
* re-establish alphabetical order
* fix typo on comment
2024-07-12 10:06:45 -03:00
superherointj
bbc168ab4c k3s: use team for maintainers 2024-07-12 09:30:38 -03:00
Robert Rose
a64423c745 nixos/k3s: extend k3s module
This contribution extends the k3s module to
enable the usage of Helm charts and container
images in air-gapped environments. Additionally,
the manifests option allows to specify arbitrary
manifests that are deployed by k3s automatically.
It is now possible to deploy Kubernetes workloads
using the k3s module.
2024-06-25 17:09:12 +02:00
superherointj
6cfcd3c754 k3s: format with nixfmt-rfc-style 2024-05-10 18:55:54 -03:00
Robert Rose
2b0b15ec94 k3s: package k3s-killall script
Provide the k3s-killall.sh script for orderly shutdown of k3s.
2024-05-07 11:53:15 +02:00
superherointj
56b4159e23 nixos/tests/k3s: sync meta.maintainers to k3s package 2024-03-23 19:55:00 -03:00
superherointj
1930ecaa74 nixos/k3s: add test for etcd backend 2024-02-19 18:39:57 -03:00
Demitri Tzitzon
d629ca54b2 k3s: symlinks for kubectl crictl & ctr 2023-07-09 20:40:36 +02:00
Euan Kemp
c154180073 k3s: add ipset runtime dependency
Fixes #176445

The included change to the k3s test fails without the package change.
2023-02-19 14:38:40 +09:00
Jairo Llopis
0ca947e125
k3s: dynamic detection of all k3s packages 2023-02-14 13:23:35 +00:00
Jairo Llopis
52a153aae2
k3s: test all versions
Since https://github.com/NixOS/nixpkgs/issues/213943 got fixed, only the main k3s derivation is tested.

Here I changed the tests a bit to make them test all provided k3s derivations

@moduon MT-1718
2023-02-10 09:12:14 +00:00
Euan Kemp
9d477c37ac nixos/tests/k3s: fix multi-node test
This corrects the multi-node test after a couple recent changes which
resulted in it being broken.

The `lib.toString` change was an incorrect tree-wide refactor, and the
aarch64 change also introduced an error in python indentation/formatting
I believe.
2022-10-28 21:03:30 -07:00
Artturin
f4ea1208ec treewide: *Flags convert to list from str
*Flags implies a list

slightly relevant:
> stdenv: start deprecating non-list configureFlags https://github.com/NixOS/nixpkgs/pull/173172

the makeInstalledTests function in `nixos/tests/installed-tests/default.nix` isn't available outside of nixpkgs so
it's not a breaking change
2022-10-10 15:30:59 +03:00
superherointj
2e19f2fa53 maintainers: remove superherointj 2022-10-04 14:06:48 -03:00
superherointj
3d200bd959 nixos/tests/k3s: fix tests
* add superherointj as maintainer
2022-10-02 13:01:47 -03:00
Jairo Llopis
60e0d3d736
k3s: streamline HA setup
- Replace misleading docs.
- Add new assertions to let configurations make more sense.
- Add clusterInit flag.
- Add some more docs about HA and non-HA modes setup.
- Improve multi-node tests for HA mode.

Fix https://github.com/NixOS/nixpkgs/issues/182085
2022-08-30 09:27:29 +01:00
Euan Kemp
b6da1d8198 nixos/tests/k3s: add multi-node test
This adds a basic multi-node test and verifies networking works between
em.
2022-07-30 11:55:32 -07:00
Euan Kemp
aa579635b9 nixos/tests/k3s: wait for default service account in test
This lets us write a slightly simpler test, and more closely matches
actual k8s usage
2022-07-30 11:55:24 -07:00
Euan Kemp
d5b1e25711 nixos/tests/k3s: reorganize test into a subdirectory
In preperation for more tests, coming soon.
2022-07-30 11:55:23 -07:00