feat(deploy): split node1 and node4 manifests and cap box2 home at 150Gi
Node4 drops the egress proxy. Its home volume is a 150Gi LVM logical volume so the filesystem size is a real quota.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
Personal Cursor Remote-SSH workspace image and GitOps for **node1-k3s** and a second home on **node4-k3s**.
|
||||
|
||||
- **Image**: `dcr.trinitysan.by/infra/cursor-devbox`
|
||||
- **Deploy**: `deploy/` (Namespace, StatefulSet, ingress)
|
||||
- **Deploy**: `deploy/node1-k3s/` and `deploy/node4-k3s/`
|
||||
- **Flux image automation**: `flux/` (ImageRepository / ImagePolicy / ImageUpdateAutomation)
|
||||
|
||||
Infra on node1 only keeps thin Flux glue (`GitRepository` + Kustomizations + auth SecretAdapters) in `infrastructure/node1-k3s/130-cursor-devbox.yaml`.
|
||||
@@ -39,7 +39,7 @@ docker build -t dcr.trinitysan.by/infra/cursor-devbox:local .
|
||||
|
||||
1. CI pushes `run_number-sha` to DCR
|
||||
2. ImageRepository scans; ImagePolicy picks highest `run_number`
|
||||
3. ImageUpdateAutomation commits the new tag into `deploy/020-statefulset.yaml`
|
||||
3. ImageUpdateAutomation commits the new tag into `deploy/node1-k3s/020-statefulset.yaml` and `deploy/node4-k3s/020-statefulset.yaml`
|
||||
4. Kustomization applies; StatefulSet rolls (active SSH sessions drop)
|
||||
|
||||
Requires a Gitea PAT with **read+write** on this repo (`GITEA_CURSOR_DEVBOX_GITOPS_TOKEN` on node1, see infra `060-external-secrets.yaml.template`).
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# Namespace, DCR pull secret, SSH allowlist, Service.
|
||||
# Reconciled by Flux Kustomization cursor-devbox (path ./deploy-node4) on node4-k3s.
|
||||
# Reconciled by Flux Kustomization cursor-devbox (path ./deploy/node1-k3s) on node1-k3s.
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
@@ -1,5 +1,5 @@
|
||||
# Namespace, DCR pull secret, SSH allowlist, Service.
|
||||
# Reconciled by Flux Kustomization cursor-devbox (path ./deploy) on node1-k3s.
|
||||
# Reconciled by Flux Kustomization cursor-devbox (path ./deploy/node4-k3s) on node4-k3s.
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
@@ -38,6 +38,7 @@ data:
|
||||
authorized_keys: |
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDbyPCd5RhlTZYCIgmrSGR6ugnwI513vzHf0qvUP3pGf8mYVd68G6CLu9OXJxFv+LKo2eT8H3ToxLpuG0iiIWz+4rJrNXTJInU2lqrcMsHhLoo1XCs7OAARYiIp7Pl4XKcLdbiXwdL2XUsHImv7cjmaD6jGJ3yR+q9t6jORQEB/h6nUc0MMkNKLIrUyJSlZtWRp22ymGnEqiwKl9doukii6QBhY1k+i9oW09ln6gbFTol9KoONkJ74b2iKw5abZwyjjXuXaE1b98/nmI30MYs8VMJC/w9pEZbmVEflb1k4+C1IE5llwmievjNWpWlZt38uzvGTLbiC9mMIewwFm4UsT5ASLpYKBdFrCaK4JIOTCdJt+SMInkzz0rArCNPMBwZIjBgCFSM33nJsX4gbf/l/rnVtLjXr86rF5s9SOSVyQmjPJoBigqyGw45H2CrB7iTqqWGCpPTnXbzzspiIQGYXLW5+5/4wARCPO0KXYcPgg4Vzh5z+dMcFKJvc8XhocZCc= aaa@LAPTOP-08PG1IL5
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDK+dk9MtPgRZr7638SASpbJK7z+XkmBesXRlozTFqvT0X6gKk+75kyqNR2W+ZXDwiiWuXS2t9Dbdk9Xpuj2uWaUE0D+n3NOFEQV27Zd1ZTMeLlf3ukSLhb7un0pFHXQXvPn2Iwhh5zCyTDvIWU1rHUgBmakmxoRZ6zwJdsZX/yZHurts//7Dvb2xKKYAq4MFMAB+s6Ch80q6kCnHcByJVFyVLfOUVcNzHGUQbbj4pft2QYiTVxqTBZdvdWQvdBRkKjV2oK/mRUfGsdwmk+ldT65hdcFjbG3oG4hD3g2+AJC+/vN/xqlCeht/TU/Ei4GMF3UB3ank7z1rsGbU1T5lDoFWBWMg+tgw7ZdbYD+HIi/kuQU3FKM2xekB2fgpzuu5GQynjflygBmuQQp5/HAJDoxrkt+Yn79QX6aan8xXcHnt600Bm7SWfnsCl6BpcaD/8f2Lr8CcFCN5pcG020gvLSVdok71dB27NQ/2HOax1i0WQTZVjDrL6kMwRb37njr/k= svv@LAPTOP-08PG1IL5
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID6eoy26uB34KMWMB0tbsqNHNoiF6X9gOta12vCiqZpJ djest@DESKTOP-A4K82V0
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
@@ -0,0 +1,110 @@
|
||||
# File-backed LVM so the home filesystem cannot grow past 150Gi.
|
||||
# The node root disk is one ext4; a 152Gi image is the volume group, the LV is 150Gi.
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: cursor-devbox-lvm
|
||||
namespace: cursor-devbox
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cursor-devbox-lvm
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cursor-devbox-lvm
|
||||
spec:
|
||||
hostPID: true
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
containers:
|
||||
- name: setup
|
||||
image: ubuntu:24.04
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
privileged: true
|
||||
command: ["nsenter", "-t", "1", "-m", "-u", "-i", "--", "bash", "-c"]
|
||||
args:
|
||||
- |
|
||||
set -euo pipefail
|
||||
mkdir -p /var/lib/cursor-devbox /usr/local/sbin /mnt/cursor-devbox-home
|
||||
cat > /usr/local/sbin/cursor-devbox-lvm-setup << 'EOF'
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IMG=/var/lib/cursor-devbox/backing.img
|
||||
MNT=/mnt/cursor-devbox-home
|
||||
mkdir -p /var/lib/cursor-devbox "$MNT"
|
||||
if [ ! -f "$IMG" ]; then
|
||||
fallocate -l 152G "$IMG"
|
||||
fi
|
||||
if ! losetup -j "$IMG" | grep -q .; then
|
||||
losetup -f "$IMG"
|
||||
fi
|
||||
LOOP=$(losetup -j "$IMG" | awk -F: 'NR==1 {print $1}')
|
||||
if ! vgs cursor-devbox >/dev/null 2>&1; then
|
||||
pvcreate "$LOOP"
|
||||
vgcreate cursor-devbox "$LOOP"
|
||||
fi
|
||||
vgchange -ay cursor-devbox
|
||||
if ! lvs cursor-devbox/home >/dev/null 2>&1; then
|
||||
lvcreate -L 150G -n home cursor-devbox
|
||||
mkfs.ext4 -F /dev/cursor-devbox/home
|
||||
fi
|
||||
if ! mountpoint -q "$MNT"; then
|
||||
mount /dev/cursor-devbox/home "$MNT"
|
||||
fi
|
||||
EOF
|
||||
chmod 755 /usr/local/sbin/cursor-devbox-lvm-setup
|
||||
cat > /etc/systemd/system/cursor-devbox-lvm.service << 'EOF'
|
||||
[Unit]
|
||||
Description=Cursor devbox home LVM
|
||||
DefaultDependencies=no
|
||||
After=local-fs.target
|
||||
Before=k3s.service
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/local/sbin/cursor-devbox-lvm-setup
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl enable cursor-devbox-lvm.service
|
||||
/usr/local/sbin/cursor-devbox-lvm-setup
|
||||
sleep infinity
|
||||
resources:
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 32Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 256Mi
|
||||
---
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: cursor-devbox-lvm
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: cursor-devbox-home
|
||||
spec:
|
||||
capacity:
|
||||
storage: 150Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: cursor-devbox-lvm
|
||||
local:
|
||||
path: /mnt/cursor-devbox-home
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- ssdnodes-6aa563e76974d
|
||||
@@ -33,12 +33,6 @@ spec:
|
||||
value: tcp://127.0.0.1:2375
|
||||
- name: HOME
|
||||
value: /home/developer
|
||||
- name: HTTP_PROXY
|
||||
value: socks5h://node2-socks5.egress-proxy.svc.clusterset.local:1080
|
||||
- name: HTTPS_PROXY
|
||||
value: socks5h://node2-socks5.egress-proxy.svc.clusterset.local:1080
|
||||
- name: NO_PROXY
|
||||
value: localhost,127.0.0.1,::1,.svc,.svc.cluster.local,.svc.clusterset.local,.trinitysan.by,107.155.122.141,107.155.122.212,63.250.53.80,91.210.106.53,10.0.0.0/8,10.32.0.0/12,10.43.0.0/16,10.51.0.0/16,10.53.0.0/16
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: true
|
||||
capabilities:
|
||||
@@ -113,7 +107,7 @@ spec:
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: local-storage
|
||||
storageClassName: cursor-devbox-lvm
|
||||
resources:
|
||||
requests:
|
||||
storage: 30Gi
|
||||
storage: 150Gi
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- 010-namespace-secrets.yaml
|
||||
- 015-lvm.yaml
|
||||
- 020-statefulset.yaml
|
||||
- 030-ingress.yaml
|
||||
@@ -1,7 +1,7 @@
|
||||
# Flux image automation for cursor-devbox (applied into flux-system on node1).
|
||||
# GitRepository cursor-devbox is defined in infra glue (130-cursor-devbox.yaml).
|
||||
# CI tags: latest, <sha>, <run_number>-<sha> — policy elects the last form.
|
||||
# Setters scan the whole repo so both deploy/ and deploy-node4/ stay on the elected tag.
|
||||
# Setters scan the repo so deploy/node1-k3s and deploy/node4-k3s stay on the elected tag.
|
||||
|
||||
---
|
||||
apiVersion: image.toolkit.fluxcd.io/v1
|
||||
|
||||
Reference in New Issue
Block a user