# lab-iscsi-target.yaml - iSCSI target reference for shared storage
#
# Reference configuration for an iSCSI target serving the IncusOS cluster's
# lvmcluster shared storage pool. All 3 IncusOS cluster nodes connect as
# iSCSI initiators via their built-in iSCSI service.
#
# Two deployment options (see notes/shared-storage-guide.md):
#
#   Option A (tested, recommended for lab):
#     Deploy as an Incus container with `tgt` on the existing cluster.
#     No extra VM needed. See shared-storage-guide.md Section 2 for the
#     full tested walkthrough.
#
#   Option B (this file):
#     Deploy as a standalone Proxmox VM with targetcli-fb. Better for
#     production-like setups or when you want the target independent of
#     the Incus cluster. Manual Proxmox deployment required.
#
# Architecture:
#   iscsi-target (410) - Debian 12 + targetcli-fb, 200G LUN
#   oc-node-01   (400) - iSCSI initiator + lvmcluster
#   oc-node-02   (401) - iSCSI initiator + lvmcluster
#   oc-node-03   (402) - iSCSI initiator + lvmcluster
#
# Option B deployment steps:
#   1. Download Debian 12 cloud image or install from ISO
#   2. Create VM: VMID 410, 1 core, 1 GiB RAM, 200 GiB disk
#   3. Network: vmbr0, VLAN tag 69
#   4. Static IP: 192.168.102.150/22, gateway 192.168.100.1
#   5. After boot: run post-install commands below
#   6. Enable iSCSI on IncusOS nodes (shared-storage-guide.md Section 4)
#
# RAM budget: 1 GiB (adds minimal overhead to the 28 GiB cluster)
#
# See notes/shared-storage-guide.md for the full shared storage guide.

# Reference configuration (for documentation — not used by incusos-proxmox)
target_vm:
  name: iscsi-target
  vmid: 410
  os: debian/12
  cores: 1
  memory: 1024
  disk: 200
  ip: 192.168.102.150/22
  gateway: 192.168.100.1
  dns: 192.168.100.1
  vlan: 69

iscsi:
  iqn: iqn.2026-02.lab.incus:storage.shared
  lun_path: /srv/iscsi/shared-lun.img
  lun_size: 200G
  port: 3260
  auth: none  # Lab environment — no CHAP

# Post-install commands (run on the target VM after Debian is installed):
#
#   apt-get update && apt-get install -y targetcli-fb
#   systemctl enable rtslib-fb-targetctl
#   mkdir -p /srv/iscsi
#   truncate -s 200G /srv/iscsi/shared-lun.img
#
#   targetcli <<'EOF'
#   /backstores/fileio create shared-lun /srv/iscsi/shared-lun.img 200G
#   /iscsi create iqn.2026-02.lab.incus:storage.shared
#   /iscsi/iqn.2026-02.lab.incus:storage.shared/tpg1/luns create /backstores/fileio/shared-lun
#   /iscsi/iqn.2026-02.lab.incus:storage.shared/tpg1 set attribute authentication=0
#   /iscsi/iqn.2026-02.lab.incus:storage.shared/tpg1 set attribute demo_mode_write_protect=0
#   /iscsi/iqn.2026-02.lab.incus:storage.shared/tpg1 set attribute generate_node_acls=1
#   saveconfig
#   EOF
