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` - `freshrss`
- `radicale` - `radicale`
- `kms` - `kms`
- `atuin`
## Known bugs ## Known bugs

View file

@ -72,4 +72,6 @@
"${self}/kubenix-modules/radicale.nix" "radicale" "radicale"; "${self}/kubenix-modules/radicale.nix" "radicale" "radicale";
kubenix.kms = mkDeployScriptAndManifest kubenix.kms = mkDeployScriptAndManifest
"${self}/kubenix-modules/kms.nix" "kms" "kms"; "${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 ./dnsmasq.nix
./blog.nix ./blog.nix
./attic.nix ./attic.nix
./atuin.nix
./immich.nix ./immich.nix
# ./argo.nix # ./argo.nix
# ./minecraft.nix # ./minecraft.nix

View file

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

View file

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

View file

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