---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
  annotations:
    meta.helm.sh/release-name: iscsi-democratic-csi
    meta.helm.sh/release-namespace: democratic-csi
  name: secret-democratic-csi-driver-config-iscsi
  namespace: democratic-csi
stringData:
  driver-config-file.yaml: |-
    driver: freenas-api-iscsi
    ## generate guid `uuidgen` per helm release
    instance_id: 6D91A62F-2373-430E-8988-DE0B191EEB16
    httpConnection:
      protocol: http
      host: "${SECRET_TRUENAS_IP}"
      port: 80
      apiKey: "${SECRET_TRUENAS_APIKEY}"
      allowInsecure: true
    zfs:
      cli:
        ## allow non-root user to sudo
        sudoEnabled: true

      # can be used to set arbitrary values on the dataset/zvol
      # use handlebars templates with the parameters from the storage class/CO
      datasetProperties:
        "org.freenas:description": "flux-{{ parameters.[csi.storage.k8s.io/pvc/namespace] }}-{{ parameters.[csi.storage.k8s.io/pvc/name] }}"

      # total volume name (zvol/<datasetParentName>/<pvc name>) length cannot exceed 63 chars
      # standard volume naming overhead is 46 chars; datasetParentName should therefore be 17 chars or less
      datasetParentName: ssdpool/csi/ixi/v
      ## do NOT make datasetParentName and detachedSnapshotsDatasetParentName overlap
      ## they may be siblings, but neither should be nested in the other
      detachedSnapshotsDatasetParentName: ssdpool/csi/ixi/s

    iscsi:
      targetPortal: "${SECRET_TRUENAS_IP}:3260"  # specific address for iscsi
      targetPortals: []
      # leave empty to omit usage of -I with iscsiadm
      interface:
      nameTemplate: "{{ parameters.[csi.storage.k8s.io/pvc/namespace] }}-{{ parameters.[csi.storage.k8s.io/pvc/name] }}"
      namePrefix: flux-
      # add as many as needed
      targetGroups:
        # get the correct ID from the "portal" section in the UI
        - targetGroupPortalGroup: 2
          # get the correct ID from the "initiators" section in the UI
          targetGroupInitiatorGroup: 3
          # None, CHAP, or CHAP Mutual
          targetGroupAuthType: None
          # get the correct ID from the "Authorized Access" section of the UI - only required if using Chap
          targetGroupAuthGroup:
      extentInsecureTpc: true
      extentXenCompat: false
      extentDisablePhysicalBlocksize: true
      # 512, 1024, 2048, or 4096,
      extentBlocksize: 4096
      # "" (let FreeNAS decide, currently defaults to SSD), Unknown, SSD, 5400, 7200, 10000, 15000
      extentRpm: "SSD"
      # 0-100 (0 == ignore)
      extentAvailThreshold: 0
