# Include{groups}
portals:
  open:
    protocols:
      - "$kubernetes-resource_configmap_portal_protocol"
    host:
      - "$kubernetes-resource_configmap_portal_host"
    ports:
      - "$kubernetes-resource_configmap_portal_port"
questions:
  - variable: portal
    group: "Container Image"
    label: "Configure Portal Button"
    schema:
      type: dict
      hidden: true
      attrs:
        - variable: enabled
          label: "Enable"
          description: "enable the portal button"
          schema:
            hidden: true
            editable: false
            type: boolean
            default: true
# Include{global}
  - variable: imageSelector
    group: "Container Image"
    label: "Select Image"
    schema:
      type: string
      default: "image"
      enum:
        - value: "image"
          description: "Java 17 HotSpot"
        - value: "j11Image"
          description: "Java 11 HotSpot"
        - value: "j11j9Image"
          description: "Java 11 OpenJ9"
        - value: "j8Image"
          description: "Java 8 HotSpot"
        - value: "j8j9Image"
          description: "Java 8 OpenJ9"

  - variable: controller
    group: "Controller"
    label: ""
    schema:
      additional_attrs: true
      type: dict
      attrs:
        - variable: advanced
          label: "Show Advanced Controller Settings"
          schema:
            type: boolean
            default: false
            show_subquestions_if: true
            subquestions:
              - variable: type
                description: "Please specify type of workload to deploy"
                label: "(Advanced) Controller Type"
                schema:
                  type: string
                  default: "deployment"
                  required: true
                  enum:
                    - value: "deployment"
                      description: "Deployment"
                    - value: "statefulset"
                      description: "Statefulset"
                    - value: "daemonset"
                      description: "Daemonset"
              - variable: replicas
                description: "Number of desired pod replicas"
                label: "Desired Replicas"
                schema:
                  type: int
                  default: 1
                  required: true
              - variable: strategy
                description: "Please specify type of workload to deploy"
                label: "(Advanced) Update Strategy"
                schema:
                  type: string
                  default: "Recreate"
                  required: true
                  enum:
                    - value: "Recreate"
                      description: "Recreate: Kill existing pods before creating new ones"
                    - value: "RollingUpdate"
                      description: "RollingUpdate: Create new pods and then kill old ones"
                    - value: "OnDelete"
                      description: "(Legacy) OnDelete: ignore .spec.template changes"
# Include{controllerExpert}
  - variable: secretEnv
    group: "Container Configuration"
    label: "Image Secrets"
    schema:
      additional_attrs: true
      type: dict
      attrs:
        - variable: RCON_PASSWORD
          label: "RCON_PASSWORD"
          description: "This will only have effect in the first installation or always if OVERRIDE_SERVER_PROPERTIES is enabled"
          schema:
            type: string
            private: true
            default: ""
  - variable: env
    group: "Container Configuration"
    label: "Image Environment"
    schema:
      additional_attrs: true
      type: dict
      attrs:
        - variable: EULA
          label: "Minecraft Eula - Link in readme sources"
          schema:
            type: boolean
            required: true
            default: false
        - variable: OVERRIDE_SERVER_PROPERTIES
          label: "OVERRIDE_SERVER_PROPERTIES"
          description: "Enable this so RCON_PASSWORD will always have effect."
          schema:
            type: boolean
            default: false
        - variable: VERSION
          label: "Minecraft Version - LATEST, SNAPSHOT, or verison"
          schema:
            type: string
            required: true
            default: "LATEST"
        - variable: TYPE
          label: "Server Type"
          schema:
            type: string
            required: true
            default: "VANILLA"
            enum:
              - value: "VANILLA"
                description: "Vanilla"
              - value: "FORGE"
                description: "Forge"
              - value: "FABRIC"
                description: "Fabric"
              - value: "SPIGOT"
                description: "Spigot"
              - value: "BUKKIT"
                description: "Bukkit"
              - value: "PAPER"
                description: "Paper"
              - value: "AIRPLANE"
                description: "Airplane"
              - value: "PURPUR"
                description: "Purpur"
              - value: "MAGMA"
                description: "Magma"
              - value: "MOHIST"
                description: "Mohist"
              - value: "CATSERVER"
                description: "Catserver"
              - value: "CANYON"
                description: "Canyon"
              - value: "SPONGEVANILLA"
                description: "Sponge Vanilla"
              - value: "LIMBO"
                description: "Limbo"
              - value: "CRUCIBLE"
                description: "Crucible"
              - value: "FTBA"
                description: "FTBA"
              - value: "CURSEFORGE"
                description: "Curseforge"
        - variable: FORGEVERSION
          label: "Forge Version"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "FORGE"]]
        - variable: FORGE_INSTALLER
          label: "Forge Installer"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "FORGE"]]
        - variable: FORGE_INSTALLER_URL
          label: "Forge Installer URL"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "FORGE"]]
        - variable: FABRIC_LOADER_VERSION
          label: "Fabric Loader Version"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "FABRIC"]]
        - variable: FABRIC_INSTALLER
          label: "Fabric Installer"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "FABRIC"]]
        - variable: FABRIC_INSTALLER_URL
          label: "Fabric Installer URL"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "FABRIC"]]
        - variable: SPIGOT_DOWNLOAD_URL
          label: "Spigot Download URL"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "SPIGOT"]]
        - variable: BUILD_FROM_SOURCE
          label: "Build Spigot from Source?"
          schema:
            type: boolean
            default: false
            show_if: [[TYPE, "=", "SPIGOT"]]
        - variable: BUKKIT_DOWNLOAD_URL
          label: "Bukkit Download URL"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "BUKKIT"]]
        - variable: PAPERBUILD
          label: "Paper Build Number"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "PAPER"]]
        - variable: PAPER_DOWNLOAD_URL
          label: "Paper Download URL"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "PAPER"]]
        - variable: PACKWIZ_URL
          label: "Packwiz URL"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "PAPER"]]
        - variable: AIRPLANE_BUILD
          label: "Airplane Build"
          schema:
            type: string
            default: "lastSuccessfulBuild"
            show_if: [[TYPE, "=", "AIRPLANE"]]
        - variable: USE_FLARE_FLAGS
          label: "Enable to add appropriate flags for the Flare profiler"
          schema:
            type: boolean
            default: false
            show_if: [[TYPE, "=", "AIRPLANE"]]
        - variable: MAGMA_CHANNEL
          label: "Magma Channel"
          schema:
            type: string
            default: "stable"
            show_if: [[TYPE, "=", "MAGMA"]]
        - variable: MOHIST_BUILD
          label: "Mohist Build"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "MOHIST"]]
        - variable: CANYON_BUILD
          label: "Canyon Build"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "CANYON"]]
        - variable: SPONGEBRANCH
          label: "Sponge Branch"
          schema:
            type: string
            default: "STABLE"
            show_if: [[TYPE, "=", "SPONGEVANILLA"]]
        - variable: SPONGEVERSION
          label: "Sponge Version"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "SPONGEVANILLA"]]
        - variable: LIMBO_BUILD
          label: "Limbo Build"
          schema:
            type: string
            default: "LATEST"
            show_if: [[TYPE, "=", "LIMBO"]]
        - variable: LIMBO_SCHEMA_FILENAME
          label: "Limbo Schema Filename"
          schema:
            type: string
            default: "default.schem"
            show_if: [[TYPE, "=", "LIMBO"]]
        - variable: CRUCIBLE_RELEASE
          label: "Crucible Release"
          schema:
            type: string
            default: "latest"
            show_if: [[TYPE, "=", "CRUCIBLE"]]
        - variable: FTB_MODPACK_ID
          label: "FTB Modpack ID"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "FTBA"]]
        - variable: FTB_MODPACK_VERSION_ID
          label: "FTB Modpack Version ID"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "FTBA"]]
        - variable: CF_SERVER_MOD
          label: "CF Server Mod"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "CURSEFORGE"]]
        - variable: CF_BASE_DIR
          label: "CF Base Dir"
          schema:
            type: string
            default: ""
            show_if: [[TYPE, "=", "CURSEFORGE"]]
        - variable: USE_MODPACK_START_SCRIPT
          label: "Use Modpack Start Script"
          schema:
            type: boolean
            default: true
            show_if: [[TYPE, "=", "CURSEFORGE"]]
        - variable: FTB_LEGACYJAVAFIXER
          label: "Fix for \"unable to launch forgemodloader\""
          schema:
            type: boolean
            default: false
            show_if: [[TYPE, "=", "CURSEFORGE"]]
        - variable: DIFFICULTY
          label: "Difficulty"
          schema:
            type: string
            required: true
            default: "easy"
            enum:
              - value: peaceful
                description: Peaceful
              - value: easy
                description: Easy
              - value: normal
                description: Normal
              - value: hard
                description: Hard
        - variable: WHITELIST
          label: "Whitelist"
          schema:
            type: string
            default: ""
        - variable: OPS
          label: "OPs"
          schema:
            type: string
            default: ""
        - variable: ICON
          label: "URL to Server Icon"
          schema:
            type: string
            default: ""
        - variable: MAX_PLAYERS
          label: "Max Connected Players"
          schema:
            type: int
            required: true
            default: 20
        - variable: MAX_WORLD_SIZE
          label: "World Border Radius in blocks"
          schema:
            type: int
            required: true
            default: 10000
        - variable: ALLOW_NETHER
          label: "Enable/Disable Nether"
          schema:
            type: boolean
            default: true
        - variable: ANNOUNCE_PLAYER_ACHIEVEMENTS
          label: "Enable/Disable Announceing Player Achievements"
          schema:
            type: boolean
            default: true
        - variable: ENABLE_COMMAND_BLOCK
          label: "Enable/Disable Command Blocks"
          schema:
            type: boolean
            default: false
        - variable: FORCE_GAMEMODE
          label: "Enable/Disable Force Gamemode"
          schema:
            type: boolean
            default: false
        - variable: GENERATE_STRUCTURES
          label: "Enable/Disable Generate Structures"
          schema:
            type: boolean
            default: true
        - variable: HARDCORE
          label: "Enable/Disable Hardcore Mode"
          schema:
            type: boolean
            default: false
        - variable: MAX_BUILD_HEIGHT
          label: "Max World Build Height"
          schema:
            type: int
            required: true
            default: 256
        - variable: MAX_TICK_TIME
          label: "Max Tick Time"
          schema:
            type: int
            required: true
            default: 60000
        - variable: SPAWN_ANIMALS
          label: "Enable/Disable Spawning Animals"
          schema:
            type: boolean
            default: true
        - variable: SPAWN_MONSTERS
          label: "Enable/Disable Spawning Monsters"
          schema:
            type: boolean
            default: true
        - variable: SPAWN_NPCS
          label: "Enable/Disable Spawning NPCs"
          schema:
            type: boolean
            default: true
        - variable: VIEW_DISTANCE
          label: "Server View Distance"
          schema:
            type: int
            required: true
            default: 10
        - variable: SEED
          label: "Level Seed"
          schema:
            type: string
            default: ""
        - variable: MODE
          label: "Default Gamemode"
          schema:
            type: string
            required: true
            default: "survival"
            enum:
              - value: "survival"
                description: "Survival"
              - value: "creative"
                description: "Creative"
              - value: "adventure"
                description: "Adventure"
              - value: "spectator"
                description: "Spectator"
        - variable: MOTD
          label: "Server Message of the Day"
          schema:
            type: string
            default: "Welcome to Minecraft on TrueNAS Scale!"
        - variable: PVP
          label: "Enable/Disable PVP"
          schema:
            type: boolean
            default: false
        - variable: LEVEL_TYPE
          label: "Level Type"
          schema:
            type: string
            required: true
            default: "DEFAULT"
        - variable: GENERATOR_SETTINGS
          label: "Generator Settings"
          schema:
            type: string
            default: ""
        - variable: LEVEL
          label: "World Save Name"
          schema:
            type: string
            required: true
            default: "world"
        - variable: WORLD
          label: "URL of world download"
          schema:
            type: string
            default: ""
        - variable: FORCE_REDOWNLOAD
          label: "Force redownload server files"
          schema:
            type: string
            default: ""
        - variable: ONLINE_MODE
          label: "Enable/Disable Online Mode"
          schema:
            type: boolean
            default: true
        - variable: advanced
          label: "Show Advanced Server Settings"
          schema:
            type: boolean
            default: false
            show_subquestions_if: true
            subquestions:
              - variable: MEMORY
                label: "Server Memory"
                schema:
                  type: string
                  required: true
                  default: "2048M"
              - variable: JVM_OPTS
                label: "JVM Options"
                schema:
                  type: string
                  default: ""
              - variable: JVM_XX_OPTS
                label: "JVM -X Options"
                schema:
                  type: string
                  default: ""

# Include{containerConfig}

  - variable: service
    group: "Networking and Services"
    label: "Configure Service(s)"
    schema:
      additional_attrs: true
      type: dict
      attrs:
        - variable: main
          label: "Main Service"
          description: "The Primary service on which the healthcheck runs, often the webUI"
          schema:
            additional_attrs: true
            type: dict
            attrs:
# Include{serviceSelector}
                    - variable: main
                      label: "Main Service Port Configuration"
                      schema:
                        additional_attrs: true
                        type: dict
                        attrs:
                          - variable: port
                            label: "Port"
                            description: "This port exposes the container port on the service"
                            schema:
                              type: int
                              default: 25565
                              required: true
                          - variable: advanced
                            label: "Show Advanced settings"
                            schema:
                              type: boolean
                              default: false
                              show_subquestions_if: true
                              subquestions:
                                - variable: enabled
                                  label: "Enable the port"
                                  schema:
                                    type: boolean
                                    default: true
                                - variable: protocol
                                  label: "Port Type"
                                  schema:
                                    type: string
                                    default: "TCP"
                                    enum:
                                      - value: HTTP
                                        description: "HTTP"
                                      - value: "HTTPS"
                                        description: "HTTPS"
                                      - value: TCP
                                        description: "TCP"
                                      - value: "UDP"
                                        description: "UDP"
                                - variable: nodePort
                                  label: "Node Port (Optional)"
                                  description: "This port gets exposed to the node. Only considered when service type is NodePort, Simple or LoadBalancer"
                                  schema:
                                    type: int
                                    min: 9000
                                    max: 65535
                                - variable: targetPort
                                  label: "Target Port"
                                  description: "The internal(!) port on the container the Application runs on"
                                  schema:
                                    type: int
                                    default: 25565
        - variable: rcon
          label: "RCON Service"
          description: "The Primary service on which the healthcheck runs, often the webUI"
          schema:
            additional_attrs: true
            type: dict
            attrs:
# Include{serviceSelector}
                    - variable: rcon
                      label: "RCON Service Port Configuration"
                      schema:
                        additional_attrs: true
                        type: dict
                        attrs:
                          - variable: port
                            label: "Port"
                            description: "This port exposes the container port on the service"
                            schema:
                              type: int
                              default: 25575
                              required: true
                          - variable: advanced
                            label: "Show Advanced settings"
                            schema:
                              type: boolean
                              default: false
                              show_subquestions_if: true
                              subquestions:
                                - variable: enabled
                                  label: "Enable the port"
                                  schema:
                                    type: boolean
                                    default: true
                                - variable: protocol
                                  label: "Port Type"
                                  schema:
                                    type: string
                                    default: "TCP"
                                    enum:
                                      - value: HTTP
                                        description: "HTTP"
                                      - value: "HTTPS"
                                        description: "HTTPS"
                                      - value: TCP
                                        description: "TCP"
                                      - value: "UDP"
                                        description: "UDP"
                                - variable: nodePort
                                  label: "Node Port (Optional)"
                                  description: "This port gets exposed to the node. Only considered when service type is NodePort, Simple or LoadBalancer"
                                  schema:
                                    type: int
                                    min: 9000
                                    max: 65535
                                - variable: targetPort
                                  label: "Target Port"
                                  description: "The internal(!) port on the container the Application runs on"
                                  schema:
                                    type: int
                                    default: 25575

  - variable: serviceexpert
    group: "Networking and Services"
    label: "Show Expert Config"
    schema:
      type: boolean
      default: false
      show_subquestions_if: true
      subquestions:
        - variable: hostNetwork
          group: "Networking and Services"
          label: "Host-Networking (Complicated)"
          schema:
            type: boolean
            default: false

# Include{serviceExpert}

# Include{serviceList}

  - variable: persistence
    label: "Integrated Persistent Storage"
    description: "Integrated Persistent Storage"
    group: "Storage and Persistence"
    schema:
      additional_attrs: true
      type: dict
      attrs:
        - variable: data
          label: "App Data Storage"
          description: "Stores the Application Configuration."
          schema:
            additional_attrs: true
            type: dict
            attrs:
# Include{persistenceBasic}
# Include{persistenceAdvanced}
# Include{persistenceList}

# Include{ingressList}

# Include{security}

  - variable: advancedSecurity
    label: "Show Advanced Security Settings"
    group: "Security and Permissions"
    schema:
      type: boolean
      default: false
      show_subquestions_if: true
      subquestions:
        - variable: securityContext
          label: "Security Context"
          schema:
            additional_attrs: true
            type: dict
            attrs:
              - variable: privileged
                label: "Privileged mode"
                schema:
                  type: boolean
                  default: false
              - variable: readOnlyRootFilesystem
                label: "ReadOnly Root Filesystem"
                schema:
                  type: boolean
                  default: false
              - variable: allowPrivilegeEscalation
                label: "Allow Privilege Escalation"
                schema:
                  type: boolean
                  default: false
              - variable: runAsNonRoot
                label: "runAsNonRoot"
                schema:
                  type: boolean
                  default: false
# Include{securityContextAdvanced}

  - variable: podSecurityContext
    group: "Security and Permissions"
    label: "Pod Security Context"
    schema:
      additional_attrs: true
      type: dict
      attrs:
        - variable: runAsUser
          label: "runAsUser"
          description: "The UserID of the user running the application"
          schema:
            type: int
            default: 0
        - variable: runAsGroup
          label: "runAsGroup"
          description: "The groupID this App of the user running the application"
          schema:
            type: int
            default: 0
        - variable: fsGroup
          label: "fsGroup"
          description: "The group that should own ALL storage."
          schema:
            type: int
            default: 568
# Include{podSecurityContextAdvanced}

# Include{resources}

# Include{advanced}

# Include{addons}
