feat(atuin): Move to separate k8s namespace

This commit is contained in:
Pim Kunis 2024-07-14 14:14:08 +02:00
parent e4b7b69bbb
commit 3fcbbfa8c2
6 changed files with 78 additions and 65 deletions

View file

@ -56,6 +56,7 @@ Currently, the applications being deployed like this are:
- `freshrss`
- `radicale`
- `kms`
- `atuin`
## Known bugs

View file

@ -72,4 +72,6 @@
"${self}/kubenix-modules/radicale.nix" "radicale" "radicale";
kubenix.kms = mkDeployScriptAndManifest
"${self}/kubenix-modules/kms.nix" "kms" "kms";
kubenix.atuin = mkDeployScriptAndManifest
"${self}/kubenix-modules/atuin.nix" "atuin" "atuin";
})

View file

@ -13,7 +13,6 @@ let
./dnsmasq.nix
./blog.nix
./attic.nix
./atuin.nix
./immich.nix
# ./argo.nix
# ./minecraft.nix

View file

@ -1,84 +1,80 @@
{
kubernetes.resources = {
secrets.atuin.stringData = {
secrets.database.stringData = {
databasePassword = "ref+sops://secrets/kubernetes.yaml#/atuin/databasePassword";
databaseURL = "ref+sops://secrets/kubernetes.yaml#/atuin/databaseURL";
};
deployments.atuin = {
metadata.labels.app = "atuin";
deployments.server.spec = {
selector.matchLabels.app = "atuin";
spec = {
selector.matchLabels.app = "atuin";
strategy = {
type = "RollingUpdate";
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels.app = "atuin";
template = {
metadata.labels.app = "atuin";
spec = {
volumes = {
data.persistentVolumeClaim.claimName = "atuin";
db.persistentVolumeClaim.claimName = "atuin-db";
spec = {
volumes = {
data.persistentVolumeClaim.claimName = "data";
database.persistentVolumeClaim.claimName = "database";
};
containers = {
atuin = {
image = "ghcr.io/atuinsh/atuin:18.3.0";
imagePullPolicy = "Always";
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";
}];
};
containers = {
atuin = {
image = "ghcr.io/atuinsh/atuin:18.3.0";
imagePullPolicy = "Always";
ports.web.containerPort = 8888;
args = [ "server" "start" ];
database = {
image = "postgres:14";
ports.web.containerPort = 5432;
env = {
ATUIN_HOST.value = "0.0.0.0";
ATUIN_PORT.value = "8888";
ATUIN_OPEN_REGISTRATION.value = "false";
env = {
POSTGRES_DB.value = "atuin";
POSTGRES_USER.value = "atuin";
ATUIN_DB_URI.valueFrom.secretKeyRef = {
name = "atuin";
key = "databaseURL";
};
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
name = "database";
key = "databasePassword";
};
volumeMounts = [{
name = "data";
mountPath = "/config";
}];
};
database = {
image = "postgres:14";
ports.web.containerPort = 5432;
env = {
POSTGRES_DB.value = "atuin";
POSTGRES_USER.value = "atuin";
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
name = "atuin";
key = "databasePassword";
};
};
volumeMounts = [{
name = "db";
mountPath = "/var/lib/postgresql/data";
}];
};
volumeMounts = [{
name = "database";
mountPath = "/var/lib/postgresql/data";
}];
};
};
};
};
};
services.atuin.spec = {
services.server.spec = {
selector.app = "atuin";
ports.web = {
@ -88,12 +84,26 @@
};
};
lab.ingresses.atuin = {
host = "atuin.kun.is";
lab = {
ingresses.server = {
host = "atuin.kun.is";
service = {
name = "atuin";
portName = "web";
service = {
name = "server";
portName = "web";
};
};
longhorn.persistentVolumeClaim = {
data = {
volumeName = "atuin";
storage = "300Mi";
};
database = {
volumeName = "atuin-db";
storage = "300Mi";
};
};
};
}

View file

@ -65,6 +65,7 @@
freshrss = { };
radicale = { };
kms = { };
atuin = { };
};
nodes =

View file

@ -36,8 +36,6 @@
bazarr.storage = "25Mi";
attic.storage = "15Gi";
attic-db.storage = "150Mi";
atuin.storage = "300Mi";
atuin-db.storage = "300Mi";
immich.storage = "50Gi";
immich-db.storage = "5Gi";
};
@ -45,6 +43,8 @@
longhorn.persistentVolume = {
freshrss.storage = "1Gi";
radicale.storage = "200Mi";
atuin.storage = "300Mi";
atuin-db.storage = "300Mi";
};
nfsVolumes = {