Init
This commit is contained in:
commit
cdec5a64aa
44 changed files with 9802 additions and 0 deletions
10
.sops.yaml
Normal file
10
.sops.yaml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
keys:
|
||||||
|
- &admin_pim age189laethzry4ylnd790dmpuc4xjjuwqxruc76caj3ceqhqug4g9qs0upuvw
|
||||||
|
- &admin_niels age159whjxeyw94xmkkephmtlur8e85xd9d5vnvkwkcayfv7el0neqfq863yga
|
||||||
|
|
||||||
|
creation_rules:
|
||||||
|
- path_regex: secrets.yml$
|
||||||
|
key_groups:
|
||||||
|
- age:
|
||||||
|
- *admin_pim
|
||||||
|
- *admin_niels
|
7
applyset-deploy.sh
Normal file
7
applyset-deploy.sh
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
export KUBECTL_APPLYSET=true
|
||||||
|
vals eval -fail-on-missing-key-in-map <$MANIFEST | kubectl apply -f - --prune --applyset $APPLYSET --namespace $NAMESPACE
|
126
deployments.nix
Normal file
126
deployments.nix
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
{
|
||||||
|
bootstrap-default = {
|
||||||
|
module.bootstrap-default.enable = true;
|
||||||
|
namespace = "default";
|
||||||
|
};
|
||||||
|
|
||||||
|
bootstrap-kube-system = {
|
||||||
|
module.bootstrap-kube-system.enable = true;
|
||||||
|
namespace = "kube-system";
|
||||||
|
};
|
||||||
|
|
||||||
|
cyberchef = {
|
||||||
|
module.cyberchef.enable = true;
|
||||||
|
namespace = "static-websites";
|
||||||
|
};
|
||||||
|
|
||||||
|
freshrss = {
|
||||||
|
module.freshrss.enable = true;
|
||||||
|
namespace = "freshrss";
|
||||||
|
};
|
||||||
|
|
||||||
|
radicale = {
|
||||||
|
module.radicale.enable = true;
|
||||||
|
namespace = "radicale";
|
||||||
|
};
|
||||||
|
|
||||||
|
kms = {
|
||||||
|
module.kms.enable = true;
|
||||||
|
namespace = "kms";
|
||||||
|
};
|
||||||
|
|
||||||
|
atuin = {
|
||||||
|
module.atuin.enable = true;
|
||||||
|
namespace = "atuin";
|
||||||
|
};
|
||||||
|
|
||||||
|
blog = {
|
||||||
|
module.blog.enable = true;
|
||||||
|
namespace = "static-websites";
|
||||||
|
};
|
||||||
|
|
||||||
|
nextcloud = {
|
||||||
|
module.nextcloud.enable = true;
|
||||||
|
namespace = "nextcloud";
|
||||||
|
};
|
||||||
|
|
||||||
|
hedgedoc = {
|
||||||
|
module.hedgedoc.enable = true;
|
||||||
|
namespace = "hedgedoc";
|
||||||
|
};
|
||||||
|
|
||||||
|
kitchenowl = {
|
||||||
|
module.kitchenowl.enable = true;
|
||||||
|
namespace = "kitchenowl";
|
||||||
|
};
|
||||||
|
|
||||||
|
forgejo = {
|
||||||
|
module.forgejo.enable = true;
|
||||||
|
namespace = "forgejo";
|
||||||
|
};
|
||||||
|
|
||||||
|
paperless = {
|
||||||
|
module.paperless.enable = true;
|
||||||
|
namespace = "paperless";
|
||||||
|
};
|
||||||
|
|
||||||
|
syncthing = {
|
||||||
|
module.syncthing.enable = true;
|
||||||
|
namespace = "syncthing";
|
||||||
|
};
|
||||||
|
|
||||||
|
pihole = {
|
||||||
|
module.pihole.enable = true;
|
||||||
|
namespace = "dns";
|
||||||
|
};
|
||||||
|
|
||||||
|
immich = {
|
||||||
|
module.immich.enable = true;
|
||||||
|
namespace = "immich";
|
||||||
|
};
|
||||||
|
|
||||||
|
attic = {
|
||||||
|
module.attic.enable = true;
|
||||||
|
namespace = "attic";
|
||||||
|
};
|
||||||
|
|
||||||
|
inbucket = {
|
||||||
|
module.inbucket.enable = true;
|
||||||
|
namespace = "inbucket";
|
||||||
|
};
|
||||||
|
|
||||||
|
dnsmasq = {
|
||||||
|
module.dnsmasq.enable = true;
|
||||||
|
namespace = "dns";
|
||||||
|
};
|
||||||
|
|
||||||
|
bind9 = {
|
||||||
|
module.bind9.enable = true;
|
||||||
|
namespace = "dns";
|
||||||
|
};
|
||||||
|
|
||||||
|
media = {
|
||||||
|
module.media.enable = true;
|
||||||
|
namespace = "media";
|
||||||
|
};
|
||||||
|
|
||||||
|
traefik = {
|
||||||
|
module.traefik.enable = true;
|
||||||
|
namespace = "kube-system";
|
||||||
|
};
|
||||||
|
|
||||||
|
minecraft = {
|
||||||
|
module.minecraft.enable = true;
|
||||||
|
namespace = "minecraft";
|
||||||
|
};
|
||||||
|
|
||||||
|
tailscale = {
|
||||||
|
module.tailscale.enable = true;
|
||||||
|
namespace = "tailscale";
|
||||||
|
};
|
||||||
|
|
||||||
|
ntfy = {
|
||||||
|
module.ntfy.enable = true;
|
||||||
|
namespace = "ntfy";
|
||||||
|
};
|
||||||
|
}
|
1113
flake.lock
Normal file
1113
flake.lock
Normal file
File diff suppressed because it is too large
Load diff
111
flake.nix
Normal file
111
flake.nix
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
{
|
||||||
|
description = "Kubernetes deployments";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
flutils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
nixhelm = {
|
||||||
|
url = "github:farcaller/nixhelm";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
blog-pim = {
|
||||||
|
# HACK: pinning this to a specific revision, as my automation is broken.
|
||||||
|
url = "git+https://git.kun.is/home/blog-pim?rev=7296f7f5bf5f089a5137036dcbd8058cf3e4a9e5";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.follows = "nixpkgs";
|
||||||
|
flutils.follows = "flutils";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
kubenix = {
|
||||||
|
url = "github:pizzapim/kubenix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
dns = {
|
||||||
|
url = "github:kirelagin/dns.nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
servers = {
|
||||||
|
# url = "git+https://git.kun.is/home/nixos-servers";
|
||||||
|
type = "path";
|
||||||
|
path = "/home/pim/git/nixos-servers";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs@{ self, servers, flutils, nixpkgs, kubenix, ... }: flutils.lib.eachDefaultSystem
|
||||||
|
(system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
deployScript = (pkgs.writeScriptBin "applyset-deploy.sh" (builtins.readFile ./applyset-deploy.sh)).overrideAttrs (old: {
|
||||||
|
buildCommand = "${old.buildCommand}\npatchShebangs $out";
|
||||||
|
});
|
||||||
|
|
||||||
|
machines = servers.machines.${system};
|
||||||
|
|
||||||
|
mkKubernetes = name: module: namespace: (kubenix.evalModules.${system} {
|
||||||
|
specialArgs = {
|
||||||
|
inherit namespace system machines;
|
||||||
|
inherit (servers) globals;
|
||||||
|
inherit (inputs) nixhelm blog-pim dns;
|
||||||
|
};
|
||||||
|
|
||||||
|
module = { kubenix, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
kubenix.modules.k8s
|
||||||
|
kubenix.modules.helm
|
||||||
|
./modules
|
||||||
|
module
|
||||||
|
];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
kubenix.project = name;
|
||||||
|
kubernetes.namespace = namespace;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}).config.kubernetes;
|
||||||
|
|
||||||
|
mkManifest = name: { module, namespace }: {
|
||||||
|
name = "${name}-manifest";
|
||||||
|
value = (mkKubernetes name module namespace).result;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkDeployApp = name: { module, namespace }:
|
||||||
|
let
|
||||||
|
kubernetes = mkKubernetes name module namespace;
|
||||||
|
kubeconfig = kubernetes.kubeconfig or "";
|
||||||
|
result = kubernetes.result or "";
|
||||||
|
|
||||||
|
wrappedDeployScript = pkgs.symlinkJoin
|
||||||
|
{
|
||||||
|
name = "applyset-deploy.sh";
|
||||||
|
paths = [ deployScript pkgs.vals pkgs.kubectl ];
|
||||||
|
buildInputs = [ pkgs.makeWrapper ];
|
||||||
|
passthru.manifest = result;
|
||||||
|
meta.mainProgram = "applyset-deploy.sh";
|
||||||
|
|
||||||
|
postBuild = ''
|
||||||
|
wrapProgram $out/bin/applyset-deploy.sh \
|
||||||
|
--suffix PATH : "$out/bin" \
|
||||||
|
--run 'export KUBECONFIG=''${KUBECONFIG:-${toString kubeconfig}}' \
|
||||||
|
--set MANIFEST '${result}' \
|
||||||
|
--set APPLYSET 'applyset-${name}' \
|
||||||
|
--set NAMESPACE '${namespace}'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
name = "${name}-deploy";
|
||||||
|
value = wrappedDeployScript;
|
||||||
|
};
|
||||||
|
|
||||||
|
deployments = import ./deployments.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = pkgs.lib.mergeAttrs (pkgs.lib.mapAttrs' mkDeployApp deployments) (pkgs.lib.mapAttrs' mkManifest deployments);
|
||||||
|
});
|
||||||
|
}
|
205
modules/attic.nix
Normal file
205
modules/attic.nix
Normal file
|
@ -0,0 +1,205 @@
|
||||||
|
{ pkgs, lib, config, globals, ... }: {
|
||||||
|
options.attic.enable = lib.mkEnableOption "attic";
|
||||||
|
|
||||||
|
config = lib.mkIf config.attic.enable {
|
||||||
|
kubernetes.resources =
|
||||||
|
let
|
||||||
|
atticSettings = {
|
||||||
|
# The '+" is to explicitly denote the end of the Vals expression.
|
||||||
|
# This is done because we quote the template for the INI file.
|
||||||
|
# See: https://github.com/helmfile/vals?tab=readme-ov-file#expression-syntax
|
||||||
|
database.url = "ref+sops://secrets.yml#attic/databaseURL+";
|
||||||
|
|
||||||
|
storage = {
|
||||||
|
type = "local";
|
||||||
|
path = "/var/lib/atticd/storage";
|
||||||
|
};
|
||||||
|
|
||||||
|
listen = "[::]:8080";
|
||||||
|
|
||||||
|
# Data chunking
|
||||||
|
#
|
||||||
|
# Warning: If you change any of the values here, it will be
|
||||||
|
# difficult to reuse existing chunks for newly-uploaded NARs
|
||||||
|
# since the cutpoints will be different. As a result, the
|
||||||
|
# deduplication ratio will suffer for a while after the change.
|
||||||
|
chunking = {
|
||||||
|
# The minimum NAR size to trigger chunking
|
||||||
|
#
|
||||||
|
# If 0, chunking is disabled entirely for newly-uploaded NARs.
|
||||||
|
# If 1, all NARs are chunked.
|
||||||
|
nar-size-threshold = 64 * 1024; # 64 KiB
|
||||||
|
|
||||||
|
# The preferred minimum size of a chunk, in bytes
|
||||||
|
min-size = 16 * 1024; # 16 KiB
|
||||||
|
|
||||||
|
# The preferred average size of a chunk, in bytes
|
||||||
|
avg-size = 64 * 1024; # 64 KiB
|
||||||
|
|
||||||
|
# The preferred maximum size of a chunk, in bytes
|
||||||
|
max-size = 256 * 1024; # 256 KiB
|
||||||
|
};
|
||||||
|
};
|
||||||
|
generatedConfig = (pkgs.formats.toml { }).generate "attic.toml" atticSettings;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
secrets = {
|
||||||
|
server.stringData = {
|
||||||
|
token = "ref+sops://secrets.yml#attic/jwtToken";
|
||||||
|
config = builtins.readFile generatedConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
database.stringData.password = "ref+sops://secrets.yml#/attic/databasePassword";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployments = {
|
||||||
|
attic.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "attic";
|
||||||
|
component = "website";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "attic";
|
||||||
|
component = "website";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.attic = {
|
||||||
|
image = globals.images.attic;
|
||||||
|
ports.web.containerPort = 8080;
|
||||||
|
args = [ "-f" "/etc/atticd/config.toml" ];
|
||||||
|
|
||||||
|
env.ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64.valueFrom.secretKeyRef = {
|
||||||
|
name = "server";
|
||||||
|
key = "token";
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/var/lib/atticd/storage";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/etc/atticd/config.toml";
|
||||||
|
subPath = "config";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
data.persistentVolumeClaim.claimName = "data";
|
||||||
|
config.secret.secretName = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 0;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
attic-db.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "attic";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "attic";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.postgres = {
|
||||||
|
image = globals.images.postgres15;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
ports.postgres.containerPort = 5432;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
POSTGRES_DB.value = "attic";
|
||||||
|
POSTGRES_USER.value = "attic";
|
||||||
|
PGDATA.value = "/pgdata/data";
|
||||||
|
|
||||||
|
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
|
||||||
|
name = "database";
|
||||||
|
key = "password";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/pgdata";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes.data.persistentVolumeClaim.claimName = "database";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
attic.spec = {
|
||||||
|
selector = {
|
||||||
|
app = "attic";
|
||||||
|
component = "website";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
database.spec = {
|
||||||
|
selector = {
|
||||||
|
app = "attic";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.postgres = {
|
||||||
|
port = 5432;
|
||||||
|
targetPort = "postgres";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
ingresses.attic = {
|
||||||
|
host = "attic.kun.is";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "attic";
|
||||||
|
portName = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim = {
|
||||||
|
data = {
|
||||||
|
volumeName = "attic";
|
||||||
|
storage = "15Gi";
|
||||||
|
};
|
||||||
|
|
||||||
|
database = {
|
||||||
|
volumeName = "attic-db";
|
||||||
|
storage = "150Mi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
113
modules/atuin.nix
Normal file
113
modules/atuin.nix
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
{ config, globals, lib, ... }: {
|
||||||
|
options.atuin.enable = lib.mkEnableOption "atuin";
|
||||||
|
|
||||||
|
config = lib.mkIf config.atuin.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
secrets.database.stringData = {
|
||||||
|
databasePassword = "ref+sops://secrets.yml#/atuin/databasePassword";
|
||||||
|
databaseURL = "ref+sops://secrets.yml#/atuin/databaseURL";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployments.server.spec = {
|
||||||
|
selector.matchLabels.app = "atuin";
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "atuin";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
volumes = {
|
||||||
|
data.persistentVolumeClaim.claimName = "data";
|
||||||
|
database.persistentVolumeClaim.claimName = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
containers = {
|
||||||
|
atuin = {
|
||||||
|
image = globals.images.atuin;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
ports.web.containerPort = 8888;
|
||||||
|
args = [ "server" "start" ];
|
||||||
|
|
||||||
|
env = {
|
||||||
|
ATUIN_HOST.value = "0.0.0.0";
|
||||||
|
ATUIN_PORT.value = "8888";
|
||||||
|
ATUIN_OPEN_REGISTRATION.value = "false";
|
||||||
|
|
||||||
|
ATUIN_DB_URI.valueFrom.secretKeyRef = {
|
||||||
|
name = "database";
|
||||||
|
key = "databaseURL";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/config";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
database = {
|
||||||
|
image = globals.images.postgres14;
|
||||||
|
ports.web.containerPort = 5432;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
POSTGRES_DB.value = "atuin";
|
||||||
|
POSTGRES_USER.value = "atuin";
|
||||||
|
|
||||||
|
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
|
||||||
|
name = "database";
|
||||||
|
key = "databasePassword";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "database";
|
||||||
|
mountPath = "/var/lib/postgresql/data";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.server.spec = {
|
||||||
|
selector.app = "atuin";
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
ingresses.server = {
|
||||||
|
host = "atuin.kun.is";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "server";
|
||||||
|
portName = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim = {
|
||||||
|
data = {
|
||||||
|
volumeName = "atuin";
|
||||||
|
storage = "300Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
database = {
|
||||||
|
volumeName = "atuin-db";
|
||||||
|
storage = "300Mi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
153
modules/bind9/default.nix
Normal file
153
modules/bind9/default.nix
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
{ config, lib, globals, dns, ... }:
|
||||||
|
let
|
||||||
|
kunisZone = dns.lib.toString "kun.is" (import ./kun.is.zone.nix globals dns);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.bind9.enable = lib.mkEnableOption "bind9";
|
||||||
|
|
||||||
|
config = lib.mkIf config.bind9.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
configMaps = {
|
||||||
|
bind9-env.data.TZ = "Europe/Amsterdam";
|
||||||
|
|
||||||
|
bind9-config.data = {
|
||||||
|
# TODO: this was copied from nix's generated bind config
|
||||||
|
# Is there a way to generate this without actually running the nixos module?
|
||||||
|
config = ''
|
||||||
|
acl cachenetworks { 127.0.0.0/24; };
|
||||||
|
acl badnetworks { };
|
||||||
|
|
||||||
|
options {
|
||||||
|
listen-on { any; };
|
||||||
|
listen-on-v6 { any; };
|
||||||
|
allow-query { cachenetworks; };
|
||||||
|
blackhole { badnetworks; };
|
||||||
|
forward first;
|
||||||
|
forwarders { };
|
||||||
|
directory "/run/named";
|
||||||
|
pid-file "/run/named/named.pid";
|
||||||
|
allow-transfer { none; };
|
||||||
|
allow-recursion { none; };
|
||||||
|
version none;
|
||||||
|
notify no;
|
||||||
|
};
|
||||||
|
|
||||||
|
zone "kun.is" {
|
||||||
|
type master;
|
||||||
|
file "/etc/bind/kun.is.zone";
|
||||||
|
allow-transfer { };
|
||||||
|
allow-query { any; };
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
|
||||||
|
kunis-zone = kunisZone;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
deployments.bind9.spec = {
|
||||||
|
selector.matchLabels.app = "bind9";
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "bind9";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers = {
|
||||||
|
bind9-udp = {
|
||||||
|
image = globals.images.bind9;
|
||||||
|
envFrom = [{ configMapRef.name = "bind9-env"; }];
|
||||||
|
|
||||||
|
ports.dns-udp = {
|
||||||
|
containerPort = 53;
|
||||||
|
protocol = "UDP";
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/etc/bind/named.conf";
|
||||||
|
subPath = "config";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/etc/bind/kun.is.zone";
|
||||||
|
subPath = "kunis-zone";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
bind9-tcp = {
|
||||||
|
image = globals.images.bind9;
|
||||||
|
envFrom = [{ configMapRef.name = "bind9-env"; }];
|
||||||
|
|
||||||
|
ports.dns-tcp = {
|
||||||
|
containerPort = 53;
|
||||||
|
protocol = "TCP";
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/etc/bind/named.conf";
|
||||||
|
subPath = "config";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/etc/bind/kun.is.zone";
|
||||||
|
subPath = "kunis-zone";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = [{
|
||||||
|
name = "config";
|
||||||
|
configMap.name = "bind9-config";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
bind9-udp = {
|
||||||
|
metadata.annotations = {
|
||||||
|
"metallb.universe.tf/loadBalancerIPs" = "${globals.bind9IPv4},${globals.bind9Ipv6}";
|
||||||
|
"metallb.universe.tf/allow-shared-ip" = "dns";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
selector.app = "bind9";
|
||||||
|
ipFamilies = [ "IPv4" "IPv6" ];
|
||||||
|
ipFamilyPolicy = "RequireDualStack";
|
||||||
|
|
||||||
|
ports.dns = {
|
||||||
|
port = 53;
|
||||||
|
targetPort = "dns-udp";
|
||||||
|
protocol = "UDP";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
bind9-tcp = {
|
||||||
|
metadata.annotations = {
|
||||||
|
"metallb.universe.tf/loadBalancerIPs" = "${globals.bind9IPv4},${globals.bind9Ipv6}";
|
||||||
|
"metallb.universe.tf/allow-shared-ip" = "dns";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
selector.app = "bind9";
|
||||||
|
ipFamilies = [ "IPv4" "IPv6" ];
|
||||||
|
ipFamilyPolicy = "RequireDualStack";
|
||||||
|
|
||||||
|
ports.dns = {
|
||||||
|
port = 53;
|
||||||
|
targetPort = "dns-tcp";
|
||||||
|
protocol = "TCP";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
52
modules/bind9/kun.is.zone.nix
Normal file
52
modules/bind9/kun.is.zone.nix
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
globals: dns: with dns.lib.combinators; {
|
||||||
|
CAA = letsEncrypt "caa@kun.is";
|
||||||
|
|
||||||
|
SOA = {
|
||||||
|
nameServer = "ns1";
|
||||||
|
adminEmail = "webmaster.kun.is";
|
||||||
|
serial = 2024041301;
|
||||||
|
};
|
||||||
|
|
||||||
|
NS = [
|
||||||
|
"ns1.kun.is."
|
||||||
|
"ns2.kun.is."
|
||||||
|
];
|
||||||
|
|
||||||
|
MX = [
|
||||||
|
(mx.mx 10 "mail.kun.is.")
|
||||||
|
];
|
||||||
|
|
||||||
|
TXT = [
|
||||||
|
(with spf; soft [ "include:spf.glasnet.nl" ])
|
||||||
|
];
|
||||||
|
|
||||||
|
subdomains = rec {
|
||||||
|
"*".A = [ globals.routerPublicIPv4 ];
|
||||||
|
|
||||||
|
ns = {
|
||||||
|
A = [ globals.routerPublicIPv4 ];
|
||||||
|
AAAA = [ ];
|
||||||
|
};
|
||||||
|
|
||||||
|
ns1 = ns;
|
||||||
|
ns2 = ns;
|
||||||
|
|
||||||
|
wg = {
|
||||||
|
A = [ globals.routerPublicIPv4 ];
|
||||||
|
AAAA = [ ];
|
||||||
|
};
|
||||||
|
|
||||||
|
#for SMTP2GO to be able send emails from kun.is domain
|
||||||
|
em670271 = {
|
||||||
|
CNAME = [ "return.smtp2go.net." ];
|
||||||
|
};
|
||||||
|
|
||||||
|
"s670271._domainkey" = {
|
||||||
|
CNAME = [ "dkim.smtp2go.net." ];
|
||||||
|
};
|
||||||
|
|
||||||
|
link = {
|
||||||
|
CNAME = [ "track.smtp2go.net." ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
41
modules/blog.nix
Normal file
41
modules/blog.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{ blog-pim, lib, config, ... }: {
|
||||||
|
options.blog.enable = lib.mkEnableOption "blog";
|
||||||
|
|
||||||
|
config = lib.mkIf config.blog.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
deployments.blog.spec = {
|
||||||
|
replicas = 3;
|
||||||
|
selector.matchLabels.app = "blog";
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "blog";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.blog = {
|
||||||
|
image = "git.kun.is/home/blog-pim:${blog-pim.rev}";
|
||||||
|
ports.web.containerPort = 80;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.blog.spec = {
|
||||||
|
selector.app = "blog";
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab.ingresses.blog = {
|
||||||
|
host = "pim.kun.is";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "blog";
|
||||||
|
portName = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
148
modules/bootstrap-default.nix
Normal file
148
modules/bootstrap-default.nix
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
{ config, lib, nixhelm, system, globals, machines, ... }: {
|
||||||
|
options.bootstrap-default.enable = lib.mkEnableOption "bootstrap-default";
|
||||||
|
|
||||||
|
config = lib.mkIf config.bootstrap-default.enable {
|
||||||
|
kubernetes = {
|
||||||
|
helm.releases = {
|
||||||
|
metallb = {
|
||||||
|
chart = nixhelm.chartsDerivations.${system}.metallb.metallb;
|
||||||
|
includeCRDs = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# argo-workflows = {
|
||||||
|
# chart = nixhelm.chartsDerivations.${system}.argoproj.argo-workflows;
|
||||||
|
# includeCRDs = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
longhorn = {
|
||||||
|
chart = nixhelm.chartsDerivations.${system}.longhorn.longhorn;
|
||||||
|
includeCRDs = true;
|
||||||
|
|
||||||
|
values = {
|
||||||
|
persistence.defaultClassReplicaCount = 2;
|
||||||
|
service.ui.type = "LoadBalancer";
|
||||||
|
|
||||||
|
defaultSettings = {
|
||||||
|
defaultDataPath = "/mnt/longhorn";
|
||||||
|
storageMinimalAvailablePercentage = 0;
|
||||||
|
allowRecurringJobWhileVolumeDetached = true;
|
||||||
|
backupTarget = "nfs://lewis.dmz:/mnt/longhorn/persistent/longhorn-backup";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
resources = {
|
||||||
|
services.longhorn-frontend.spec.loadBalancerIP = globals.longhornIPv4;
|
||||||
|
|
||||||
|
namespaces = {
|
||||||
|
static-websites = { };
|
||||||
|
freshrss = { };
|
||||||
|
radicale = { };
|
||||||
|
kms = { };
|
||||||
|
atuin = { };
|
||||||
|
nextcloud = { };
|
||||||
|
hedgedoc = { };
|
||||||
|
kitchenowl = { };
|
||||||
|
forgejo = { };
|
||||||
|
paperless = { };
|
||||||
|
syncthing = { };
|
||||||
|
immich = { };
|
||||||
|
attic = { };
|
||||||
|
inbucket = { };
|
||||||
|
dns = { };
|
||||||
|
media = { };
|
||||||
|
minecraft = { };
|
||||||
|
tailscale = { };
|
||||||
|
ntfy = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes =
|
||||||
|
let
|
||||||
|
machinesWithKubernetesLabels = lib.filterAttrs (name: machine: machine.kubernetesNodeLabels != null) machines;
|
||||||
|
in
|
||||||
|
builtins.mapAttrs
|
||||||
|
(name: machine: {
|
||||||
|
metadata.labels = machine.kubernetesNodeLabels;
|
||||||
|
})
|
||||||
|
machinesWithKubernetesLabels;
|
||||||
|
|
||||||
|
recurringJobs.backup-nfs.spec = {
|
||||||
|
cron = "0 1 * * *"; # One o'clock at night
|
||||||
|
task = "backup";
|
||||||
|
retain = 2; # We don't need many, as we also make Borg backups.
|
||||||
|
concurrency = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
ipAddressPools.main.spec.addresses = [ "192.168.30.128-192.168.30.200" "2a0d:6e00:1a77:30::2-2a0d:6e00:1a77:30:ffff:ffff:ffff:fffe" ];
|
||||||
|
l2Advertisements.main.metadata = { };
|
||||||
|
|
||||||
|
persistentVolumes = {
|
||||||
|
music-syncthing.spec = {
|
||||||
|
capacity.storage = "1Gi";
|
||||||
|
accessModes = [ "ReadWriteMany" ];
|
||||||
|
|
||||||
|
nfs = {
|
||||||
|
server = "lewis.dmz";
|
||||||
|
path = "/mnt/longhorn/persistent/media/music";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
media-media.spec = {
|
||||||
|
capacity.storage = "1Gi";
|
||||||
|
accessModes = [ "ReadWriteMany" ];
|
||||||
|
|
||||||
|
nfs = {
|
||||||
|
server = "lewis.dmz";
|
||||||
|
path = "/mnt/longhorn/persistent/media";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
longhorn.persistentVolume = {
|
||||||
|
freshrss.storage = "1Gi";
|
||||||
|
radicale.storage = "200Mi";
|
||||||
|
atuin.storage = "300Mi";
|
||||||
|
atuin-db.storage = "300Mi";
|
||||||
|
nextcloud.storage = "50Gi";
|
||||||
|
nextcloud-db.storage = "400Mi";
|
||||||
|
hedgedoc-uploads.storage = "50Mi";
|
||||||
|
hedgedoc-db.storage = "100Mi";
|
||||||
|
kitchenowl.storage = "100Mi";
|
||||||
|
forgejo.storage = "20Gi";
|
||||||
|
paperless-data.storage = "10Gi";
|
||||||
|
paperless-redisdata.storage = "20Mi";
|
||||||
|
paperless-db.storage = "150Mi";
|
||||||
|
syncthing.storage = "400Mi";
|
||||||
|
pihole-data.storage = "750Mi";
|
||||||
|
pihole-dnsmasq.storage = "16Mi";
|
||||||
|
immich.storage = "50Gi";
|
||||||
|
immich-db.storage = "5Gi";
|
||||||
|
attic.storage = "15Gi";
|
||||||
|
attic-db.storage = "150Mi";
|
||||||
|
jellyfin.storage = "5Gi";
|
||||||
|
transmission.storage = "25Mi";
|
||||||
|
jellyseerr.storage = "75Mi";
|
||||||
|
radarr.storage = "300Mi";
|
||||||
|
prowlarr.storage = "150Mi";
|
||||||
|
sonarr.storage = "150Mi";
|
||||||
|
bazarr.storage = "25Mi";
|
||||||
|
minecraft.storage = "1Gi";
|
||||||
|
ntfy.storage = "300Mi";
|
||||||
|
deluge.storage = "500Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
tailscaleIngresses.tailscale-longhorn = {
|
||||||
|
host = "longhorn";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "longhorn-frontend";
|
||||||
|
portName = "http";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
40
modules/bootstrap-kube-system/default.nix
Normal file
40
modules/bootstrap-kube-system/default.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{ config, lib, nixhelm, system, ... }: {
|
||||||
|
options.bootstrap-kube-system.enable = lib.mkEnableOption "bootstrap-kube-system";
|
||||||
|
|
||||||
|
config = lib.mkIf config.bootstrap-kube-system.enable {
|
||||||
|
kubernetes = {
|
||||||
|
# TODO: These were copied from https://github.com/cert-manager/cert-manager/releases/download/v1.14.4/cert-manager.crds.yaml
|
||||||
|
# See https://cert-manager.io/docs/installation/helm/
|
||||||
|
# Seems kubenix cannot import a list of resources, only individual resources.
|
||||||
|
# Might be good to create a PR for this.
|
||||||
|
imports = [
|
||||||
|
./manifests/certificaterequest.yaml
|
||||||
|
./manifests/certificate.yaml
|
||||||
|
./manifests/challenge.yaml
|
||||||
|
./manifests/clusterissuer.yaml
|
||||||
|
./manifests/issuer.yaml
|
||||||
|
./manifests/order.yaml
|
||||||
|
];
|
||||||
|
|
||||||
|
helm.releases = {
|
||||||
|
cert-manager = {
|
||||||
|
chart = nixhelm.chartsDerivations.${system}.jetstack.cert-manager;
|
||||||
|
includeCRDs = false;
|
||||||
|
namespace = "kube-system";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
resources.clusterIssuers.letsencrypt = {
|
||||||
|
spec.acme = {
|
||||||
|
server = "https://acme-v02.api.letsencrypt.org/directory";
|
||||||
|
email = "pim@kunis.nl";
|
||||||
|
privateKeySecretRef.name = "letsencrypt-private-key";
|
||||||
|
solvers = [{
|
||||||
|
selector = { };
|
||||||
|
http01.ingress.class = "traefik";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
443
modules/bootstrap-kube-system/manifests/certificate.yaml
Normal file
443
modules/bootstrap-kube-system/manifests/certificate.yaml
Normal file
|
@ -0,0 +1,443 @@
|
||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata:
|
||||||
|
name: certificates.cert-manager.io
|
||||||
|
labels:
|
||||||
|
app: 'cert-manager'
|
||||||
|
app.kubernetes.io/name: 'cert-manager'
|
||||||
|
app.kubernetes.io/instance: 'cert-manager'
|
||||||
|
# Generated labels
|
||||||
|
app.kubernetes.io/version: "v1.14.4"
|
||||||
|
spec:
|
||||||
|
group: cert-manager.io
|
||||||
|
names:
|
||||||
|
kind: Certificate
|
||||||
|
listKind: CertificateList
|
||||||
|
plural: certificates
|
||||||
|
shortNames:
|
||||||
|
- cert
|
||||||
|
- certs
|
||||||
|
singular: certificate
|
||||||
|
categories:
|
||||||
|
- cert-manager
|
||||||
|
scope: Namespaced
|
||||||
|
versions:
|
||||||
|
- name: v1
|
||||||
|
subresources:
|
||||||
|
status: {}
|
||||||
|
additionalPrinterColumns:
|
||||||
|
- jsonPath: .status.conditions[?(@.type=="Ready")].status
|
||||||
|
name: Ready
|
||||||
|
type: string
|
||||||
|
- jsonPath: .spec.secretName
|
||||||
|
name: Secret
|
||||||
|
type: string
|
||||||
|
- jsonPath: .spec.issuerRef.name
|
||||||
|
name: Issuer
|
||||||
|
priority: 1
|
||||||
|
type: string
|
||||||
|
- jsonPath: .status.conditions[?(@.type=="Ready")].message
|
||||||
|
name: Status
|
||||||
|
priority: 1
|
||||||
|
type: string
|
||||||
|
- jsonPath: .metadata.creationTimestamp
|
||||||
|
description: CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
|
||||||
|
name: Age
|
||||||
|
type: date
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
description: "A Certificate resource should be created to ensure an up to date and signed X.509 certificate is stored in the Kubernetes Secret resource named in `spec.secretName`. \n The stored certificate will be renewed before it expires (as configured by `spec.renewBefore`)."
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
apiVersion:
|
||||||
|
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||||
|
type: string
|
||||||
|
kind:
|
||||||
|
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||||
|
type: string
|
||||||
|
metadata:
|
||||||
|
type: object
|
||||||
|
spec:
|
||||||
|
description: Specification of the desired state of the Certificate resource. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- issuerRef
|
||||||
|
- secretName
|
||||||
|
properties:
|
||||||
|
additionalOutputFormats:
|
||||||
|
description: "Defines extra output formats of the private key and signed certificate chain to be written to this Certificate's target Secret. \n This is an Alpha Feature and is only enabled with the `--feature-gates=AdditionalCertificateOutputFormats=true` option set on both the controller and webhook components."
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
description: CertificateAdditionalOutputFormat defines an additional output format of a Certificate resource. These contain supplementary data formats of the signed certificate chain and paired private key.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- type
|
||||||
|
properties:
|
||||||
|
type:
|
||||||
|
description: Type is the name of the format type that should be written to the Certificate's target Secret.
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- DER
|
||||||
|
- CombinedPEM
|
||||||
|
commonName:
|
||||||
|
description: "Requested common name X509 certificate subject attribute. More info: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 NOTE: TLS clients will ignore this value when any subject alternative name is set (see https://tools.ietf.org/html/rfc6125#section-6.4.4). \n Should have a length of 64 characters or fewer to avoid generating invalid CSRs. Cannot be set if the `literalSubject` field is set."
|
||||||
|
type: string
|
||||||
|
dnsNames:
|
||||||
|
description: Requested DNS subject alternative names.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
duration:
|
||||||
|
description: "Requested 'duration' (i.e. lifetime) of the Certificate. Note that the issuer may choose to ignore the requested duration, just like any other requested attribute. \n If unset, this defaults to 90 days. Minimum accepted duration is 1 hour. Value must be in units accepted by Go time.ParseDuration https://golang.org/pkg/time/#ParseDuration."
|
||||||
|
type: string
|
||||||
|
emailAddresses:
|
||||||
|
description: Requested email subject alternative names.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
encodeUsagesInRequest:
|
||||||
|
description: "Whether the KeyUsage and ExtKeyUsage extensions should be set in the encoded CSR. \n This option defaults to true, and should only be disabled if the target issuer does not support CSRs with these X509 KeyUsage/ ExtKeyUsage extensions."
|
||||||
|
type: boolean
|
||||||
|
ipAddresses:
|
||||||
|
description: Requested IP address subject alternative names.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
isCA:
|
||||||
|
description: "Requested basic constraints isCA value. The isCA value is used to set the `isCA` field on the created CertificateRequest resources. Note that the issuer may choose to ignore the requested isCA value, just like any other requested attribute. \n If true, this will automatically add the `cert sign` usage to the list of requested `usages`."
|
||||||
|
type: boolean
|
||||||
|
issuerRef:
|
||||||
|
description: "Reference to the issuer responsible for issuing the certificate. If the issuer is namespace-scoped, it must be in the same namespace as the Certificate. If the issuer is cluster-scoped, it can be used from any namespace. \n The `name` field of the reference must always be specified."
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
properties:
|
||||||
|
group:
|
||||||
|
description: Group of the resource being referred to.
|
||||||
|
type: string
|
||||||
|
kind:
|
||||||
|
description: Kind of the resource being referred to.
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
description: Name of the resource being referred to.
|
||||||
|
type: string
|
||||||
|
keystores:
|
||||||
|
description: Additional keystore output formats to be stored in the Certificate's Secret.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
jks:
|
||||||
|
description: JKS configures options for storing a JKS keystore in the `spec.secretName` Secret resource.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- create
|
||||||
|
- passwordSecretRef
|
||||||
|
properties:
|
||||||
|
create:
|
||||||
|
description: Create enables JKS keystore creation for the Certificate. If true, a file named `keystore.jks` will be created in the target Secret resource, encrypted using the password stored in `passwordSecretRef`. The keystore file will be updated immediately. If the issuer provided a CA certificate, a file named `truststore.jks` will also be created in the target Secret resource, encrypted using the password stored in `passwordSecretRef` containing the issuing Certificate Authority
|
||||||
|
type: boolean
|
||||||
|
passwordSecretRef:
|
||||||
|
description: PasswordSecretRef is a reference to a key in a Secret resource containing the password used to encrypt the JKS keystore.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
properties:
|
||||||
|
key:
|
||||||
|
description: The key of the entry in the Secret resource's `data` field to be used. Some instances of this field may be defaulted, in others it may be required.
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
description: 'Name of the resource being referred to. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
|
||||||
|
type: string
|
||||||
|
pkcs12:
|
||||||
|
description: PKCS12 configures options for storing a PKCS12 keystore in the `spec.secretName` Secret resource.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- create
|
||||||
|
- passwordSecretRef
|
||||||
|
properties:
|
||||||
|
create:
|
||||||
|
description: Create enables PKCS12 keystore creation for the Certificate. If true, a file named `keystore.p12` will be created in the target Secret resource, encrypted using the password stored in `passwordSecretRef`. The keystore file will be updated immediately. If the issuer provided a CA certificate, a file named `truststore.p12` will also be created in the target Secret resource, encrypted using the password stored in `passwordSecretRef` containing the issuing Certificate Authority
|
||||||
|
type: boolean
|
||||||
|
passwordSecretRef:
|
||||||
|
description: PasswordSecretRef is a reference to a key in a Secret resource containing the password used to encrypt the PKCS12 keystore.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
properties:
|
||||||
|
key:
|
||||||
|
description: The key of the entry in the Secret resource's `data` field to be used. Some instances of this field may be defaulted, in others it may be required.
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
description: 'Name of the resource being referred to. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
|
||||||
|
type: string
|
||||||
|
profile:
|
||||||
|
description: "Profile specifies the key and certificate encryption algorithms and the HMAC algorithm used to create the PKCS12 keystore. Default value is `LegacyRC2` for backward compatibility. \n If provided, allowed values are: `LegacyRC2`: Deprecated. Not supported by default in OpenSSL 3 or Java 20. `LegacyDES`: Less secure algorithm. Use this option for maximal compatibility. `Modern2023`: Secure algorithm. Use this option in case you have to always use secure algorithms (eg. because of company policy). Please note that the security of the algorithm is not that important in reality, because the unencrypted certificate and private key are also stored in the Secret."
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- LegacyRC2
|
||||||
|
- LegacyDES
|
||||||
|
- Modern2023
|
||||||
|
literalSubject:
|
||||||
|
description: "Requested X.509 certificate subject, represented using the LDAP \"String Representation of a Distinguished Name\" [1]. Important: the LDAP string format also specifies the order of the attributes in the subject, this is important when issuing certs for LDAP authentication. Example: `CN=foo,DC=corp,DC=example,DC=com` More info [1]: https://datatracker.ietf.org/doc/html/rfc4514 More info: https://github.com/cert-manager/cert-manager/issues/3203 More info: https://github.com/cert-manager/cert-manager/issues/4424 \n Cannot be set if the `subject` or `commonName` field is set. This is an Alpha Feature and is only enabled with the `--feature-gates=LiteralCertificateSubject=true` option set on both the controller and webhook components."
|
||||||
|
type: string
|
||||||
|
nameConstraints:
|
||||||
|
description: "x.509 certificate NameConstraint extension which MUST NOT be used in a non-CA certificate. More Info: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.10 \n This is an Alpha Feature and is only enabled with the `--feature-gates=NameConstraints=true` option set on both the controller and webhook components."
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
critical:
|
||||||
|
description: if true then the name constraints are marked critical.
|
||||||
|
type: boolean
|
||||||
|
excluded:
|
||||||
|
description: Excluded contains the constraints which must be disallowed. Any name matching a restriction in the excluded field is invalid regardless of information appearing in the permitted
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
dnsDomains:
|
||||||
|
description: DNSDomains is a list of DNS domains that are permitted or excluded.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
emailAddresses:
|
||||||
|
description: EmailAddresses is a list of Email Addresses that are permitted or excluded.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
ipRanges:
|
||||||
|
description: IPRanges is a list of IP Ranges that are permitted or excluded. This should be a valid CIDR notation.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
uriDomains:
|
||||||
|
description: URIDomains is a list of URI domains that are permitted or excluded.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
permitted:
|
||||||
|
description: Permitted contains the constraints in which the names must be located.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
dnsDomains:
|
||||||
|
description: DNSDomains is a list of DNS domains that are permitted or excluded.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
emailAddresses:
|
||||||
|
description: EmailAddresses is a list of Email Addresses that are permitted or excluded.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
ipRanges:
|
||||||
|
description: IPRanges is a list of IP Ranges that are permitted or excluded. This should be a valid CIDR notation.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
uriDomains:
|
||||||
|
description: URIDomains is a list of URI domains that are permitted or excluded.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
otherNames:
|
||||||
|
description: '`otherNames` is an escape hatch for SAN that allows any type. We currently restrict the support to string like otherNames, cf RFC 5280 p 37 Any UTF8 String valued otherName can be passed with by setting the keys oid: x.x.x.x and UTF8Value: somevalue for `otherName`. Most commonly this would be UPN set with oid: 1.3.6.1.4.1.311.20.2.3 You should ensure that any OID passed is valid for the UTF8String type as we do not explicitly validate this.'
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
oid:
|
||||||
|
description: OID is the object identifier for the otherName SAN. The object identifier must be expressed as a dotted string, for example, "1.2.840.113556.1.4.221".
|
||||||
|
type: string
|
||||||
|
utf8Value:
|
||||||
|
description: utf8Value is the string value of the otherName SAN. The utf8Value accepts any valid UTF8 string to set as value for the otherName SAN.
|
||||||
|
type: string
|
||||||
|
privateKey:
|
||||||
|
description: Private key options. These include the key algorithm and size, the used encoding and the rotation policy.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
algorithm:
|
||||||
|
description: "Algorithm is the private key algorithm of the corresponding private key for this certificate. \n If provided, allowed values are either `RSA`, `ECDSA` or `Ed25519`. If `algorithm` is specified and `size` is not provided, key size of 2048 will be used for `RSA` key algorithm and key size of 256 will be used for `ECDSA` key algorithm. key size is ignored when using the `Ed25519` key algorithm."
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- RSA
|
||||||
|
- ECDSA
|
||||||
|
- Ed25519
|
||||||
|
encoding:
|
||||||
|
description: "The private key cryptography standards (PKCS) encoding for this certificate's private key to be encoded in. \n If provided, allowed values are `PKCS1` and `PKCS8` standing for PKCS#1 and PKCS#8, respectively. Defaults to `PKCS1` if not specified."
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- PKCS1
|
||||||
|
- PKCS8
|
||||||
|
rotationPolicy:
|
||||||
|
description: "RotationPolicy controls how private keys should be regenerated when a re-issuance is being processed. \n If set to `Never`, a private key will only be generated if one does not already exist in the target `spec.secretName`. If one does exists but it does not have the correct algorithm or size, a warning will be raised to await user intervention. If set to `Always`, a private key matching the specified requirements will be generated whenever a re-issuance occurs. Default is `Never` for backward compatibility."
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- Never
|
||||||
|
- Always
|
||||||
|
size:
|
||||||
|
description: "Size is the key bit size of the corresponding private key for this certificate. \n If `algorithm` is set to `RSA`, valid values are `2048`, `4096` or `8192`, and will default to `2048` if not specified. If `algorithm` is set to `ECDSA`, valid values are `256`, `384` or `521`, and will default to `256` if not specified. If `algorithm` is set to `Ed25519`, Size is ignored. No other values are allowed."
|
||||||
|
type: integer
|
||||||
|
renewBefore:
|
||||||
|
description: "How long before the currently issued certificate's expiry cert-manager should renew the certificate. For example, if a certificate is valid for 60 minutes, and `renewBefore=10m`, cert-manager will begin to attempt to renew the certificate 50 minutes after it was issued (i.e. when there are 10 minutes remaining until the certificate is no longer valid). \n NOTE: The actual lifetime of the issued certificate is used to determine the renewal time. If an issuer returns a certificate with a different lifetime than the one requested, cert-manager will use the lifetime of the issued certificate. \n If unset, this defaults to 1/3 of the issued certificate's lifetime. Minimum accepted value is 5 minutes. Value must be in units accepted by Go time.ParseDuration https://golang.org/pkg/time/#ParseDuration."
|
||||||
|
type: string
|
||||||
|
revisionHistoryLimit:
|
||||||
|
description: "The maximum number of CertificateRequest revisions that are maintained in the Certificate's history. Each revision represents a single `CertificateRequest` created by this Certificate, either when it was created, renewed, or Spec was changed. Revisions will be removed by oldest first if the number of revisions exceeds this number. \n If set, revisionHistoryLimit must be a value of `1` or greater. If unset (`nil`), revisions will not be garbage collected. Default value is `nil`."
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
secretName:
|
||||||
|
description: Name of the Secret resource that will be automatically created and managed by this Certificate resource. It will be populated with a private key and certificate, signed by the denoted issuer. The Secret resource lives in the same namespace as the Certificate resource.
|
||||||
|
type: string
|
||||||
|
secretTemplate:
|
||||||
|
description: Defines annotations and labels to be copied to the Certificate's Secret. Labels and annotations on the Secret will be changed as they appear on the SecretTemplate when added or removed. SecretTemplate annotations are added in conjunction with, and cannot overwrite, the base set of annotations cert-manager sets on the Certificate's Secret.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
annotations:
|
||||||
|
description: Annotations is a key value map to be copied to the target Kubernetes Secret.
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
labels:
|
||||||
|
description: Labels is a key value map to be copied to the target Kubernetes Secret.
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
subject:
|
||||||
|
description: "Requested set of X509 certificate subject attributes. More info: https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6 \n The common name attribute is specified separately in the `commonName` field. Cannot be set if the `literalSubject` field is set."
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
countries:
|
||||||
|
description: Countries to be used on the Certificate.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
localities:
|
||||||
|
description: Cities to be used on the Certificate.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
organizationalUnits:
|
||||||
|
description: Organizational Units to be used on the Certificate.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
organizations:
|
||||||
|
description: Organizations to be used on the Certificate.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
postalCodes:
|
||||||
|
description: Postal codes to be used on the Certificate.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
provinces:
|
||||||
|
description: State/Provinces to be used on the Certificate.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
serialNumber:
|
||||||
|
description: Serial number to be used on the Certificate.
|
||||||
|
type: string
|
||||||
|
streetAddresses:
|
||||||
|
description: Street addresses to be used on the Certificate.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
uris:
|
||||||
|
description: Requested URI subject alternative names.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
usages:
|
||||||
|
description: "Requested key usages and extended key usages. These usages are used to set the `usages` field on the created CertificateRequest resources. If `encodeUsagesInRequest` is unset or set to `true`, the usages will additionally be encoded in the `request` field which contains the CSR blob. \n If unset, defaults to `digital signature` and `key encipherment`."
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
description: "KeyUsage specifies valid usage contexts for keys. See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 https://tools.ietf.org/html/rfc5280#section-4.2.1.12 \n Valid KeyUsage values are as follows: \"signing\", \"digital signature\", \"content commitment\", \"key encipherment\", \"key agreement\", \"data encipherment\", \"cert sign\", \"crl sign\", \"encipher only\", \"decipher only\", \"any\", \"server auth\", \"client auth\", \"code signing\", \"email protection\", \"s/mime\", \"ipsec end system\", \"ipsec tunnel\", \"ipsec user\", \"timestamping\", \"ocsp signing\", \"microsoft sgc\", \"netscape sgc\""
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- signing
|
||||||
|
- digital signature
|
||||||
|
- content commitment
|
||||||
|
- key encipherment
|
||||||
|
- key agreement
|
||||||
|
- data encipherment
|
||||||
|
- cert sign
|
||||||
|
- crl sign
|
||||||
|
- encipher only
|
||||||
|
- decipher only
|
||||||
|
- any
|
||||||
|
- server auth
|
||||||
|
- client auth
|
||||||
|
- code signing
|
||||||
|
- email protection
|
||||||
|
- s/mime
|
||||||
|
- ipsec end system
|
||||||
|
- ipsec tunnel
|
||||||
|
- ipsec user
|
||||||
|
- timestamping
|
||||||
|
- ocsp signing
|
||||||
|
- microsoft sgc
|
||||||
|
- netscape sgc
|
||||||
|
status:
|
||||||
|
description: 'Status of the Certificate. This is set and managed automatically. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
conditions:
|
||||||
|
description: List of status conditions to indicate the status of certificates. Known condition types are `Ready` and `Issuing`.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
description: CertificateCondition contains condition information for an Certificate.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- status
|
||||||
|
- type
|
||||||
|
properties:
|
||||||
|
lastTransitionTime:
|
||||||
|
description: LastTransitionTime is the timestamp corresponding to the last status change of this condition.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
message:
|
||||||
|
description: Message is a human readable description of the details of the last transition, complementing reason.
|
||||||
|
type: string
|
||||||
|
observedGeneration:
|
||||||
|
description: If set, this represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date with respect to the current state of the Certificate.
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
reason:
|
||||||
|
description: Reason is a brief machine readable explanation for the condition's last transition.
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
description: Status of the condition, one of (`True`, `False`, `Unknown`).
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- "True"
|
||||||
|
- "False"
|
||||||
|
- Unknown
|
||||||
|
type:
|
||||||
|
description: Type of the condition, known values are (`Ready`, `Issuing`).
|
||||||
|
type: string
|
||||||
|
x-kubernetes-list-map-keys:
|
||||||
|
- type
|
||||||
|
x-kubernetes-list-type: map
|
||||||
|
failedIssuanceAttempts:
|
||||||
|
description: The number of continuous failed issuance attempts up till now. This field gets removed (if set) on a successful issuance and gets set to 1 if unset and an issuance has failed. If an issuance has failed, the delay till the next issuance will be calculated using formula time.Hour * 2 ^ (failedIssuanceAttempts - 1).
|
||||||
|
type: integer
|
||||||
|
lastFailureTime:
|
||||||
|
description: LastFailureTime is set only if the lastest issuance for this Certificate failed and contains the time of the failure. If an issuance has failed, the delay till the next issuance will be calculated using formula time.Hour * 2 ^ (failedIssuanceAttempts - 1). If the latest issuance has succeeded this field will be unset.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
nextPrivateKeySecretName:
|
||||||
|
description: The name of the Secret resource containing the private key to be used for the next certificate iteration. The keymanager controller will automatically set this field if the `Issuing` condition is set to `True`. It will automatically unset this field when the Issuing condition is not set or False.
|
||||||
|
type: string
|
||||||
|
notAfter:
|
||||||
|
description: The expiration time of the certificate stored in the secret named by this resource in `spec.secretName`.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
notBefore:
|
||||||
|
description: The time after which the certificate stored in the secret named by this resource in `spec.secretName` is valid.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
renewalTime:
|
||||||
|
description: RenewalTime is the time at which the certificate will be next renewed. If not set, no upcoming renewal is scheduled.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
revision:
|
||||||
|
description: "The current 'revision' of the certificate as issued. \n When a CertificateRequest resource is created, it will have the `cert-manager.io/certificate-revision` set to one greater than the current value of this field. \n Upon issuance, this field will be set to the value of the annotation on the CertificateRequest resource used to issue the certificate. \n Persisting the value on the CertificateRequest resource allows the certificates controller to know whether a request is part of an old issuance or if it is part of the ongoing revision's issuance by checking if the revision value in the annotation is greater than this field."
|
||||||
|
type: integer
|
||||||
|
served: true
|
||||||
|
storage: true
|
196
modules/bootstrap-kube-system/manifests/certificaterequest.yaml
Normal file
196
modules/bootstrap-kube-system/manifests/certificaterequest.yaml
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata:
|
||||||
|
name: certificaterequests.cert-manager.io
|
||||||
|
labels:
|
||||||
|
app: 'cert-manager'
|
||||||
|
app.kubernetes.io/name: 'cert-manager'
|
||||||
|
app.kubernetes.io/instance: 'cert-manager'
|
||||||
|
# Generated labels
|
||||||
|
app.kubernetes.io/version: "v1.14.4"
|
||||||
|
spec:
|
||||||
|
group: cert-manager.io
|
||||||
|
names:
|
||||||
|
kind: CertificateRequest
|
||||||
|
listKind: CertificateRequestList
|
||||||
|
plural: certificaterequests
|
||||||
|
shortNames:
|
||||||
|
- cr
|
||||||
|
- crs
|
||||||
|
singular: certificaterequest
|
||||||
|
categories:
|
||||||
|
- cert-manager
|
||||||
|
scope: Namespaced
|
||||||
|
versions:
|
||||||
|
- name: v1
|
||||||
|
subresources:
|
||||||
|
status: {}
|
||||||
|
additionalPrinterColumns:
|
||||||
|
- jsonPath: .status.conditions[?(@.type=="Approved")].status
|
||||||
|
name: Approved
|
||||||
|
type: string
|
||||||
|
- jsonPath: .status.conditions[?(@.type=="Denied")].status
|
||||||
|
name: Denied
|
||||||
|
type: string
|
||||||
|
- jsonPath: .status.conditions[?(@.type=="Ready")].status
|
||||||
|
name: Ready
|
||||||
|
type: string
|
||||||
|
- jsonPath: .spec.issuerRef.name
|
||||||
|
name: Issuer
|
||||||
|
type: string
|
||||||
|
- jsonPath: .spec.username
|
||||||
|
name: Requestor
|
||||||
|
type: string
|
||||||
|
- jsonPath: .status.conditions[?(@.type=="Ready")].message
|
||||||
|
name: Status
|
||||||
|
priority: 1
|
||||||
|
type: string
|
||||||
|
- jsonPath: .metadata.creationTimestamp
|
||||||
|
description: CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
|
||||||
|
name: Age
|
||||||
|
type: date
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
description: "A CertificateRequest is used to request a signed certificate from one of the configured issuers. \n All fields within the CertificateRequest's `spec` are immutable after creation. A CertificateRequest will either succeed or fail, as denoted by its `Ready` status condition and its `status.failureTime` field. \n A CertificateRequest is a one-shot resource, meaning it represents a single point in time request for a certificate and cannot be re-used."
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
apiVersion:
|
||||||
|
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||||
|
type: string
|
||||||
|
kind:
|
||||||
|
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||||
|
type: string
|
||||||
|
metadata:
|
||||||
|
type: object
|
||||||
|
spec:
|
||||||
|
description: Specification of the desired state of the CertificateRequest resource. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- issuerRef
|
||||||
|
- request
|
||||||
|
properties:
|
||||||
|
duration:
|
||||||
|
description: Requested 'duration' (i.e. lifetime) of the Certificate. Note that the issuer may choose to ignore the requested duration, just like any other requested attribute.
|
||||||
|
type: string
|
||||||
|
extra:
|
||||||
|
description: Extra contains extra attributes of the user that created the CertificateRequest. Populated by the cert-manager webhook on creation and immutable.
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
groups:
|
||||||
|
description: Groups contains group membership of the user that created the CertificateRequest. Populated by the cert-manager webhook on creation and immutable.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
|
isCA:
|
||||||
|
description: "Requested basic constraints isCA value. Note that the issuer may choose to ignore the requested isCA value, just like any other requested attribute. \n NOTE: If the CSR in the `Request` field has a BasicConstraints extension, it must have the same isCA value as specified here. \n If true, this will automatically add the `cert sign` usage to the list of requested `usages`."
|
||||||
|
type: boolean
|
||||||
|
issuerRef:
|
||||||
|
description: "Reference to the issuer responsible for issuing the certificate. If the issuer is namespace-scoped, it must be in the same namespace as the Certificate. If the issuer is cluster-scoped, it can be used from any namespace. \n The `name` field of the reference must always be specified."
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
properties:
|
||||||
|
group:
|
||||||
|
description: Group of the resource being referred to.
|
||||||
|
type: string
|
||||||
|
kind:
|
||||||
|
description: Kind of the resource being referred to.
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
description: Name of the resource being referred to.
|
||||||
|
type: string
|
||||||
|
request:
|
||||||
|
description: "The PEM-encoded X.509 certificate signing request to be submitted to the issuer for signing. \n If the CSR has a BasicConstraints extension, its isCA attribute must match the `isCA` value of this CertificateRequest. If the CSR has a KeyUsage extension, its key usages must match the key usages in the `usages` field of this CertificateRequest. If the CSR has a ExtKeyUsage extension, its extended key usages must match the extended key usages in the `usages` field of this CertificateRequest."
|
||||||
|
type: string
|
||||||
|
format: byte
|
||||||
|
uid:
|
||||||
|
description: UID contains the uid of the user that created the CertificateRequest. Populated by the cert-manager webhook on creation and immutable.
|
||||||
|
type: string
|
||||||
|
usages:
|
||||||
|
description: "Requested key usages and extended key usages. \n NOTE: If the CSR in the `Request` field has uses the KeyUsage or ExtKeyUsage extension, these extensions must have the same values as specified here without any additional values. \n If unset, defaults to `digital signature` and `key encipherment`."
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
description: "KeyUsage specifies valid usage contexts for keys. See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 https://tools.ietf.org/html/rfc5280#section-4.2.1.12 \n Valid KeyUsage values are as follows: \"signing\", \"digital signature\", \"content commitment\", \"key encipherment\", \"key agreement\", \"data encipherment\", \"cert sign\", \"crl sign\", \"encipher only\", \"decipher only\", \"any\", \"server auth\", \"client auth\", \"code signing\", \"email protection\", \"s/mime\", \"ipsec end system\", \"ipsec tunnel\", \"ipsec user\", \"timestamping\", \"ocsp signing\", \"microsoft sgc\", \"netscape sgc\""
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- signing
|
||||||
|
- digital signature
|
||||||
|
- content commitment
|
||||||
|
- key encipherment
|
||||||
|
- key agreement
|
||||||
|
- data encipherment
|
||||||
|
- cert sign
|
||||||
|
- crl sign
|
||||||
|
- encipher only
|
||||||
|
- decipher only
|
||||||
|
- any
|
||||||
|
- server auth
|
||||||
|
- client auth
|
||||||
|
- code signing
|
||||||
|
- email protection
|
||||||
|
- s/mime
|
||||||
|
- ipsec end system
|
||||||
|
- ipsec tunnel
|
||||||
|
- ipsec user
|
||||||
|
- timestamping
|
||||||
|
- ocsp signing
|
||||||
|
- microsoft sgc
|
||||||
|
- netscape sgc
|
||||||
|
username:
|
||||||
|
description: Username contains the name of the user that created the CertificateRequest. Populated by the cert-manager webhook on creation and immutable.
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
description: 'Status of the CertificateRequest. This is set and managed automatically. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
ca:
|
||||||
|
description: The PEM encoded X.509 certificate of the signer, also known as the CA (Certificate Authority). This is set on a best-effort basis by different issuers. If not set, the CA is assumed to be unknown/not available.
|
||||||
|
type: string
|
||||||
|
format: byte
|
||||||
|
certificate:
|
||||||
|
description: The PEM encoded X.509 certificate resulting from the certificate signing request. If not set, the CertificateRequest has either not been completed or has failed. More information on failure can be found by checking the `conditions` field.
|
||||||
|
type: string
|
||||||
|
format: byte
|
||||||
|
conditions:
|
||||||
|
description: List of status conditions to indicate the status of a CertificateRequest. Known condition types are `Ready`, `InvalidRequest`, `Approved` and `Denied`.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
description: CertificateRequestCondition contains condition information for a CertificateRequest.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- status
|
||||||
|
- type
|
||||||
|
properties:
|
||||||
|
lastTransitionTime:
|
||||||
|
description: LastTransitionTime is the timestamp corresponding to the last status change of this condition.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
message:
|
||||||
|
description: Message is a human readable description of the details of the last transition, complementing reason.
|
||||||
|
type: string
|
||||||
|
reason:
|
||||||
|
description: Reason is a brief machine readable explanation for the condition's last transition.
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
description: Status of the condition, one of (`True`, `False`, `Unknown`).
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- "True"
|
||||||
|
- "False"
|
||||||
|
- Unknown
|
||||||
|
type:
|
||||||
|
description: Type of the condition, known values are (`Ready`, `InvalidRequest`, `Approved`, `Denied`).
|
||||||
|
type: string
|
||||||
|
x-kubernetes-list-map-keys:
|
||||||
|
- type
|
||||||
|
x-kubernetes-list-type: map
|
||||||
|
failureTime:
|
||||||
|
description: FailureTime stores the time that this CertificateRequest failed. This is used to influence garbage collection and back-off.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
served: true
|
||||||
|
storage: true
|
1124
modules/bootstrap-kube-system/manifests/challenge.yaml
Normal file
1124
modules/bootstrap-kube-system/manifests/challenge.yaml
Normal file
File diff suppressed because it is too large
Load diff
1371
modules/bootstrap-kube-system/manifests/clusterissuer.yaml
Normal file
1371
modules/bootstrap-kube-system/manifests/clusterissuer.yaml
Normal file
File diff suppressed because it is too large
Load diff
1371
modules/bootstrap-kube-system/manifests/issuer.yaml
Normal file
1371
modules/bootstrap-kube-system/manifests/issuer.yaml
Normal file
File diff suppressed because it is too large
Load diff
180
modules/bootstrap-kube-system/manifests/order.yaml
Normal file
180
modules/bootstrap-kube-system/manifests/order.yaml
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata:
|
||||||
|
name: orders.acme.cert-manager.io
|
||||||
|
labels:
|
||||||
|
app: 'cert-manager'
|
||||||
|
app.kubernetes.io/name: 'cert-manager'
|
||||||
|
app.kubernetes.io/instance: 'cert-manager'
|
||||||
|
# Generated labels
|
||||||
|
app.kubernetes.io/version: "v1.14.4"
|
||||||
|
spec:
|
||||||
|
group: acme.cert-manager.io
|
||||||
|
names:
|
||||||
|
kind: Order
|
||||||
|
listKind: OrderList
|
||||||
|
plural: orders
|
||||||
|
singular: order
|
||||||
|
categories:
|
||||||
|
- cert-manager
|
||||||
|
- cert-manager-acme
|
||||||
|
scope: Namespaced
|
||||||
|
versions:
|
||||||
|
- name: v1
|
||||||
|
subresources:
|
||||||
|
status: {}
|
||||||
|
additionalPrinterColumns:
|
||||||
|
- jsonPath: .status.state
|
||||||
|
name: State
|
||||||
|
type: string
|
||||||
|
- jsonPath: .spec.issuerRef.name
|
||||||
|
name: Issuer
|
||||||
|
priority: 1
|
||||||
|
type: string
|
||||||
|
- jsonPath: .status.reason
|
||||||
|
name: Reason
|
||||||
|
priority: 1
|
||||||
|
type: string
|
||||||
|
- jsonPath: .metadata.creationTimestamp
|
||||||
|
description: CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
|
||||||
|
name: Age
|
||||||
|
type: date
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
description: Order is a type to represent an Order with an ACME server
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- metadata
|
||||||
|
- spec
|
||||||
|
properties:
|
||||||
|
apiVersion:
|
||||||
|
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||||
|
type: string
|
||||||
|
kind:
|
||||||
|
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||||
|
type: string
|
||||||
|
metadata:
|
||||||
|
type: object
|
||||||
|
spec:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- issuerRef
|
||||||
|
- request
|
||||||
|
properties:
|
||||||
|
commonName:
|
||||||
|
description: CommonName is the common name as specified on the DER encoded CSR. If specified, this value must also be present in `dnsNames` or `ipAddresses`. This field must match the corresponding field on the DER encoded CSR.
|
||||||
|
type: string
|
||||||
|
dnsNames:
|
||||||
|
description: DNSNames is a list of DNS names that should be included as part of the Order validation process. This field must match the corresponding field on the DER encoded CSR.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
duration:
|
||||||
|
description: Duration is the duration for the not after date for the requested certificate. this is set on order creation as pe the ACME spec.
|
||||||
|
type: string
|
||||||
|
ipAddresses:
|
||||||
|
description: IPAddresses is a list of IP addresses that should be included as part of the Order validation process. This field must match the corresponding field on the DER encoded CSR.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
issuerRef:
|
||||||
|
description: IssuerRef references a properly configured ACME-type Issuer which should be used to create this Order. If the Issuer does not exist, processing will be retried. If the Issuer is not an 'ACME' Issuer, an error will be returned and the Order will be marked as failed.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
properties:
|
||||||
|
group:
|
||||||
|
description: Group of the resource being referred to.
|
||||||
|
type: string
|
||||||
|
kind:
|
||||||
|
description: Kind of the resource being referred to.
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
description: Name of the resource being referred to.
|
||||||
|
type: string
|
||||||
|
request:
|
||||||
|
description: Certificate signing request bytes in DER encoding. This will be used when finalizing the order. This field must be set on the order.
|
||||||
|
type: string
|
||||||
|
format: byte
|
||||||
|
status:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
authorizations:
|
||||||
|
description: Authorizations contains data returned from the ACME server on what authorizations must be completed in order to validate the DNS names specified on the Order.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
description: ACMEAuthorization contains data returned from the ACME server on an authorization that must be completed in order validate a DNS name on an ACME Order resource.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- url
|
||||||
|
properties:
|
||||||
|
challenges:
|
||||||
|
description: Challenges specifies the challenge types offered by the ACME server. One of these challenge types will be selected when validating the DNS name and an appropriate Challenge resource will be created to perform the ACME challenge process.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
description: Challenge specifies a challenge offered by the ACME server for an Order. An appropriate Challenge resource can be created to perform the ACME challenge process.
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- token
|
||||||
|
- type
|
||||||
|
- url
|
||||||
|
properties:
|
||||||
|
token:
|
||||||
|
description: Token is the token that must be presented for this challenge. This is used to compute the 'key' that must also be presented.
|
||||||
|
type: string
|
||||||
|
type:
|
||||||
|
description: Type is the type of challenge being offered, e.g. 'http-01', 'dns-01', 'tls-sni-01', etc. This is the raw value retrieved from the ACME server. Only 'http-01' and 'dns-01' are supported by cert-manager, other values will be ignored.
|
||||||
|
type: string
|
||||||
|
url:
|
||||||
|
description: URL is the URL of this challenge. It can be used to retrieve additional metadata about the Challenge from the ACME server.
|
||||||
|
type: string
|
||||||
|
identifier:
|
||||||
|
description: Identifier is the DNS name to be validated as part of this authorization
|
||||||
|
type: string
|
||||||
|
initialState:
|
||||||
|
description: InitialState is the initial state of the ACME authorization when first fetched from the ACME server. If an Authorization is already 'valid', the Order controller will not create a Challenge resource for the authorization. This will occur when working with an ACME server that enables 'authz reuse' (such as Let's Encrypt's production endpoint). If not set and 'identifier' is set, the state is assumed to be pending and a Challenge will be created.
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- valid
|
||||||
|
- ready
|
||||||
|
- pending
|
||||||
|
- processing
|
||||||
|
- invalid
|
||||||
|
- expired
|
||||||
|
- errored
|
||||||
|
url:
|
||||||
|
description: URL is the URL of the Authorization that must be completed
|
||||||
|
type: string
|
||||||
|
wildcard:
|
||||||
|
description: Wildcard will be true if this authorization is for a wildcard DNS name. If this is true, the identifier will be the *non-wildcard* version of the DNS name. For example, if '*.example.com' is the DNS name being validated, this field will be 'true' and the 'identifier' field will be 'example.com'.
|
||||||
|
type: boolean
|
||||||
|
certificate:
|
||||||
|
description: Certificate is a copy of the PEM encoded certificate for this Order. This field will be populated after the order has been successfully finalized with the ACME server, and the order has transitioned to the 'valid' state.
|
||||||
|
type: string
|
||||||
|
format: byte
|
||||||
|
failureTime:
|
||||||
|
description: FailureTime stores the time that this order failed. This is used to influence garbage collection and back-off.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
finalizeURL:
|
||||||
|
description: FinalizeURL of the Order. This is used to obtain certificates for this order once it has been completed.
|
||||||
|
type: string
|
||||||
|
reason:
|
||||||
|
description: Reason optionally provides more information about a why the order is in the current state.
|
||||||
|
type: string
|
||||||
|
state:
|
||||||
|
description: State contains the current state of this Order resource. States 'success' and 'expired' are 'final'
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- valid
|
||||||
|
- ready
|
||||||
|
- pending
|
||||||
|
- processing
|
||||||
|
- invalid
|
||||||
|
- expired
|
||||||
|
- errored
|
||||||
|
url:
|
||||||
|
description: URL of the Order. This will initially be empty when the resource is first created. The Order controller will populate this field when the Order is first processed. This field will be immutable after it is initially set.
|
||||||
|
type: string
|
||||||
|
served: true
|
||||||
|
storage: true
|
40
modules/cyberchef.nix
Normal file
40
modules/cyberchef.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{ config, lib, globals, ... }: {
|
||||||
|
options.cyberchef.enable = lib.mkEnableOption "cyberchef";
|
||||||
|
|
||||||
|
config = lib.mkIf config.cyberchef.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
deployments.cyberchef.spec = {
|
||||||
|
replicas = 3;
|
||||||
|
selector.matchLabels.app = "cyberchef";
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "cyberchef";
|
||||||
|
|
||||||
|
spec.containers.cyberchef = {
|
||||||
|
image = globals.images.cyberchef;
|
||||||
|
imagePullPolicy = "Always";
|
||||||
|
ports.web.containerPort = 8000;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.cyberchef.spec = {
|
||||||
|
selector.app = "cyberchef";
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab.ingresses.cyberchef = {
|
||||||
|
host = "cyberchef.kun.is";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "cyberchef";
|
||||||
|
portName = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
33
modules/default.nix
Normal file
33
modules/default.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./inbucket.nix
|
||||||
|
./tailscale-ingress.nix
|
||||||
|
./longhorn-volume.nix
|
||||||
|
./ingress.nix
|
||||||
|
./dummy-types.nix
|
||||||
|
./dnsmasq.nix
|
||||||
|
./bootstrap-default.nix
|
||||||
|
./bootstrap-kube-system
|
||||||
|
./cyberchef.nix
|
||||||
|
./freshrss.nix
|
||||||
|
./radicale.nix
|
||||||
|
./kms.nix
|
||||||
|
./atuin.nix
|
||||||
|
./blog.nix
|
||||||
|
./nextcloud.nix
|
||||||
|
./hedgedoc.nix
|
||||||
|
./kitchenowl.nix
|
||||||
|
./forgejo
|
||||||
|
./paperless.nix
|
||||||
|
./syncthing.nix
|
||||||
|
./pihole.nix
|
||||||
|
./immich.nix
|
||||||
|
./attic.nix
|
||||||
|
./bind9
|
||||||
|
./media.nix
|
||||||
|
./traefik.nix
|
||||||
|
./tailscale.nix
|
||||||
|
./ntfy.nix
|
||||||
|
./minecraft.nix
|
||||||
|
];
|
||||||
|
}
|
61
modules/dnsmasq.nix
Normal file
61
modules/dnsmasq.nix
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
{ globals, config, lib, ... }: {
|
||||||
|
options.dnsmasq.enable = lib.mkEnableOption "dnsmasq";
|
||||||
|
|
||||||
|
config = lib.mkIf config.dnsmasq.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
configMaps.dnsmasq-config.data.config = ''
|
||||||
|
address=/kms.kun.is/${globals.kmsIPv4}
|
||||||
|
address=/ssh.git.kun.is/${globals.gitIPv4}
|
||||||
|
alias=${globals.routerPublicIPv4},${globals.traefikIPv4}
|
||||||
|
expand-hosts
|
||||||
|
host-record=hermes.dmz,${globals.dnsmasqIPv4}
|
||||||
|
local=/dmz/
|
||||||
|
log-queries
|
||||||
|
no-hosts
|
||||||
|
no-resolv
|
||||||
|
port=53
|
||||||
|
server=192.168.30.1
|
||||||
|
server=/kun.is/${globals.bind9IPv4}
|
||||||
|
'';
|
||||||
|
|
||||||
|
deployments.dnsmasq.spec = {
|
||||||
|
selector.matchLabels.app = "dnsmasq";
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "dnsmasq";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.dnsmasq = {
|
||||||
|
image = globals.images.dnsmasq;
|
||||||
|
|
||||||
|
ports.dns = {
|
||||||
|
containerPort = 53;
|
||||||
|
protocol = "UDP";
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/etc/dnsmasq.conf";
|
||||||
|
subPath = "config";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes.config.configMap.name = "dnsmasq-config";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.dnsmasq.spec = {
|
||||||
|
loadBalancerIP = globals.dnsmasqIPv4;
|
||||||
|
type = "LoadBalancer";
|
||||||
|
selector.app = "dnsmasq";
|
||||||
|
|
||||||
|
ports.dns = {
|
||||||
|
port = 53;
|
||||||
|
targetPort = "dns";
|
||||||
|
protocol = "UDP";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
42
modules/dummy-types.nix
Normal file
42
modules/dummy-types.nix
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{
|
||||||
|
kubernetes.customTypes = {
|
||||||
|
# HACK: These are dummy custom types.
|
||||||
|
# This is needed, because the CRDs imported as a chart are not available as Nix modules.
|
||||||
|
# There is no nix-based validation on resources defined using these types!
|
||||||
|
# See: https://github.com/hall/kubenix/issues/34
|
||||||
|
ipAddressPool = {
|
||||||
|
attrName = "ipAddressPools";
|
||||||
|
group = "metallb.io";
|
||||||
|
version = "v1beta1";
|
||||||
|
kind = "IPAddressPool";
|
||||||
|
};
|
||||||
|
|
||||||
|
l2Advertisement = {
|
||||||
|
attrName = "l2Advertisements";
|
||||||
|
group = "metallb.io";
|
||||||
|
version = "v1beta1";
|
||||||
|
kind = "L2Advertisement";
|
||||||
|
};
|
||||||
|
|
||||||
|
helmChartConfig = {
|
||||||
|
attrName = "helmChartConfigs";
|
||||||
|
group = "helm.cattle.io";
|
||||||
|
version = "v1";
|
||||||
|
kind = "HelmChartConfig";
|
||||||
|
};
|
||||||
|
|
||||||
|
clusterIssuer = {
|
||||||
|
attrName = "clusterIssuers";
|
||||||
|
group = "cert-manager.io";
|
||||||
|
version = "v1";
|
||||||
|
kind = "ClusterIssuer";
|
||||||
|
};
|
||||||
|
|
||||||
|
recurringJob = {
|
||||||
|
attrName = "recurringJobs";
|
||||||
|
group = "longhorn.io";
|
||||||
|
version = "v1beta1";
|
||||||
|
kind = "RecurringJob";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
104
modules/forgejo/config.nix
Normal file
104
modules/forgejo/config.nix
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
{
|
||||||
|
"repository.local".LOCAL_COPY_PATH = "/data/gitea/tmp/local-repo";
|
||||||
|
"repository.upload".TEMP_PATH = "/data/gitea/uploads";
|
||||||
|
attachment.PATH = "/data/gitea/attachments";
|
||||||
|
lfs.PATH = "/data/git/lfs";
|
||||||
|
mailer.ENABLED = false;
|
||||||
|
"repository.pull-request".DEFAULT_MERGE_STYLE = "merge";
|
||||||
|
"repository.signing".DEFAULT_TRUST_MODEL = "committer";
|
||||||
|
ui.DEFAULT_THEME = "forgejo-light";
|
||||||
|
oauth2 = {
|
||||||
|
ENABLED = false;
|
||||||
|
JWT_SECRET = "ref+sops://secrets.yml#/forgejo/jwtSecret";
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFAULT = {
|
||||||
|
APP_NAME = "Forgejo: Beyond coding. We forge.";
|
||||||
|
RUN_MODE = "prod";
|
||||||
|
RUN_USER = "git";
|
||||||
|
WORK_PATH = "/data/gitea";
|
||||||
|
};
|
||||||
|
|
||||||
|
repository = {
|
||||||
|
ROOT = "/data/git/repositories";
|
||||||
|
DEFAULT_BRANCH = "master";
|
||||||
|
};
|
||||||
|
|
||||||
|
server = {
|
||||||
|
APP_DATA_PATH = "/data/gitea";
|
||||||
|
DOMAIN = "git.kun.is";
|
||||||
|
SSH_DOMAIN = "ssh.git.kun.is";
|
||||||
|
HTTP_PORT = 3000;
|
||||||
|
ROOT_URL = "https://git.kun.is";
|
||||||
|
DISABLE_SSH = false;
|
||||||
|
SSH_PORT = 56287;
|
||||||
|
SSH_LISTEN_PORT = 22;
|
||||||
|
LFS_START_SERVER = true;
|
||||||
|
LFS_JWT_SECRET = "ref+sops://secrets.yml#/forgejo/lfsJwtSecret";
|
||||||
|
OFFLINE_MODE = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
database = {
|
||||||
|
PATH = "/data/gitea/gitea.db";
|
||||||
|
DB_TYPE = "sqlite3";
|
||||||
|
HOST = "localhost:3306";
|
||||||
|
NAME = "gitea";
|
||||||
|
USER = "root";
|
||||||
|
PASSWD = "";
|
||||||
|
LOG_SQL = false;
|
||||||
|
SCHEMA = "";
|
||||||
|
SSL_MODE = "disable";
|
||||||
|
CHARSET = "utf8";
|
||||||
|
};
|
||||||
|
|
||||||
|
indexer = {
|
||||||
|
ISSUE_INDEXER_PATH = "/data/gitea/indexers/issues.bleve";
|
||||||
|
ISSUE_INDEXER_TYPE = "db";
|
||||||
|
};
|
||||||
|
|
||||||
|
session = {
|
||||||
|
PROVIDER_CONFIG = "/data/gitea/sessions";
|
||||||
|
PROVIDER = "file";
|
||||||
|
};
|
||||||
|
|
||||||
|
picture = {
|
||||||
|
AVATAR_UPLOAD_PATH = "/data/gitea/avatars";
|
||||||
|
REPOSITORY_AVATAR_UPLOAD_PATH = "/data/gitea/repo-avatars";
|
||||||
|
ENABLE_FEDERATED_AVATAR = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
log = {
|
||||||
|
MODE = "console";
|
||||||
|
LEVEL = "info";
|
||||||
|
"logger.router.MODE" = "console";
|
||||||
|
ROOT_PATH = "/data/gitea/log";
|
||||||
|
"logger.access.MODE" = "console";
|
||||||
|
};
|
||||||
|
|
||||||
|
security = {
|
||||||
|
INSTALL_LOCK = true;
|
||||||
|
SECRET_KEY = "";
|
||||||
|
REVERSE_PROXY_LIMIT = 1;
|
||||||
|
REVERSE_PROXY_TRUSTED_PROXIES = "*";
|
||||||
|
INTERNAL_TOKEN = "ref+sops://secrets.yml#/forgejo/internalToken";
|
||||||
|
PASSWORD_HASH_ALGO = "pbkdf2";
|
||||||
|
};
|
||||||
|
|
||||||
|
service = {
|
||||||
|
DISABLE_REGISTRATION = true;
|
||||||
|
REQUIRE_SIGNIN_VIEW = false;
|
||||||
|
REGISTER_EMAIL_CONFIRM = false;
|
||||||
|
ENABLE_NOTIFY_MAIL = false;
|
||||||
|
ALLOW_ONLY_EXTERNAL_REGISTRATION = false;
|
||||||
|
ENABLE_CAPTCHA = false;
|
||||||
|
DEFAULT_KEEP_EMAIL_PRIVATE = true;
|
||||||
|
DEFAULT_ALLOW_CREATE_ORGANIZATION = true;
|
||||||
|
DEFAULT_ENABLE_TIMETRACKING = true;
|
||||||
|
NO_REPLY_ADDRESS = "noreply.localhost";
|
||||||
|
};
|
||||||
|
|
||||||
|
openid = {
|
||||||
|
ENABLE_OPENID_SIGNIN = true;
|
||||||
|
ENABLE_OPENID_SIGNUP = false;
|
||||||
|
};
|
||||||
|
}
|
102
modules/forgejo/default.nix
Normal file
102
modules/forgejo/default.nix
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
{ lib, config, globals, ... }: {
|
||||||
|
options.forgejo.enable = lib.mkEnableOption "forgejo";
|
||||||
|
|
||||||
|
config = lib.mkIf config.forgejo.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
secrets.forgejo.stringData.config = lib.generators.toINI { } (import ./config.nix);
|
||||||
|
|
||||||
|
deployments.server.spec = {
|
||||||
|
selector.matchLabels.app = "forgejo";
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "forgejo";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
# This disables services from becoming environmental variables
|
||||||
|
# to prevent SSH_PORT clashing with Forgejo config.
|
||||||
|
enableServiceLinks = false;
|
||||||
|
|
||||||
|
containers.forgejo = {
|
||||||
|
image = globals.images.forgejo;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
env = {
|
||||||
|
USER_UID.value = "1000";
|
||||||
|
USER_GID.value = "1000";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports = {
|
||||||
|
web.containerPort = 3000;
|
||||||
|
ssh.containerPort = 22;
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/data";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/data/gitea/conf/app.ini";
|
||||||
|
subPath = "config";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
data.persistentVolumeClaim.claimName = "data";
|
||||||
|
config.secret.secretName = "forgejo";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
web.spec = {
|
||||||
|
selector.app = "forgejo";
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ssh.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.gitIPv4;
|
||||||
|
selector.app = "forgejo";
|
||||||
|
|
||||||
|
ports.ssh = {
|
||||||
|
port = 56287;
|
||||||
|
targetPort = "ssh";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
ingresses.web = {
|
||||||
|
host = "git.kun.is";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "web";
|
||||||
|
portName = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim.data = {
|
||||||
|
volumeName = "forgejo";
|
||||||
|
storage = "20Gi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
86
modules/freshrss.nix
Normal file
86
modules/freshrss.nix
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
{ config, lib, globals, ... }: {
|
||||||
|
options.freshrss.enable = lib.mkEnableOption "freshrss";
|
||||||
|
|
||||||
|
config = lib.mkIf config.freshrss.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
secrets.server.stringData.adminPassword = "ref+sops://secrets.yml#/freshrss/password";
|
||||||
|
|
||||||
|
deployments.server.spec = {
|
||||||
|
selector.matchLabels.app = "freshrss";
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "freshrss";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.freshrss = {
|
||||||
|
image = globals.images.freshrss;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
ports.web.containerPort = 80;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
TZ.value = "Europe/Amsterdam";
|
||||||
|
CRON_MIN.value = "2,32";
|
||||||
|
ADMIN_EMAIL.value = "pim@kunis.nl";
|
||||||
|
PUBLISHED_PORT.value = "443";
|
||||||
|
|
||||||
|
ADMIN_PASSWORD.valueFrom.secretKeyRef = {
|
||||||
|
name = "server";
|
||||||
|
key = "adminPassword";
|
||||||
|
};
|
||||||
|
|
||||||
|
ADMIN_API_PASSWORD.valueFrom.secretKeyRef = {
|
||||||
|
name = "server";
|
||||||
|
key = "adminPassword";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/var/www/FreshRSS/data";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes.data.persistentVolumeClaim.claimName = "data";
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 33;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.server.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.freshrssIPv4;
|
||||||
|
selector.app = "freshrss";
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
tailscaleIngresses.tailscale = {
|
||||||
|
host = "freshrss";
|
||||||
|
service.name = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim.data = {
|
||||||
|
volumeName = "freshrss";
|
||||||
|
storage = "1Gi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
171
modules/hedgedoc.nix
Normal file
171
modules/hedgedoc.nix
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
{ config, lib, globals, ... }: {
|
||||||
|
options.hedgedoc.enable = lib.mkEnableOption "hedgedoc";
|
||||||
|
|
||||||
|
config = lib.mkIf config.hedgedoc.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
configMaps.hedgedoc-config.data.config = lib.generators.toJSON { } {
|
||||||
|
useSSL = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
secrets.hedgedoc.stringData = {
|
||||||
|
databaseURL = "ref+sops://secrets.yml#/hedgedoc/databaseURL";
|
||||||
|
sessionSecret = "ref+sops://secrets.yml#/hedgedoc/sessionSecret";
|
||||||
|
databasePassword = "ref+sops://secrets.yml#/hedgedoc/databasePassword";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployments = {
|
||||||
|
server.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "hedgedoc";
|
||||||
|
component = "website";
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "hedgedoc";
|
||||||
|
component = "website";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.hedgedoc = {
|
||||||
|
image = globals.images.hedgedoc;
|
||||||
|
ports.web.containerPort = 3000;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
CMD_DOMAIN.value = "md.kun.is";
|
||||||
|
CMD_PORT.value = "3000";
|
||||||
|
CMD_URL_ADDPORT.value = "false";
|
||||||
|
CMD_ALLOW_ANONYMOUS.value = "true";
|
||||||
|
CMD_ALLOW_EMAIL_REGISTER.value = "false";
|
||||||
|
CMD_PROTOCOL_USESSL.value = "true";
|
||||||
|
CMD_CSP_ENABLE.value = "false";
|
||||||
|
|
||||||
|
CMD_DB_URL.valueFrom.secretKeyRef = {
|
||||||
|
name = "hedgedoc";
|
||||||
|
key = "databaseURL";
|
||||||
|
};
|
||||||
|
|
||||||
|
CMD_SESSION_SECRET.valueFrom.secretKeyRef = {
|
||||||
|
name = "hedgedoc";
|
||||||
|
key = "sessionSecret";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "uploads";
|
||||||
|
mountPath = "/hedgedoc/public/uploads";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/hedgedoc/config.json";
|
||||||
|
subPath = "config";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
uploads.persistentVolumeClaim.claimName = "uploads";
|
||||||
|
config.configMap.name = "hedgedoc-config";
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 65534;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
database.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "hedgedoc";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "hedgedoc";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.postgres = {
|
||||||
|
image = globals.images.postgres15;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
ports.postgres.containerPort = 5432;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
POSTGRES_DB.value = "hedgedoc";
|
||||||
|
POSTGRES_USER.value = "hedgedoc";
|
||||||
|
PGDATA.value = "/pgdata/data";
|
||||||
|
|
||||||
|
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
|
||||||
|
name = "hedgedoc";
|
||||||
|
key = "databasePassword";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "database";
|
||||||
|
mountPath = "/pgdata";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes.database.persistentVolumeClaim.claimName = "database";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
server.spec = {
|
||||||
|
selector = {
|
||||||
|
app = "hedgedoc";
|
||||||
|
component = "website";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
database.spec = {
|
||||||
|
selector = {
|
||||||
|
app = "hedgedoc";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.postgres = {
|
||||||
|
port = 5432;
|
||||||
|
targetPort = "postgres";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
ingresses.web = {
|
||||||
|
host = "md.kun.is";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "server";
|
||||||
|
portName = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim = {
|
||||||
|
uploads = {
|
||||||
|
volumeName = "hedgedoc-uploads";
|
||||||
|
storage = "50Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
database = {
|
||||||
|
volumeName = "hedgedoc-db";
|
||||||
|
storage = "100Mi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
266
modules/immich.nix
Normal file
266
modules/immich.nix
Normal file
|
@ -0,0 +1,266 @@
|
||||||
|
{ globals, config, lib, ... }: {
|
||||||
|
options.immich.enable = lib.mkEnableOption "immich";
|
||||||
|
|
||||||
|
config = lib.mkIf config.immich.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
secrets.immich.stringData.databasePassword = "ref+sops://secrets.yml#/immich/databasePassword";
|
||||||
|
|
||||||
|
deployments = {
|
||||||
|
immich.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "immich";
|
||||||
|
component = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "immich";
|
||||||
|
component = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
volumes.data.persistentVolumeClaim.claimName = "data";
|
||||||
|
|
||||||
|
enableServiceLinks = false;
|
||||||
|
|
||||||
|
containers.immich = {
|
||||||
|
image = globals.images.immich;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
ports.web.containerPort = 3001;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
TZ.value = "Europe/Amsterdam";
|
||||||
|
REDIS_HOSTNAME.value = "redis.immich.svc.cluster.local";
|
||||||
|
DB_HOSTNAME.value = "postgres.immich.svc.cluster.local";
|
||||||
|
DB_USERNAME.value = "postgres";
|
||||||
|
DB_DATABASE_NAME.value = "immich";
|
||||||
|
IMMICH_MACHINE_LEARNING_URL.value = "http://ml.immich.svc.cluster.local";
|
||||||
|
|
||||||
|
DB_PASSWORD.valueFrom.secretKeyRef = {
|
||||||
|
name = "immich";
|
||||||
|
key = "databasePassword";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/usr/src/app/upload";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ml.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "immich";
|
||||||
|
component = "machine-learning";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "immich";
|
||||||
|
component = "machine-learning";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
volumes.cache.persistentVolumeClaim.claimName = "cache";
|
||||||
|
|
||||||
|
containers.machine-learning = {
|
||||||
|
image = globals.images.immich-machine-learning;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
ports.ml.containerPort = 3003;
|
||||||
|
env.MACHINE_LEARNING_WORKER_TIMEOUT.value = "600";
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "cache";
|
||||||
|
mountPath = "/cache";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
redis.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "immich";
|
||||||
|
component = "redis";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "immich";
|
||||||
|
component = "redis";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.redis = {
|
||||||
|
image = globals.images.immich-redis;
|
||||||
|
ports.redis.containerPort = 6379;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
database.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "immich";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "immich";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
volumes.data.persistentVolumeClaim.claimName = "database";
|
||||||
|
|
||||||
|
containers.postgres = {
|
||||||
|
image = globals.images.immich-postgres;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
command = [ "postgres" ];
|
||||||
|
args = [ "-c" "shared_preload_libraries=vectors.so" "-c" "search_path=\"$$user\", public, vectors" "-c" "logging_collector=on" "-c" "max_wal_size=2GB" "-c" "shared_buffers=512MB" "-c" "wal_compression=on" ];
|
||||||
|
ports.postgres.containerPort = 5432;
|
||||||
|
securityContext.runAsUser = 999;
|
||||||
|
securityContext.runAsGroup = 999;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
POSTGRES_USER.value = "postgres";
|
||||||
|
POSTGRES_DB.value = "immich";
|
||||||
|
POSTGRES_INITDB_ARGS.value = "--data-checksums";
|
||||||
|
PGDATA.value = "/pgdata/data";
|
||||||
|
|
||||||
|
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
|
||||||
|
name = "immich";
|
||||||
|
key = "databasePassword";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/pgdata";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
server.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.immichIPv4;
|
||||||
|
|
||||||
|
selector = {
|
||||||
|
app = "immich";
|
||||||
|
component = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
redis.spec = {
|
||||||
|
selector = {
|
||||||
|
app = "immich";
|
||||||
|
component = "redis";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.redis = {
|
||||||
|
port = 6379;
|
||||||
|
targetPort = "redis";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ml.spec = {
|
||||||
|
selector = {
|
||||||
|
app = "immich";
|
||||||
|
component = "machine-learning";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.ml = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "ml";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
postgres.spec = {
|
||||||
|
selector = {
|
||||||
|
app = "immich";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.postgres = {
|
||||||
|
port = 5432;
|
||||||
|
targetPort = "postgres";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
persistentVolumeClaims.cache.spec = {
|
||||||
|
accessModes = [ "ReadWriteOnce" ];
|
||||||
|
resources.requests.storage = "5Gi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
tailscaleIngresses.tailscale = {
|
||||||
|
host = "immich";
|
||||||
|
service.name = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim = {
|
||||||
|
data = {
|
||||||
|
volumeName = "immich";
|
||||||
|
storage = "50Gi";
|
||||||
|
};
|
||||||
|
|
||||||
|
database = {
|
||||||
|
volumeName = "immich-db";
|
||||||
|
storage = "5Gi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
67
modules/inbucket.nix
Normal file
67
modules/inbucket.nix
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
{ globals, config, lib, ... }: {
|
||||||
|
options.inbucket.enable = lib.mkEnableOption "inbucket";
|
||||||
|
|
||||||
|
config = lib.mkIf config.inbucket.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
serviceAccounts.inbucket = { };
|
||||||
|
|
||||||
|
deployments.inbucket.spec = {
|
||||||
|
selector.matchLabels.app = "inbucket";
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "inbucket";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
serviceAccountName = "inbucket";
|
||||||
|
|
||||||
|
containers.inbucket = {
|
||||||
|
image = globals.images.inbucket;
|
||||||
|
|
||||||
|
ports = {
|
||||||
|
web.containerPort = 9000;
|
||||||
|
smtp.containerPort = 2500;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
inbucket.spec = {
|
||||||
|
loadBalancerIP = globals.inbucketIPv4;
|
||||||
|
type = "LoadBalancer";
|
||||||
|
selector.app = "inbucket";
|
||||||
|
|
||||||
|
ports = {
|
||||||
|
smtp = {
|
||||||
|
port = 25;
|
||||||
|
targetPort = "smtp";
|
||||||
|
};
|
||||||
|
|
||||||
|
web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
tailscaleIngresses.tailscale = {
|
||||||
|
host = "inbucket";
|
||||||
|
service.name = "inbucket";
|
||||||
|
};
|
||||||
|
|
||||||
|
ingresses.inbucket = {
|
||||||
|
host = "inbucket.kun.is";
|
||||||
|
entrypoint = "localsecure";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "inbucket";
|
||||||
|
portName = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
67
modules/ingress.nix
Normal file
67
modules/ingress.nix
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
{ lib, config, ... }:
|
||||||
|
let
|
||||||
|
ingressOpts = { name, ... }: {
|
||||||
|
options = {
|
||||||
|
host = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
entrypoint = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "websecure";
|
||||||
|
};
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
portName = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
lab.ingresses = lib.mkOption {
|
||||||
|
type = with lib.types; attrsOf (submodule ingressOpts);
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
kubernetes.resources.ingresses = builtins.mapAttrs
|
||||||
|
(name: ingress: {
|
||||||
|
metadata.annotations = {
|
||||||
|
"cert-manager.io/cluster-issuer" = "letsencrypt";
|
||||||
|
"traefik.ingress.kubernetes.io/router.entrypoints" = ingress.entrypoint;
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
ingressClassName = "traefik";
|
||||||
|
|
||||||
|
rules = [{
|
||||||
|
host = ingress.host;
|
||||||
|
|
||||||
|
http.paths = [{
|
||||||
|
path = "/";
|
||||||
|
pathType = "Prefix";
|
||||||
|
|
||||||
|
backend.service = {
|
||||||
|
name = ingress.service.name;
|
||||||
|
port.name = ingress.service.portName;
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
|
||||||
|
tls = [{
|
||||||
|
secretName = "${name}-tls";
|
||||||
|
hosts = [ ingress.host ];
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
config.lab.ingresses;
|
||||||
|
};
|
||||||
|
}
|
76
modules/kitchenowl.nix
Normal file
76
modules/kitchenowl.nix
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
{ lib, globals, config, ... }: {
|
||||||
|
options.kitchenowl.enable = lib.mkEnableOption "kitchenowl";
|
||||||
|
|
||||||
|
config = lib.mkIf config.kitchenowl.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
secrets.server.stringData.jwtSecretKey = "ref+sops://secrets.yml#/kitchenowl/jwtSecretKey";
|
||||||
|
|
||||||
|
deployments.server.spec = {
|
||||||
|
selector.matchLabels.app = "kitchenowl";
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "kitchenowl";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
volumes.data.persistentVolumeClaim.claimName = "data";
|
||||||
|
|
||||||
|
containers.kitchenowl = {
|
||||||
|
image = globals.images.kitchenowl;
|
||||||
|
ports.web.containerPort = 8080;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
env.JWT_SECRET_KEY.valueFrom.secretKeyRef = {
|
||||||
|
name = "server";
|
||||||
|
key = "jwtSecretKey";
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/data";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 0;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.server.spec = {
|
||||||
|
selector.app = "kitchenowl";
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
ingresses.web = {
|
||||||
|
host = "boodschappen.kun.is";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "server";
|
||||||
|
portName = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim.data = {
|
||||||
|
volumeName = "kitchenowl";
|
||||||
|
storage = "100Mi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
31
modules/kms.nix
Normal file
31
modules/kms.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{ config, globals, lib, ... }: {
|
||||||
|
options.kms.enable = lib.mkEnableOption "kms";
|
||||||
|
|
||||||
|
config = lib.mkIf config.kms.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
deployments.server.spec = {
|
||||||
|
selector.matchLabels.app = "kms";
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "kms";
|
||||||
|
|
||||||
|
spec.containers.kms = {
|
||||||
|
image = globals.images.kms;
|
||||||
|
ports.kms.containerPort = 1688;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.server.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.kmsIPv4;
|
||||||
|
selector.app = "kms";
|
||||||
|
|
||||||
|
ports.kms = {
|
||||||
|
port = 1688;
|
||||||
|
targetPort = "kms";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
149
modules/longhorn-volume.nix
Normal file
149
modules/longhorn-volume.nix
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
{ lib, config, ... }:
|
||||||
|
let
|
||||||
|
longhornVolumeOpts = { name, ... }: {
|
||||||
|
options = {
|
||||||
|
storage = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "default";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
longhornPVOpts = { name, ... }: {
|
||||||
|
options = {
|
||||||
|
storage = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
longhornPVCOpts = { name, ... }: {
|
||||||
|
options = {
|
||||||
|
volumeName = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = name;
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: ideally we take this from the longhornPV so we don't duplicate this information.
|
||||||
|
storage = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
lab.longhornVolumes = lib.mkOption {
|
||||||
|
type = with lib.types; attrsOf (submodule longhornVolumeOpts);
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
lab.longhorn = {
|
||||||
|
persistentVolume = lib.mkOption {
|
||||||
|
type = with lib.types; attrsOf (submodule longhornPVOpts);
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
persistentVolumeClaim = lib.mkOption {
|
||||||
|
type = with lib.types; attrsOf (submodule longhornPVCOpts);
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
kubernetes.resources = {
|
||||||
|
persistentVolumes = lib.mergeAttrs
|
||||||
|
(builtins.mapAttrs
|
||||||
|
(name: longhornVolume: {
|
||||||
|
spec = {
|
||||||
|
accessModes = [ "ReadWriteOnce" ];
|
||||||
|
capacity.storage = longhornVolume.storage;
|
||||||
|
persistentVolumeReclaimPolicy = "Delete";
|
||||||
|
volumeMode = "Filesystem";
|
||||||
|
|
||||||
|
claimRef = {
|
||||||
|
inherit name;
|
||||||
|
namespace = longhornVolume.namespace;
|
||||||
|
};
|
||||||
|
|
||||||
|
csi = {
|
||||||
|
driver = "driver.longhorn.io";
|
||||||
|
fsType = "ext4";
|
||||||
|
volumeHandle = name;
|
||||||
|
|
||||||
|
volumeAttributes = {
|
||||||
|
dataLocality = "disabled";
|
||||||
|
fromBackup = "";
|
||||||
|
fsType = "ext4";
|
||||||
|
numberOfReplicas = "2";
|
||||||
|
staleReplicaTimeout = "30";
|
||||||
|
unmapMarkSnapChainRemoved = "ignored";
|
||||||
|
|
||||||
|
recurringJobSelector = lib.generators.toYAML { } [{
|
||||||
|
name = "backup-nfs";
|
||||||
|
isGroup = false;
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
config.lab.longhornVolumes)
|
||||||
|
(builtins.mapAttrs
|
||||||
|
(name: longhornPV: {
|
||||||
|
spec = {
|
||||||
|
accessModes = [ "ReadWriteOnce" ];
|
||||||
|
capacity.storage = longhornPV.storage;
|
||||||
|
persistentVolumeReclaimPolicy = "Delete";
|
||||||
|
volumeMode = "Filesystem";
|
||||||
|
|
||||||
|
csi = {
|
||||||
|
driver = "driver.longhorn.io";
|
||||||
|
fsType = "ext4";
|
||||||
|
volumeHandle = name;
|
||||||
|
|
||||||
|
volumeAttributes = {
|
||||||
|
dataLocality = "disabled";
|
||||||
|
fromBackup = "";
|
||||||
|
fsType = "ext4";
|
||||||
|
numberOfReplicas = "2";
|
||||||
|
staleReplicaTimeout = "30";
|
||||||
|
unmapMarkSnapChainRemoved = "ignored";
|
||||||
|
|
||||||
|
recurringJobSelector = lib.generators.toYAML { } [{
|
||||||
|
name = "backup-nfs";
|
||||||
|
isGroup = false;
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
config.lab.longhorn.persistentVolume);
|
||||||
|
|
||||||
|
persistentVolumeClaims = lib.mergeAttrs
|
||||||
|
(builtins.mapAttrs
|
||||||
|
(name: longhornVolume: {
|
||||||
|
spec = {
|
||||||
|
accessModes = [ "ReadWriteOnce" ];
|
||||||
|
resources.requests.storage = longhornVolume.storage;
|
||||||
|
storageClassName = "";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
config.lab.longhornVolumes)
|
||||||
|
(builtins.mapAttrs
|
||||||
|
(name: longhornPVC: {
|
||||||
|
spec = {
|
||||||
|
accessModes = [ "ReadWriteOnce" ];
|
||||||
|
resources.requests.storage = longhornPVC.storage;
|
||||||
|
storageClassName = "";
|
||||||
|
volumeName = longhornPVC.volumeName;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
config.lab.longhorn.persistentVolumeClaim);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
614
modules/media.nix
Normal file
614
modules/media.nix
Normal file
|
@ -0,0 +1,614 @@
|
||||||
|
{ globals, config, lib, ... }: {
|
||||||
|
options.media.enable = lib.mkEnableOption "media";
|
||||||
|
|
||||||
|
config = lib.mkIf config.media.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
deployments = {
|
||||||
|
jellyfin.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "media";
|
||||||
|
component = "jellyfin";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "media";
|
||||||
|
component = "jellyfin";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.jellyfin = {
|
||||||
|
image = globals.images.jellyfin;
|
||||||
|
ports.web.containerPort = 8096;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
env.JELLYFIN_PublishedServerUrl.value = "https://media.kun.is";
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/config";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "media";
|
||||||
|
mountPath = "/media";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "cache";
|
||||||
|
mountPath = "/config/transcodes";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
config.persistentVolumeClaim.claimName = "jellyfin";
|
||||||
|
cache.persistentVolumeClaim.claimName = "jellyfin-cache";
|
||||||
|
|
||||||
|
media.hostPath = {
|
||||||
|
path = "/mnt/longhorn/persistent/media";
|
||||||
|
type = "Directory";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 0;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
|
||||||
|
affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms = [{
|
||||||
|
matchExpressions = [{
|
||||||
|
key = "hasMedia";
|
||||||
|
operator = "In";
|
||||||
|
values = [ "true" ];
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
deluge.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "media";
|
||||||
|
component = "deluge";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "media";
|
||||||
|
component = "deluge";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.deluge = {
|
||||||
|
image = globals.images.deluge;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
env = {
|
||||||
|
PUID.value = "1000";
|
||||||
|
PGID.value = "1000";
|
||||||
|
TZ.value = "Europe/Amsterdam";
|
||||||
|
DELUGE_LOGLEVEL.value = "info";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports = {
|
||||||
|
web.containerPort = 8112;
|
||||||
|
bittorrent.containerPort = 31780;
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/config";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "media";
|
||||||
|
mountPath = "/media";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
config.persistentVolumeClaim.claimName = "deluge";
|
||||||
|
media.persistentVolumeClaim.claimName = "media";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
jellyseerr.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "media";
|
||||||
|
component = "jellyseerr";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "media";
|
||||||
|
component = "jellyseerr";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
volumes.config.persistentVolumeClaim.claimName = "jellyseerr";
|
||||||
|
|
||||||
|
containers.jellyseerr = {
|
||||||
|
image = globals.images.jellyseerr;
|
||||||
|
ports.web.containerPort = 5055;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
env = {
|
||||||
|
LOG_LEVEL.value = "debug";
|
||||||
|
TZ.value = "Europe/Amsterdam";
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/app/config";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 0;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
radarr.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "media";
|
||||||
|
component = "radarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "media";
|
||||||
|
component = "radarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.radarr = {
|
||||||
|
image = globals.images.radarr;
|
||||||
|
ports.web.containerPort = 7878;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
env = {
|
||||||
|
PUID.value = "1000";
|
||||||
|
PGID.value = "1000";
|
||||||
|
TZ.value = "Europe/Amsterdam";
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/config";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "media";
|
||||||
|
mountPath = "/media";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
config.persistentVolumeClaim.claimName = "radarr";
|
||||||
|
media.persistentVolumeClaim.claimName = "media";
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 1000;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
prowlarr.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "media";
|
||||||
|
component = "prowlarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "media";
|
||||||
|
component = "prowlarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
volumes.config.persistentVolumeClaim.claimName = "prowlarr";
|
||||||
|
|
||||||
|
containers.prowlarr = {
|
||||||
|
image = globals.images.prowlarr;
|
||||||
|
ports.web.containerPort = 9696;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
env = {
|
||||||
|
PUID.value = "1000";
|
||||||
|
PGID.value = "1000";
|
||||||
|
TZ.value = "Europe/Amsterdam";
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/config";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 1000;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
sonarr.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "media";
|
||||||
|
component = "sonarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "media";
|
||||||
|
component = "sonarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.sonarr = {
|
||||||
|
image = globals.images.sonarr;
|
||||||
|
ports.web.containerPort = 8989;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
env = {
|
||||||
|
PUID.value = "1000";
|
||||||
|
PGID.value = "1000";
|
||||||
|
TZ.value = "Europe/Amsterdam";
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/config";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "media";
|
||||||
|
mountPath = "/media";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
config.persistentVolumeClaim.claimName = "sonarr";
|
||||||
|
media.persistentVolumeClaim.claimName = "media";
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 1000;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
bazarr.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "media";
|
||||||
|
component = "bazarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "media";
|
||||||
|
component = "bazarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.bazarr = {
|
||||||
|
image = globals.images.bazarr;
|
||||||
|
ports.web.containerPort = 6767;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
env = {
|
||||||
|
PUID.value = "1000";
|
||||||
|
PGID.value = "1000";
|
||||||
|
TZ.value = "Europe/Amsterdam";
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/config";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "media";
|
||||||
|
mountPath = "/media";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
config.persistentVolumeClaim.claimName = "bazarr";
|
||||||
|
media.persistentVolumeClaim.claimName = "media";
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 1000;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
jellyfin.spec = {
|
||||||
|
selector = {
|
||||||
|
app = "media";
|
||||||
|
component = "jellyfin";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
deluge.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.transmissionIPv4;
|
||||||
|
|
||||||
|
selector = {
|
||||||
|
app = "media";
|
||||||
|
component = "deluge";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports = {
|
||||||
|
bittorrent = {
|
||||||
|
port = 31780;
|
||||||
|
targetPort = "bittorrent";
|
||||||
|
};
|
||||||
|
|
||||||
|
web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
jellyseerr.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.jellyseerrIPv4;
|
||||||
|
|
||||||
|
selector = {
|
||||||
|
app = "media";
|
||||||
|
component = "jellyseerr";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
radarr.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.radarrIPv4;
|
||||||
|
|
||||||
|
selector = {
|
||||||
|
app = "media";
|
||||||
|
component = "radarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
prowlarr.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.prowlarrIPv4;
|
||||||
|
|
||||||
|
selector = {
|
||||||
|
app = "media";
|
||||||
|
component = "prowlarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
sonarr.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.sonarrIPv4;
|
||||||
|
|
||||||
|
selector = {
|
||||||
|
app = "media";
|
||||||
|
component = "sonarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
bazarr.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.bazarrIPv4;
|
||||||
|
|
||||||
|
selector = {
|
||||||
|
app = "media";
|
||||||
|
component = "bazarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
persistentVolumeClaims = {
|
||||||
|
jellyfin-cache.spec = {
|
||||||
|
accessModes = [ "ReadWriteOnce" ];
|
||||||
|
resources.requests.storage = "20Gi";
|
||||||
|
};
|
||||||
|
|
||||||
|
media.spec = {
|
||||||
|
accessModes = [ "ReadWriteMany" ];
|
||||||
|
storageClassName = "";
|
||||||
|
resources.requests.storage = "1Mi";
|
||||||
|
volumeName = "media-media";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
ingresses.jellyfin = {
|
||||||
|
host = "media.kun.is";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "jellyfin";
|
||||||
|
portName = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
tailscaleIngresses = {
|
||||||
|
tailscale-jellyseerr = {
|
||||||
|
host = "jellyseerr";
|
||||||
|
service.name = "jellyseerr";
|
||||||
|
};
|
||||||
|
|
||||||
|
tailscale-radarr = {
|
||||||
|
host = "radarr";
|
||||||
|
service.name = "radarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
tailscale-sonarr = {
|
||||||
|
host = "sonarr";
|
||||||
|
service.name = "sonarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
tailscale-bazarr = {
|
||||||
|
host = "bazarr";
|
||||||
|
service.name = "bazarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
tailscale-prowlarr = {
|
||||||
|
host = "prowlarr";
|
||||||
|
service.name = "prowlarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
tailscale-deluge = {
|
||||||
|
host = "deluge";
|
||||||
|
service.name = "deluge";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim = {
|
||||||
|
jellyfin = {
|
||||||
|
volumeName = "jellyfin";
|
||||||
|
storage = "5Gi";
|
||||||
|
};
|
||||||
|
|
||||||
|
deluge = {
|
||||||
|
volumeName = "deluge";
|
||||||
|
storage = "500Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
jellyseerr = {
|
||||||
|
volumeName = "jellyseerr";
|
||||||
|
storage = "75Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
radarr = {
|
||||||
|
volumeName = "radarr";
|
||||||
|
storage = "300Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
prowlarr = {
|
||||||
|
volumeName = "prowlarr";
|
||||||
|
storage = "150Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
sonarr = {
|
||||||
|
volumeName = "sonarr";
|
||||||
|
storage = "150Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
bazarr = {
|
||||||
|
volumeName = "bazarr";
|
||||||
|
storage = "25Mi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
52
modules/minecraft.nix
Normal file
52
modules/minecraft.nix
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{ lib, config, globals, ... }: {
|
||||||
|
options.minecraft.enable = lib.mkEnableOption "minecraft";
|
||||||
|
|
||||||
|
config = lib.mkIf config.minecraft.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
deployments.minecraft.spec = {
|
||||||
|
selector.matchLabels.app = "minecraft";
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "minecraft";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
volumes.data.persistentVolumeClaim.claimName = "data";
|
||||||
|
|
||||||
|
containers.minecraft = {
|
||||||
|
image = globals.images.minecraft;
|
||||||
|
ports.minecraft.containerPort = 25565;
|
||||||
|
|
||||||
|
env.EULA.value = "TRUE";
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/data";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 1000;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.minecraft.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.minecraftIPv4;
|
||||||
|
selector.app = "minecraft";
|
||||||
|
|
||||||
|
ports.minecraft = {
|
||||||
|
port = 25565;
|
||||||
|
targetPort = "minecraft";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab.longhorn.persistentVolumeClaim.data = {
|
||||||
|
volumeName = "minecraft";
|
||||||
|
storage = "1Gi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
161
modules/nextcloud.nix
Normal file
161
modules/nextcloud.nix
Normal file
|
@ -0,0 +1,161 @@
|
||||||
|
{ lib, config, globals, ... }: {
|
||||||
|
options.nextcloud.enable = lib.mkEnableOption "nextcloud";
|
||||||
|
|
||||||
|
config = lib.mkIf config.nextcloud.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
secrets.database.stringData.databasePassword = "ref+sops://secrets.yml#/nextcloud/databasePassword";
|
||||||
|
|
||||||
|
deployments = {
|
||||||
|
server.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "nextcloud";
|
||||||
|
component = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "nextcloud";
|
||||||
|
component = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
volumes.data.persistentVolumeClaim.claimName = "data";
|
||||||
|
|
||||||
|
containers.nextcloud = {
|
||||||
|
image = globals.images.nextcloud;
|
||||||
|
ports.web.containerPort = 80;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
POSTGRES_USER.value = "nextcloud";
|
||||||
|
POSTGRES_DB.value = "nextcloud";
|
||||||
|
POSTGRES_HOST.value = "lewis.dmz";
|
||||||
|
|
||||||
|
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
|
||||||
|
name = "database";
|
||||||
|
key = "databasePassword";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/var/www/html";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 33;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
|
||||||
|
affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution = [{
|
||||||
|
weight = 1;
|
||||||
|
preference.matchExpressions = [{
|
||||||
|
key = "storageType";
|
||||||
|
operator = "In";
|
||||||
|
values = [ "fast" ];
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
database.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "nextcloud";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "nextcloud";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.postgres = {
|
||||||
|
image = globals.images.postgres15;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
ports.postgres.containerPort = 5432;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
POSTGRES_DB.value = "nextcloud";
|
||||||
|
POSTGRES_USER.value = "nextcloud";
|
||||||
|
PGDATA.value = "/pgdata/data";
|
||||||
|
|
||||||
|
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
|
||||||
|
name = "database";
|
||||||
|
key = "databasePassword";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "database";
|
||||||
|
mountPath = "/pgdata";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes.database.persistentVolumeClaim.claimName = "database";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
server.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.nextcloudIPv4;
|
||||||
|
|
||||||
|
selector = {
|
||||||
|
app = "nextcloud";
|
||||||
|
component = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
database.spec = {
|
||||||
|
selector = {
|
||||||
|
app = "nextcloud";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.postgres = {
|
||||||
|
port = 5432;
|
||||||
|
targetPort = "postgres";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
tailscaleIngresses.tailscale = {
|
||||||
|
host = "nextcloud";
|
||||||
|
service.name = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim = {
|
||||||
|
data = {
|
||||||
|
volumeName = "nextcloud";
|
||||||
|
storage = "50Gi";
|
||||||
|
};
|
||||||
|
|
||||||
|
database = {
|
||||||
|
volumeName = "nextcloud-db";
|
||||||
|
storage = "400Mi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
109
modules/ntfy.nix
Normal file
109
modules/ntfy.nix
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
{ lib, config, globals, ... }: {
|
||||||
|
options.ntfy.enable = lib.mkEnableOption "ntfy";
|
||||||
|
|
||||||
|
config = lib.mkIf config.ntfy.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
configMaps.ntfy.data.config = lib.generators.toYAML { } {
|
||||||
|
base-url = "https://ntfy.kun.is";
|
||||||
|
cache-file = "/var/cache/ntfy/cache.db";
|
||||||
|
cache-duration = "14d";
|
||||||
|
auth-file = "/var/lib/ntfy/user.db";
|
||||||
|
auth-default-access = "deny-all";
|
||||||
|
attachment-cache-dir = "/var/cache/ntfy-attachments";
|
||||||
|
enable-signup = false;
|
||||||
|
enable-login = true;
|
||||||
|
visitor-subscription-limit = 100;
|
||||||
|
};
|
||||||
|
|
||||||
|
deployments.ntfy.spec = {
|
||||||
|
selector.matchLabels.app = "ntfy";
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "ntfy";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.ntfy = {
|
||||||
|
image = globals.images.ntfy;
|
||||||
|
ports.web.containerPort = 80;
|
||||||
|
env.TZ.value = "Europe/Amsterdam";
|
||||||
|
args = [ "serve" ];
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "cache";
|
||||||
|
mountPath = "/var/cache/ntfy";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/var/lib/ntfy";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "attachment-cache";
|
||||||
|
mountPath = "/var/cache/ntfy-attachments";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/etc/ntfy/server.yml";
|
||||||
|
subPath = "config";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
cache.persistentVolumeClaim.claimName = "cache";
|
||||||
|
attachment-cache.persistentVolumeClaim.claimName = "attachment-cache";
|
||||||
|
data.persistentVolumeClaim.claimName = "data";
|
||||||
|
config.configMap.name = "ntfy";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
persistentVolumeClaims = {
|
||||||
|
cache.spec = {
|
||||||
|
accessModes = [ "ReadWriteOnce" ];
|
||||||
|
resources.requests.storage = "300Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
attachment-cache.spec = {
|
||||||
|
accessModes = [ "ReadWriteOnce" ];
|
||||||
|
resources.requests.storage = "500Mi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.ntfy.spec = {
|
||||||
|
selector.app = "ntfy";
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
ingresses.ntfy = {
|
||||||
|
host = "ntfy.kun.is";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "ntfy";
|
||||||
|
portName = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim.data = {
|
||||||
|
volumeName = "ntfy";
|
||||||
|
storage = "300Mi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
240
modules/paperless.nix
Normal file
240
modules/paperless.nix
Normal file
|
@ -0,0 +1,240 @@
|
||||||
|
{ globals, lib, config, ... }: {
|
||||||
|
options.paperless.enable = lib.mkEnableOption "paperless";
|
||||||
|
|
||||||
|
config = lib.mkIf config.paperless.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
secrets = {
|
||||||
|
database.stringData.password = "ref+sops://secrets.yml#/paperless/databasePassword";
|
||||||
|
server.stringData.secretKey = "ref+sops://secrets.yml#/paperless/secretKey";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployments = {
|
||||||
|
server.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "paperless";
|
||||||
|
component = "web";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "paperless";
|
||||||
|
component = "web";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
volumes.data.persistentVolumeClaim.claimName = "data";
|
||||||
|
|
||||||
|
containers.paperless = {
|
||||||
|
image = globals.images.paperless;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
ports.web.containerPort = 8000;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
PAPERLESS_REDIS.value = "redis://redis.paperless.svc.cluster.local:6379";
|
||||||
|
PAPERLESS_DBENGINE.value = "postgresql";
|
||||||
|
PAPERLESS_DBHOST.value = "database.paperless.svc.cluster.local";
|
||||||
|
PAPERLESS_DBNAME.value = "paperless";
|
||||||
|
PAPERLESS_DBUSER.value = "paperless";
|
||||||
|
PAPERLESS_DATA_DIR.value = "/data/";
|
||||||
|
PAPERLESS_MEDIA_ROOT.value = "/data/";
|
||||||
|
PAPERLESS_OCR_LANGUAGES.value = "nld eng";
|
||||||
|
PAPERLESS_URL.value = "https://paperless.griffin-mermaid.ts.net";
|
||||||
|
PAPERLESS_TIME_ZONE.value = "Europe/Amsterdam";
|
||||||
|
PAPERLESS_OCR_LANGUAGE.value = "nld";
|
||||||
|
USERMAP_UID.value = "33";
|
||||||
|
USERMAP_GID.value = "33";
|
||||||
|
|
||||||
|
PAPERLESS_DBPASS.valueFrom.secretKeyRef = {
|
||||||
|
name = "database";
|
||||||
|
key = "password";
|
||||||
|
};
|
||||||
|
|
||||||
|
PAPERLESS_SECRET_KEY.valueFrom.secretKeyRef = {
|
||||||
|
name = "server";
|
||||||
|
key = "secretKey";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/data";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 33;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
redis.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "paperless";
|
||||||
|
component = "redis";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "paperless";
|
||||||
|
component = "redis";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
volumes.data.persistentVolumeClaim.claimName = "redisdata";
|
||||||
|
|
||||||
|
containers.redis = {
|
||||||
|
image = globals.images.redis7;
|
||||||
|
ports.redis.containerPort = 6379;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/data";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 999;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
database.spec = {
|
||||||
|
selector.matchLabels = {
|
||||||
|
app = "paperless";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels = {
|
||||||
|
app = "paperless";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.postgres = {
|
||||||
|
image = globals.images.postgres15;
|
||||||
|
ports.postgres.containerPort = 5432;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
env = {
|
||||||
|
POSTGRES_DB.value = "paperless";
|
||||||
|
POSTGRES_USER.value = "paperless";
|
||||||
|
PGDATA.value = "/pgdata/data";
|
||||||
|
|
||||||
|
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
|
||||||
|
name = "database";
|
||||||
|
key = "password";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/pgdata";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes.data.persistentVolumeClaim.claimName = "database";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
web.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.paperlessIPv4;
|
||||||
|
|
||||||
|
selector = {
|
||||||
|
app = "paperless";
|
||||||
|
component = "web";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
redis.spec = {
|
||||||
|
selector = {
|
||||||
|
app = "paperless";
|
||||||
|
component = "redis";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.redis = {
|
||||||
|
port = 6379;
|
||||||
|
targetPort = "redis";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
database.spec = {
|
||||||
|
selector = {
|
||||||
|
app = "paperless";
|
||||||
|
component = "database";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.postgres = {
|
||||||
|
port = 5432;
|
||||||
|
targetPort = "postgres";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
tailscaleIngresses.tailscale = {
|
||||||
|
host = "paperless";
|
||||||
|
service.name = "web";
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim = {
|
||||||
|
data = {
|
||||||
|
volumeName = "paperless-data";
|
||||||
|
storage = "10Gi";
|
||||||
|
};
|
||||||
|
|
||||||
|
redisdata = {
|
||||||
|
volumeName = "paperless-redisdata";
|
||||||
|
storage = "20Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
database = {
|
||||||
|
volumeName = "paperless-db";
|
||||||
|
storage = "150Mi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
112
modules/pihole.nix
Normal file
112
modules/pihole.nix
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
{ globals, config, lib, ... }: {
|
||||||
|
options.pihole.enable = lib.mkEnableOption "pihole";
|
||||||
|
|
||||||
|
config = lib.mkIf config.pihole.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
secrets.pihole.stringData.webPassword = "ref+sops://secrets.yml#/pihole/password";
|
||||||
|
|
||||||
|
deployments.pihole.spec = {
|
||||||
|
selector.matchLabels.app = "pihole";
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "pihole";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.pihole = {
|
||||||
|
image = globals.images.pihole;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
TZ.value = "Europe/Amsterdam";
|
||||||
|
PIHOLE_DNS_.value = "192.168.30.1";
|
||||||
|
|
||||||
|
WEBPASSWORD.valueFrom.secretKeyRef = {
|
||||||
|
name = "pihole";
|
||||||
|
key = "webPassword";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ports = {
|
||||||
|
web.containerPort = 80;
|
||||||
|
|
||||||
|
dns = {
|
||||||
|
containerPort = 53;
|
||||||
|
protocol = "UDP";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/etc/pihole";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "dnsmasq";
|
||||||
|
mountPath = "/etc/dnsmasq.d";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
data.persistentVolumeClaim.claimName = "pihole-data";
|
||||||
|
dnsmasq.persistentVolumeClaim.claimName = "pihole-dnsmasq";
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 1000;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
pihole.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.piholeIPv4;
|
||||||
|
selector.app = "pihole";
|
||||||
|
|
||||||
|
ports = {
|
||||||
|
dns = {
|
||||||
|
protocol = "UDP";
|
||||||
|
port = 53;
|
||||||
|
targetPort = "dns";
|
||||||
|
};
|
||||||
|
|
||||||
|
web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
longhorn.persistentVolumeClaim = {
|
||||||
|
pihole-data = {
|
||||||
|
volumeName = "pihole-data";
|
||||||
|
storage = "750Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
pihole-dnsmasq = {
|
||||||
|
volumeName = "pihole-dnsmasq";
|
||||||
|
storage = "16Mi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
tailscaleIngresses.tailscale-pihole = {
|
||||||
|
host = "pihole";
|
||||||
|
service.name = "pihole";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
115
modules/radicale.nix
Normal file
115
modules/radicale.nix
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
{ config, lib, globals, ... }: {
|
||||||
|
options.radicale.enable = lib.mkEnableOption "radicale";
|
||||||
|
|
||||||
|
config = lib.mkIf config.radicale.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
configMaps.server.data = {
|
||||||
|
users = "pim:$apr1$GUiTihkS$dDCkaUxFx/O86m6NCy/yQ.";
|
||||||
|
|
||||||
|
config = lib.generators.toINI { } {
|
||||||
|
server = {
|
||||||
|
hosts = "0.0.0.0:5232, [::]:5232";
|
||||||
|
ssl = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
encoding = {
|
||||||
|
request = "utf-8";
|
||||||
|
stock = "utf-8";
|
||||||
|
};
|
||||||
|
|
||||||
|
auth = {
|
||||||
|
realm = "Radicale - Password Required";
|
||||||
|
type = "htpasswd";
|
||||||
|
htpasswd_filename = "/config/users";
|
||||||
|
htpasswd_encryption = "md5";
|
||||||
|
};
|
||||||
|
|
||||||
|
rights.type = "owner_only";
|
||||||
|
|
||||||
|
storage = {
|
||||||
|
type = "multifilesystem";
|
||||||
|
filesystem_folder = "/data";
|
||||||
|
};
|
||||||
|
|
||||||
|
logging = { };
|
||||||
|
headers = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
deployments.server.spec = {
|
||||||
|
selector.matchLabels.app = "radicale";
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "radicale";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
containers.radicale = {
|
||||||
|
image = globals.images.radicale;
|
||||||
|
ports.web.containerPort = 5232;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "data";
|
||||||
|
mountPath = "/data";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/config/config";
|
||||||
|
subPath = "config";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/config/users";
|
||||||
|
subPath = "users";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
data.persistentVolumeClaim.claimName = "data";
|
||||||
|
config.configMap.name = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 2999;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.server.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.radicaleIPv4;
|
||||||
|
selector.app = "radicale";
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
tailscaleIngresses.tailscale = {
|
||||||
|
host = "radicale";
|
||||||
|
service.name = "server";
|
||||||
|
};
|
||||||
|
|
||||||
|
longhorn.persistentVolumeClaim.data = {
|
||||||
|
volumeName = "radicale";
|
||||||
|
storage = "200Mi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
93
modules/syncthing.nix
Normal file
93
modules/syncthing.nix
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
{ globals, config, lib, ... }: {
|
||||||
|
options.syncthing.enable = lib.mkEnableOption "syncthing";
|
||||||
|
|
||||||
|
config = lib.mkIf config.syncthing.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
serviceAccounts.syncthing = { };
|
||||||
|
|
||||||
|
deployments.syncthing.spec = {
|
||||||
|
selector.matchLabels.app = "syncthing";
|
||||||
|
|
||||||
|
strategy = {
|
||||||
|
type = "RollingUpdate";
|
||||||
|
|
||||||
|
rollingUpdate = {
|
||||||
|
maxSurge = 0;
|
||||||
|
maxUnavailable = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template = {
|
||||||
|
metadata.labels.app = "syncthing";
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
serviceAccountName = "syncthing";
|
||||||
|
|
||||||
|
containers.syncthing = {
|
||||||
|
image = globals.images.syncthing;
|
||||||
|
ports.web.containerPort = 8384;
|
||||||
|
imagePullPolicy = "IfNotPresent";
|
||||||
|
|
||||||
|
env = {
|
||||||
|
PUID.value = "33";
|
||||||
|
PGID.value = "33";
|
||||||
|
TZ.value = "Europe/Amsterdam";
|
||||||
|
};
|
||||||
|
|
||||||
|
volumeMounts = [
|
||||||
|
{
|
||||||
|
name = "config";
|
||||||
|
mountPath = "/config";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "music";
|
||||||
|
mountPath = "/music";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
config.persistentVolumeClaim.claimName = "config";
|
||||||
|
music.persistentVolumeClaim.claimName = "music";
|
||||||
|
};
|
||||||
|
|
||||||
|
securityContext = {
|
||||||
|
fsGroup = 33;
|
||||||
|
fsGroupChangePolicy = "OnRootMismatch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.syncthing.spec = {
|
||||||
|
type = "LoadBalancer";
|
||||||
|
loadBalancerIP = globals.syncthingIPv4;
|
||||||
|
selector.app = "syncthing";
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
persistentVolumeClaims.music.spec = {
|
||||||
|
accessModes = [ "ReadWriteMany" ];
|
||||||
|
storageClassName = "";
|
||||||
|
resources.requests.storage = "1Mi";
|
||||||
|
volumeName = "music-syncthing";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
longhorn.persistentVolumeClaim.config = {
|
||||||
|
volumeName = "syncthing";
|
||||||
|
storage = "400Mi";
|
||||||
|
};
|
||||||
|
|
||||||
|
tailscaleIngresses.tailscale = {
|
||||||
|
host = "syncthing";
|
||||||
|
service.name = "syncthing";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
52
modules/tailscale-ingress.nix
Normal file
52
modules/tailscale-ingress.nix
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{ lib, config, ... }: {
|
||||||
|
options = with lib.types; {
|
||||||
|
lab.tailscaleIngresses = lib.mkOption {
|
||||||
|
type = attrsOf (submodule {
|
||||||
|
options = {
|
||||||
|
host = lib.mkOption { type = str; };
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = lib.mkOption { type = str; };
|
||||||
|
|
||||||
|
portName = lib.mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
cfg = config.lab.tailscaleIngresses;
|
||||||
|
|
||||||
|
mkTailscaleIngress = name: { host, service }: {
|
||||||
|
spec = {
|
||||||
|
ingressClassName = "tailscale";
|
||||||
|
|
||||||
|
rules = [{
|
||||||
|
http.paths = [{
|
||||||
|
path = "/";
|
||||||
|
pathType = "Prefix";
|
||||||
|
|
||||||
|
backend.service = {
|
||||||
|
name = service.name;
|
||||||
|
port.name = service.portName;
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
|
||||||
|
tls = [{
|
||||||
|
hosts = [ host ];
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
kubernetes.resources.ingresses = builtins.mapAttrs mkTailscaleIngress cfg;
|
||||||
|
};
|
||||||
|
}
|
18
modules/tailscale.nix
Normal file
18
modules/tailscale.nix
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{ nixhelm, system, config, lib, ... }: {
|
||||||
|
options.tailscale.enable = lib.mkEnableOption "tailscale";
|
||||||
|
|
||||||
|
config = lib.mkIf config.tailscale.enable {
|
||||||
|
kubernetes = {
|
||||||
|
helm.releases.tailscale = {
|
||||||
|
chart = nixhelm.chartsDerivations.${system}.tailscale.tailscale-operator;
|
||||||
|
includeCRDs = true;
|
||||||
|
namespace = "tailscale";
|
||||||
|
};
|
||||||
|
|
||||||
|
resources.secrets.operator-oauth.stringData = {
|
||||||
|
client_id = "ref+sops://secrets.yml#/tailscale/clientID";
|
||||||
|
client_secret = "ref+sops://secrets.yml#/tailscale/clientSecret";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
77
modules/traefik.nix
Normal file
77
modules/traefik.nix
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
{ lib, globals, config, ... }: {
|
||||||
|
options.traefik.enable = lib.mkEnableOption "traefik";
|
||||||
|
|
||||||
|
config = lib.mkIf config.traefik.enable {
|
||||||
|
kubernetes.resources = {
|
||||||
|
helmChartConfigs = {
|
||||||
|
traefik = {
|
||||||
|
# Override Traefik's service with a static load balancer IP.
|
||||||
|
# Create endpoint for HTTPS on port 444.
|
||||||
|
# Allow external name services for servers in LAN.
|
||||||
|
spec.valuesContent = lib.generators.toYAML { } {
|
||||||
|
providers.kubernetesIngress.allowExternalNameServices = true;
|
||||||
|
service.loadBalancerIP = globals.traefikIPv4;
|
||||||
|
|
||||||
|
ports = {
|
||||||
|
localsecure = {
|
||||||
|
port = 8444;
|
||||||
|
expose = true;
|
||||||
|
exposedPort = 444;
|
||||||
|
protocol = "TCP";
|
||||||
|
|
||||||
|
tls = {
|
||||||
|
enabled = true;
|
||||||
|
options = "";
|
||||||
|
certResolver = "";
|
||||||
|
domains = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
web.redirectTo.port = "websecure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
esrom.spec = {
|
||||||
|
type = "ExternalName";
|
||||||
|
externalName = "esrom.dmz";
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = 80;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
traefik-dashboard.spec = {
|
||||||
|
selector = {
|
||||||
|
"app.kubernetes.io/name" = "traefik";
|
||||||
|
"app.kubernetes.io/instance" = "traefik-kube-system";
|
||||||
|
};
|
||||||
|
|
||||||
|
ports.web = {
|
||||||
|
port = 80;
|
||||||
|
targetPort = "traefik";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lab = {
|
||||||
|
ingresses.esrom = {
|
||||||
|
host = "esrom.kun.is";
|
||||||
|
|
||||||
|
service = {
|
||||||
|
name = "esrom";
|
||||||
|
portName = "web";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
tailscaleIngresses.traefik-dashboard = {
|
||||||
|
host = "traefik";
|
||||||
|
service.name = "traefik-dashboard";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
60
secrets.yml
Normal file
60
secrets.yml
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
freshrss:
|
||||||
|
password: ENC[AES256_GCM,data:ECDPrW+VgO8PY9p2fLIreRETNiRL5ZGnu/PMC7aNj8KaWfyNYL+l3w==,iv:srR/r1EtOpC/CKKrCDKcTLVdMFPAYIJIB1CCg8mS0UU=,tag:YN4PqR5uvPkVskpJWD+91g==,type:str]
|
||||||
|
pihole:
|
||||||
|
password: ENC[AES256_GCM,data:MA60825Tl6aYEFVoPgo8k5Vjb9zmIxtPLJriQV1B3P1bOKu1KK7vxQ==,iv:RGZHox8CbJiEEEjMo2k/tNbtjCPy/QY7vOuMN/YNZcg=,tag:yphrq03IKpXM/tSDBLeSgA==,type:str]
|
||||||
|
hedgedoc:
|
||||||
|
databaseURL: ENC[AES256_GCM,data:6+IV4TaClIGE1XVkUf7JwXzqx3EvWiIKFx9X5x7QKvQKC7bIieD1ADVeAMQmiQfibnH/YV5TgjNY8Ft+3eX881c3yD+2j7mM+O1fX6taK/BCokDnqhIwTN2qxHsu+mrPcM/Pgg5Zqy8HvUgX8jM=,iv:bCwuNk5CVgK2T5IgLebcKwxwloi6FkWMWhnxwJek1GM=,tag:UDQ0KmRDVlDh35Fjm6eaAA==,type:str]
|
||||||
|
sessionSecret: ENC[AES256_GCM,data:7FdRjAShjjue1fFwizCgK+94mkbT4ohAPxdyn/8Z8/f2nvGWPZHO/hGexOixbRGLPewJSaMunTMeJL+IzFlGlg==,iv:iz7640b8Mlb6mNps20b+TbphWDEFUbKwKNUXc0kR5NY=,tag:fdEr1tbes1h8VCA/q+0sOw==,type:str]
|
||||||
|
databasePassword: ENC[AES256_GCM,data:wdRhCluNx2IzgDqouAoIcG6yOWwNLOaEkpqgYEeFvJDZsMC8OUuV7Q==,iv:Csut0c+LRKWD2b4uVuQpGnwwVqnGT6Sk6T/ODlH57Bk=,tag:7bS6a18GyRifq2D6cIheaw==,type:str]
|
||||||
|
nextcloud:
|
||||||
|
databasePassword: ENC[AES256_GCM,data:jRLgW96FnMEpU0T5z/iQOX/CgjpH2ZykZGd1qGFHK8o=,iv:YrY9IsrlCaiQ8BFYqu+UnOxnvvB/JN4iYfy3vMa3wcw=,tag:41iWc4iVqjdUr02O5CLu7g==,type:str]
|
||||||
|
paperless:
|
||||||
|
databasePassword: ENC[AES256_GCM,data:pf6W5gp/zTXFp/sRixSDN9075NE=,iv:tYfRZm0NKUZf9QdFMj2zqnrJ5N998Dde1eDkgHr+FGo=,tag:yysGqVT7iE5FhftQpIdwpA==,type:str]
|
||||||
|
secretKey: ENC[AES256_GCM,data:VYSiiirQm0eyqkJ9+FyEyNnYFjM=,iv:Lf1yVIbO6WK1dC1FmPNQ+8s1TUAOvVQ0IdvH5JtTsWQ=,tag:AsBx2WcrfUV2ieARbHyRXw==,type:str]
|
||||||
|
kitchenowl:
|
||||||
|
jwtSecretKey: ENC[AES256_GCM,data:J3Uz+aHuHUR2KuWre9ZPlpwufqg=,iv:vKzr1ATMyEwgl77Lh1cNuqK9WQsLfOAUu6C3+5S6+Rs=,tag:X4dqZprI22nup/bpsteReg==,type:str]
|
||||||
|
forgejo:
|
||||||
|
lfsJwtSecret: ENC[AES256_GCM,data:AD+0maOZpH7HyQi9I14n4h4T91mns171/TzMmIHcw3toyXS8Dy0VkCnfCg==,iv:CLw15IBCaAzPr7ECbp8O49Fxo6gPsdiv4Ap1eiufAMg=,tag:Ue1OGTD5luYW3dYsam6Ypg==,type:str]
|
||||||
|
internalToken: ENC[AES256_GCM,data:u+oARezKrLvSiBPGMg56FMHJ3K7a71T3txkZwzzyCtZQjrIoL8kW1f2PZEDydKh4YC+c+znPMYrpOO2oPzflnkCIhqWT+nFfz5xPnfkNxnRx4h2CDPq/dyOqTg9P9+q1wej00pUoo+fF,iv:3YwtPj2kayO8ShCoAXP30gAWIMTJZcRplBHmHs+ul2Q=,tag:iHV8VPbpJLRqTgMwIz3+Yw==,type:str]
|
||||||
|
jwtSecret: ENC[AES256_GCM,data:pEhZzorH5/kf+CRS1BnRYywPtvFUYdnsTUlKqT2m9r5kaooyNH3kaImoNw==,iv:2+qIewfp8qTBohx+GM/idCDD751EhDSuxtQ7Pt+gi+A=,tag:UaAbNUiXOq0XM9F4EUSFRQ==,type:str]
|
||||||
|
attic:
|
||||||
|
jwtToken: ENC[AES256_GCM,data:GCDJ0H3rb6NDhNrPNDSTnHpOQwsY3H8hw6WWiGM7lqHSmdt3r4YZYTUtUMrz52TuHO6bPitb+1kQpZhU/j8KDYPsk/XOuMzjLRDjN8f3U9PW8iTH2U1H+A==,iv:fvv3HUu0pDxSVVS/WHbXL936VPErTBAor9dDXv2Jn4s=,tag:oA4Jwf2b72+L+DL4A/QU2Q==,type:str]
|
||||||
|
databaseURL: ENC[AES256_GCM,data:KA+MSnArxr0JtWixY5kKF3fIbbcOPXsnr6PS4hfrSUxkvNSmWMBvQTFU26u2vNMNRTy0+GkdHkNzO6Z8KYsPBMofQ1geksNXLKdZSFIGHsjJ,iv:N7WAjeGoZAnNXmNz6aLlhUSBb9shor+WgRgqhdI1vwE=,tag:tf9OtpmVQBMyChYLtYT9WQ==,type:str]
|
||||||
|
databasePassword: ENC[AES256_GCM,data:2OmuEU4EGaCx0yaFF5O1YtAJ2hM=,iv:JCfTI4IPFYiTt0q0Ffwq0aVIQZr1hRsHgvLQIUbv3sQ=,tag:1vzYJeP1KDhYCUYCFd4sBQ==,type:str]
|
||||||
|
atuin:
|
||||||
|
databaseURL: ENC[AES256_GCM,data:+8MTiIKvhiH5uuzXh4nLQesBjUeuPy6CoZ0sfLCFPUn6kQS56+y+8hgDIPogIbLviRkGDPw=,iv:wkmUXFpsDE+ZAKKXYmGzLy97jcgL+XzUphThLohQNL4=,tag:H+K4lfR2ylyV//Ie9YzgTw==,type:str]
|
||||||
|
databasePassword: ENC[AES256_GCM,data:vNN3I9P3HSD55Zj1GYj+VBu4ipU=,iv:8HcdnSNYpLGjmUgV7iCrmWJJummEhWce8cZo+Vi159s=,tag:OiND109DjT9+3pKmxtxk5w==,type:str]
|
||||||
|
immich:
|
||||||
|
databasePassword: ENC[AES256_GCM,data:P0G1tsDeqj0amp/XvTLAn0WFhkE=,iv:Cb1Aw6iNWTpGoSE+9YTSon0e/7ObMlmI4vrwYpkZw7A=,tag:yyWsxDTjfNwvmPjEbfe+5w==,type:str]
|
||||||
|
tailscale:
|
||||||
|
clientID: ENC[AES256_GCM,data:ag11bNXlLIpZByuxl+wZ0Nw=,iv:U4LW7BJAUgEoaFFX4LgWbdPcsmTGw6n3OILkAxoMYI4=,tag:JV12pnWrsSgpmyqzTbcgdg==,type:str]
|
||||||
|
clientSecret: ENC[AES256_GCM,data:pzBXa6OVQtzUhtQVLKdeZMR08nGqGAMnIDS99Mi63+Box1z/Sjwz56lxrMcA4szmvs8M4xEsdWrt32KhTyQL,iv:f3IjzJ7X5pCQEAmYV4xgVTPXRCqYGKTJW97G7UKGp8A=,tag:qNzeA1i2GVUQT5wTG0tvtw==,type:str]
|
||||||
|
sops:
|
||||||
|
kms: []
|
||||||
|
gcp_kms: []
|
||||||
|
azure_kv: []
|
||||||
|
hc_vault: []
|
||||||
|
age:
|
||||||
|
- recipient: age189laethzry4ylnd790dmpuc4xjjuwqxruc76caj3ceqhqug4g9qs0upuvw
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSByeE1Udi9RYktGc3V3OTFq
|
||||||
|
SU0rMmN4NjNTUUdsMkFXN2ZjeTkzek54aGxRCkdELzV3QldrRGJPak9vUFJnMXdJ
|
||||||
|
b1FxS1VHSlg0VmU3dUZUbzgxU0J5Y1kKLS0tIDJKVVNlbjVWT09tL3NuWFFFL1Z0
|
||||||
|
L3ViU29vajh4SThTMW8xdkptV1pxaFkKnQvTcgi0K+EeNnFDLyKeU5WHAQsxJwDM
|
||||||
|
coV7IFhB2QcTFSYg/yzBfQNSJ8FUzLmzYY5207njlZxvS8LDYX/Cvw==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
- recipient: age159whjxeyw94xmkkephmtlur8e85xd9d5vnvkwkcayfv7el0neqfq863yga
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBDaXFqek5Hb1JYN0hMNzIw
|
||||||
|
d2YzZVMxYkJZTmlnaG1xOTEyS2pzaGgvUTMwCitTcGtHd0loMzMvV0ZkTVd1YUtk
|
||||||
|
RFI4UkIvNGNteDNaS0dUeUp5a25sQ3MKLS0tIHFmWEJwV3JQczhGWXFyL1JUY2VP
|
||||||
|
azR0UkJyL0RwUVk4ZzdkSWptcDlWVjAK5FU9B5TBSnV3azO4eCv13T6i3dGGuI68
|
||||||
|
UgBrVEb1/Fv+4XTjeSEhpiOaH8sNWYoNa3Aa7uTZYlHDRWga2GC7zw==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2024-09-06T21:34:02Z"
|
||||||
|
mac: ENC[AES256_GCM,data:BjH6TwjVo3m3cEsJDz8H/Y77Z7QlBcqflrZ473wJmlRyxpy8wwh0jaItgZHrMtETZwp/7L6iXLjPTrb/8zCL8HH4z2artGFT727dFBAUcj796VFwHzd3BFMg/YdHTr5Oh1ZCi0u7t9ppKTXw/FMgmE+7tjo2JLfhrEecjAEt3ok=,iv:kEibSGsewpgWH5C6nvszdSInfptSC4qY9b1lhJELkk8=,tag:LvJKLpXTQfCQXLLqG023HQ==,type:str]
|
||||||
|
pgp: []
|
||||||
|
unencrypted_suffix: _unencrypted
|
||||||
|
version: 3.8.1
|
Loading…
Reference in a new issue