groups:
  - name: "Configuration"
    description: "Storj application configuration"
  - name: "Storage"
    description: "Configure storage for storj"
  - name: "Networking"
    description: "Networking Configuration for storj"
  - name: "Advanced DNS Settings"
    description: "Configure DNS settings"
  - name: "Resource Limits"
    description: "Set CPU/memory limits for Kubernetes Pod"

portals:
  web_portal:
    protocols:
      - "http"
    host:
      - "$node_ip"
    ports:
      - "$variable-webPort"
    path: "/"

questions:
  - variable: webPort
    label: "Web Port for Storj"
    group: Networking
    schema:
      type: int
      min: 9000
      max: 65535
      default: 20909
      required: true
  - variable: nodePort
    label: "Node Port for Storj"
    description: |
      This port will be used for both TCP and UDP traffic. </br>
      Note that this port must be open on your firewall and that internal
      Storj port will not be affected by this change, but only the external (Node Port)
    group: Networking
    schema:
      type: int
      min: 9000
      max: 65535
      default: 28967
      required: true

  - variable: dnsConfig
    label: "DNS Configuration"
    group: "Advanced DNS Settings"
    schema:
      type: dict
      attrs:
        - variable: options
          label: "DNS Options"
          schema:
            type: list
            items:
              - variable: optionsEntry
                label: "Option Entry Configuration"
                schema:
                  type: dict
                  attrs:
                    - variable: name
                      label: "Option Name"
                      schema:
                        type: string
                        required: true
                    - variable: value
                      label: "Option Value"
                      schema:
                        type: string
                        required: true

  - variable: wallet
    label: "Configure Wallet for Storj"
    group: "Configuration"
    schema:
      type: string
      required: true

  - variable: authToken
    label: "Configure Auth token for Storj Node"
    group: "Configuration"
    schema:
      type: string
      required: true

  - variable: email
    label: "Configure Email for Storj"
    group: "Configuration"
    schema:
      type: string
      required: true

  - variable: domainAddress
    label: "Add Your Storage Domain for Storj"
    group: "Configuration"
    schema:
      type: string
      required: true

  - variable: zksync
    label: "Opt-in to zkSync"
    description: Appends --operator.wallet-features=zksync flag to the storagenode command
    group: "Configuration"
    schema:
      type: boolean
      default: false

  - variable: terminationGracePeriod
    label: Termination Grace Period
    description: Optional duration in seconds the pod needs to terminate gracefully.
    group: "Configuration"
    schema:
      type: int
      min: 30
      default: 30

  - variable: storageSize
    label: "Configure Storage Size You Want To Share in GB's"
    group: Storage
    schema:
      type: int
      min: 500
      default: 500

  - variable: runAsUser
    label: "Owner User ID"
    group: "Configuration"
    schema:
      immutable: true
      type: int
      default: 568
      min: 1
      max: 65535

  - variable: runAsGroup
    label: "Owner Group ID"
    group: "Configuration"
    schema:
      immutable: true
      type: int
      default: 568
      min: 1
      max: 65535


  - variable: environmentVariables
    label: "Storj Extra Environment Variables"
    group: "Configuration"
    schema:
      type: list
      default: []
      items:
        - variable: environmentVariable
          label: "Environment Variable"
          schema:
            type: dict
            attrs:
              - variable: name
                label: "Name"
                schema:
                  type: string
              - variable: value
                label: "Value"
                schema:
                  type: string

  - variable: appVolumeMounts
    label: "Storj Configuration"
    group: "Storage"
    schema:
      type: dict
      attrs:
        - variable: data
          label: "Configuration Data Volume to Share on Storj"
          schema:
            type: dict
            attrs:
              - variable: datasetName
                label: "Configuration Volume Dataset Name"
                schema:
                  type: string
                  hidden: true
                  $ref:
                    - "normalize/ixVolume"
                  show_if: [["hostPathEnabled", "=", false]]
                  default: "ix_data"
                  editable: false
              - variable: mountPath
                label: "Configuration Mount Path"
                description: "Path Where the Volume Will be Mounted Inside the Pod"
                schema:
                  type: path
                  hidden: true
                  editable: false
                  default: "/app/config"
              - variable: hostPathEnabled
                label: "Enable Custom Host Path for Storj Configuration Volume"
                schema:
                  type: boolean
                  default: false
                  show_subquestions_if: true
                  subquestions:
                    - variable: hostPath
                      label: "Host Path for Storj Configuration Volume"
                      schema:
                        type: hostpath
                        required: true
        - variable: identity
          label: "Configure Identity Volume for Storage Node"
          schema:
            type: dict
            attrs:
              - variable: datasetName
                label: "Configure Storj Identity Volume to Allocate"
                schema:
                  type: string
                  hidden: true
                  $ref:
                    - "normalize/ixVolume"
                  show_if: [["hostPathEnabled", "=", false]]
                  default: "ix_identity"
                  editable: false
              - variable: mountPath
                label: "Configure Storj Identity Volume to Allocate"
                description: "Path where the volume will be mounted inside the pod"
                schema:
                  type: path
                  hidden: true
                  editable: false
                  default: "/app/identity"
              - variable: hostPathEnabled
                label: "Enable Custom Host Path for Storj Identity Volume"
                schema:
                  type: boolean
                  default: false
                  show_subquestions_if: true
                  subquestions:
                    - variable: hostPath
                      label: "Host Path for Storj identity Volume"
                      schema:
                        type: hostpath
                        required: true

  - variable: extraAppVolumeMounts
    label: "Extra Host Path Volumes"
    group: "Storage"
    schema:
      type: list
      items:
        - variable: extraAppVolume
          label: "Host Path Volume"
          description: "Add an extra host path volume for storj"
          schema:
            type: dict
            attrs:
              - variable: mountPath
                label: "Mount Path in Pod"
                description: "Path where the volume will be mounted inside the pod."
                schema:
                  type: path
                  required: true
              - variable: hostPath
                label: "Host Path"
                description: "Host path"
                schema:
                  type: hostpath
                  required: true

  - variable: enableResourceLimits
    label: "Enable Pod resource limits"
    group: "Resource Limits"
    schema:
      type: boolean
      default: false
  - variable: cpuLimit
    label: "CPU Limit"
    description: "CPU resource limit allow  plain integer values with suffix m(milli) e.g 1000m, 100."
    group: "Resource Limits"
    schema:
      type: string
      show_if: [["enableResourceLimits", "=", true]]
      valid_chars: "^\\d+(?:\\.\\d+(?!.*m$)|m?$)"
      default: "4000m"
  - variable: memLimit
    label: "Memory Limit"
    group: "Resource Limits"
    description: "Memory limits is specified by number of bytes. Followed by quantity suffix like E,P,T,G,M,k and Ei,Pi,Ti,Mi,Gi,Ki can also be used. e.g 129e6, 129M,  128974848000m, 123Mi"
    schema:
      type: string
      show_if: [["enableResourceLimits", "=", true]]
      valid_chars: "^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
      default: "8Gi"
