apiVersion: service.aep.asag.io/v1
kind: Definition
metadata:
  name: postgresql-0.0.0-c555a171
  namespace: asag
spec:
  clusters:
    - flags:
        - from: value
          key: v1_role
          to: label
          value: postgresql
      name: postgresql
      nodes:
        flags:
          - from: setting
            key: v1_is_master
            setting: is_master
            to: label
          - from: setting
            key: v1_disable_backup
            setting: disable_backup
            to: label
        settings:
          - from:
              - user
            name: is_master
            schema:
              default: false
              description: Set this node as master
              type: boolean
          - from:
              - user
            name: disable_backup
            schema:
              default: true
              description: Disable backup on this node. Set this to false for at least one node (preferrably slave).
              type: boolean
      podspec:
        containers:
          - name: postgresql
      provides:
        - exposed: true
          filter:
            - key: v1_is_master
              value: true
          name: rw
          network: loadbalanced
          servicespec:
            ports:
              - name: postgresql
                port: 5432
                protocol: TCP
        - exposed: true
          filter:
            - key: v1_is_master
              value: false
          name: ro
          network: loadbalanced
          servicespec:
            ports:
              - name: postgresql
                port: 5432
                protocol: TCP
      sizing:
        increment: 1
        initial: 3
        maximum: 10
        minimum: 1
        setup:
          additional:
            settings:
              - key: is_master
                value: false
              - key: disable_backup
                value: true
          initial:
            - settings:
                - key: is_master
                  value: true
                - key: disable_backup
                  value: true
            - settings:
                - key: is_master
                  value: false
                - key: disable_backup
                  value: false
  dependencies:
    operator:
      name: postgresql-operator
      vendor: asag
      version: 1.1.1
  includes:
    - name: defaults-service
      vendor: asag
      version: 0.8.0
  name: postgresql
  settings:
    - name: environment
      schema:
        default: postgresql_prod
    - from:
        - user
      name: product_version
      schema:
        default: "16"
        description: Major version of service
        enum:
          - "14"
          - "15"
          - "16"
          - "17"
        metadata:
          versions:
            - display_name: PostgreSQL 16 (Recommended)
              version: "16"
        type: string
  version: 0.0.0-c555a171
