apiVersion: v1
kind: Pod
metadata:
  generateName: cryptsetup-
spec:
  containers:
  - command:
    - bash
    - -c
    args:
      - |
        echo $LUKS_PASSWORD | chroot /host /usr/sbin/cryptsetup luksOpen /dev/sda storage -
        chroot /host/ /sbin/vgscan --mknodes
        chroot /host/ /sbin/vgchange -a y
        mkdir /host/var/lib/storage
        mount /host/dev/storage/longhorn /host/var/lib/storage
    image: quay.io/fedora/fedora:40
    imagePullPolicy: IfNotPresent
    name: debugger
    resources: {}
    stdin: true
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    env:
      - name: LUKS_PASSWORD
        valueFrom:
          secretKeyRef:
            name: cryptsetup
            key: LUKS_PASSWORD
    tty: true
    volumeMounts:
    - mountPath: /host
      name: host-root
      mountPropagation: Bidirectional
    securityContext:
      privileged: true
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  hostIPC: true
  hostNetwork: true
  hostPID: true
  nodeName: node01.k8s01.example.com
  restartPolicy: Never
  terminationGracePeriodSeconds: 30
  tolerations:
  - operator: Exists
  volumes:
  - hostPath:
      path: /
      type: ""
    name: host-root