Commit graph

49 commits

Author SHA1 Message Date
Peder Bergebakken Sundt
c77ac9dfc3 treewide: fix typos 2025-06-02 16:07:07 +02:00
Robert Rose
f5efa59ad1 nixos/k3s: support fetching helm charts from OCI registries
This enables fetching Helm charts from OCI-based registries. OCI charts
will be detected by checking that the repo has a `oci://` prefix, the
behaviour for regular chart registries remains the same. The `name`
field can be omitted for OCI charts.
2025-05-05 12:01:28 +02:00
Robert Rose
4baad06ecf nixos/k3s: add default hash for autoDeployCharts module 2025-04-26 13:45:00 +02:00
Robert Rose
e77d893ef4 nixos/k3s: replace deprecated --no-deploy flag in option description 2025-04-03 11:01:47 +02:00
Marcus Ramberg
d07ebbab9b
nixos/k3s: add autoDeployCharts option and use systemd-tmpfiles for content activation (#374017) 2025-03-15 11:26:43 +01:00
Peder Bergebakken Sundt
953f72e76e nixos/*: tag manpage references 2025-01-27 02:47:01 +01:00
Robert Rose
d3cd8299b4 nixos/k3s: use systemd-tmpfiles to activate k3s content
Formerly a `ExecStartPre` script was used to link k3s content.
Building the script got fairly messy and it had some footguns like
forgetting to create parent directories before linking or silent
overriding of existing links.
2025-01-23 16:34:35 +01:00
Robert Rose
95b894bad7 nixos/k3s: add autoDeployCharts option
The `autoDeployCharts` option further improves the auto deploying
capabilities of the k3s module by allowing to deploy and configure Helm charts
that are then instaled via the k3s Helm controller. Although this was
also previously possible by using auto deploying manifests, it required
some knowledge of the k3s Helm controller and led to a lot of
boilerplate code.
2025-01-23 16:34:35 +01:00
Robert Rose
759d2b8646 nixos/k3s: make assertions about missing configuration options warnings
It is possible to configure k3s in various ways (cli flags, env
variables, single config file, multiple config files) and everything is
merged together in a final config. The nixos module cannot know if a
configuration option that is missing from the module point of view is
supplied in another way, so it shouldn't assert missing configuration
options.
2024-12-11 22:29:21 +01:00
Marcus Ramberg
37da609352
nixos/k3s: add nftables to Path of k3s service (#360796) 2024-12-09 21:45:25 +01:00
nicoo
d0e6b0e170 dockerTools.pullImage: accept hash parameter 2024-12-09 14:28:24 +01:00
RMT
7ece479f39
nixos/k3s: add extraKubeProxyConfig option to add nftables to k3s's path 2024-12-08 23:27:37 +08:00
Felix Buehler
6ebec4f097 nixos/services.k3s: remove with lib; 2024-09-15 10:43:47 +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
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
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
stuebinm
6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00
h7x4
0a37316d6c
treewide: use mkPackageOption
This commit replaces a lot of usages of `mkOption` with the package
type, to be `mkPackageOption`, in order to reduce the amount of code.
2023-11-27 01:28:36 +01:00
superherointj
a180470959 nixos/k3s: start after network-online 2023-03-30 07:53:38 -03:00
Riley
c713217380
nixos/k3s: add environmentFile as an option
* k3s: add environmentFile option

Enabling to include secrets through configuration such as 'sops'

* Update nixos/doc/manual/release-notes/rl-2305.section.md

Co-authored-by: Jairo Llopis <973709+yajo@users.noreply.github.com>
2023-02-27 08:15:25 -03:00
pennae
3bddcf5f90
Merge branch 'master' into option-docs-md 2022-09-01 16:10:09 +02:00
pennae
ef176dcf7e nixos/*: automatically convert option descriptions
conversions were done using https://github.com/pennae/nix-doc-munge
using (probably) rev f34e145 running

    nix-doc-munge nixos/**/*.nix
    nix-doc-munge --import nixos/**/*.nix

the tool ensures that only changes that could affect the generated
manual *but don't* are committed, other changes require manual review
and are discarded.
2022-08-31 16:32:53 +02: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
pennae
2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
Euan Kemp
f158ac45ef nixos/k3s: use default cgroup-driver again
Setting `cgroup-driver=systemd` was originally necessary to match with
docker, else the kubelet would not start (#111835)

However, since then, docker support has been dropped from k3s (#177790).
As such, this option is much less necessary.

More importantly, it now seems to be actively causing issues. Due to an
upstream k3s bug, it's resulting in the kubelet and containerd having
different cgroup drivers, which seems to result in some difficult to
debug failure modes.

See
https://github.com/NixOS/nixpkgs/issues/181790#issuecomment-1188840862
for a description of this problem.

Removing this flag entirely seems reasonable to me, and it results in
k3s working again on my machine.
2022-07-19 02:52:12 -07:00
superherointj
a6a0c44760 k3s: remove docker support 2022-06-15 16:40:29 -03:00
Euan Kemp
e6d1c597f1 nixos/k3s: use the systemd driver for docker + unified cgroups
This is necessary for it to work at all. The single-node-docker test
will fail without this change.

Also add a release note for it.
2022-03-05 11:30:53 -08:00
ngerstle
8aaa0699db k3s: enable enableUnifiedCgroupHierarchy 2022-03-05 00:18:17 -08:00
Naïm Favier
2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
zimbatm
efbd199ffb
nixos/k3s: add configPath option
This is useful when the whole k3s config is generated on boot. The
server address or token might be dynamically injected using user-data.
2021-07-19 13:40:58 +02:00
Jörg Thalheim
f2b81f91be
Merge pull request #125205 from Mic92/token-file
k3s: token file
2021-07-15 13:37:04 +01:00
Jörg Thalheim
6fdb73a3b4
Merge pull request #118801 from Mic92/k3s
nixos/k3s: improve zfs/docker support
2021-06-05 07:54:54 +02:00
Jörg Thalheim
03582eb6e3
nixos/k3s: add zfs to path 2021-06-05 07:52:53 +02:00
Jörg Thalheim
7c310e8d28
nixos/k3s: add to environment.systemPackages for adminstration 2021-06-05 07:52:48 +02:00
Jörg Thalheim
11a38f62f0
k3s: add tokenFile option
To avoid having secrets in the nix store.
2021-06-01 13:35:04 +02:00
Jörg Thalheim
852739337b
nixos/k3s: add to environment.systemPackages for adminstration 2021-06-01 13:35:03 +02:00
Jörg Thalheim
2a48ef1426
Merge pull request #103228 from ThinkChaos/fix_k3s_start
nixos/k3s: Update service to match upstream
2021-04-14 09:01:33 +01:00
ThinkChaos
0b7c8b92f4
nixos/k3s: Change dependency to network.service
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2021-04-13 13:37:41 +02:00
Fritz Otlinghaus
3c7c9a43dc
nixos/k3s: add extraFlags type 2021-01-31 11:21:54 +01:00
ThinkChaos
4db9d279c4 nixos/k3s: Use optional for more idiomatic code 2020-11-23 20:30:35 +01:00
Florian Klink
5d45f269aa nixos/k3s: disable unifiedCgroupHierarchy
This gets automatically disabled by docker if the docker backend is
used, but the bundled containerd also doesn't seem to support cgroupsv2,
so disable it explicitly here, too.
2020-11-19 16:56:46 +01:00
ThinkChaos
acb845dd11 nixos/k3s: Add dependency on firewall.service 2020-11-09 22:17:39 +01:00
ThinkChaos
7514f00733 nixos/k3s: Update service to match upstream
Fixes race between k3s and network.
2020-11-09 19:50:36 +01:00
John Axel Eriksson
41a95b1b7d
The systemd unit for k3s should differ between agents and servers 2020-04-23 07:55:23 +02:00
Euan Kemp
bc138f407f
nixos/k3s: add initial k3s service
* nixos/k3s: simplify config expression

* nixos/k3s: add config assertions and trim unneeded bits

* nixos/k3s: add a test that k3s works; minor module improvements

This is a single-node test. Eventually we should also have a multi-node
test to verify the agent bit works, but that one's more involved.

* nixos/k3s: add option description

* nixos/k3s: add defaults for token/serveraddr

Now that the assertion enforces their presence, we dont' need to use the typesystem for it.

* nixos/k3s: remove unneeded sudo in test

* nixos/k3s: add to test list
2020-04-17 16:39:54 +02:00