# 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

  - variable: operator
    group: "App Configuration"
    label: "Operator Settings"
    schema:
      additional_attrs: true
      type: dict
      attrs:
        - variable: enabled
          label: "Enable"
          schema:
            type: boolean
            default: true
            show_subquestions_if: true
            subquestions:
              - variable: logLevel
                label: "Log Level"
                description: "Log level for Operator"
                schema:
                  type: string
                  default: "info"


  - variable: prometheus
    group: "App Configuration"
    label: "Prometheus Settings"
    schema:
      additional_attrs: true
      type: dict
      attrs:
        - variable: enabled
          label: "Enable"
          schema:
            type: boolean
            default: true
            show_subquestions_if: true
            subquestions:
              - variable: logLevel
                label: "Log Level"
                description: "Log level for Prometheus"
                schema:
                  type: string
                  default: "info"
              - variable: retention
                label: "Retention"
                description: "Metrics retention days"
                schema:
                  type: string
                  default: "31d"
              - variable: retentionSize
                label: "Max Retention Size"
                description: "Maximum size of metrics"
                schema:
                  type: string
                  default: ""
              - variable: disableCompaction
                label: "Disable Compaction"
                description: "Disable the compaction of the Prometheus TSDB"
                schema:
                  type: boolean
                  default: false
              - variable: walCompression
                label: "WAL Compression"
                description: "Enable compression of the write-ahead log using Snappy"
                schema:
                  type: boolean
                  default: false


  - variable: alertmanager
    group: "App Configuration"
    label: "Alertmanager Settings"
    schema:
      additional_attrs: true
      type: dict
      attrs:
        - variable: enabled
          label: "Enable"
          schema:
            type: boolean
            default: true
            show_subquestions_if: true
            subquestions:
              - variable: logLevel
                label: "Log Level"
                description: "Log level for Alertmanager"
                schema:
                  type: string
                  default: "info"
              - variable: retention
                label: "Retention"
                description: "Metrics retention days"
                schema:
                  type: string
                  default: "240h"


  - variable: service
    group: "Networking and Services"
    label: "Configure Service(s)"
    schema:
      additional_attrs: true
      type: dict
      attrs:
        - variable: main
          label: "Main Service"
          description: "The serving the Prometheus 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: 10086
                              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: "HTTP"
                                    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: 9090

        - variable: alertmanager
          label: "alertmanager Service"
          description: "alertmanager service "
          schema:
            additional_attrs: true
            type: dict
            attrs:
# Include{serviceSelector}
                    - variable: alertmanager
                      label: "alertmanager 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: 10087
                              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: "HTTP"
                                    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: 9093

  - 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}

# Include{persistenceList}

  - variable: ingress
    label: ""
    group: "Ingress"
    schema:
      additional_attrs: true
      type: dict
      attrs:
        - variable: main
          label: "Main Ingress"
          schema:
            additional_attrs: true
            type: dict
            attrs:
# Include{ingressDefault}

# Include{ingressTLS}

# Include{ingressTraefik}

# Include{ingressExpert}

# Include{ingressList}

# Include{advanced}
