---
apiVersion: v1
data:
  properties.yaml: |
    version: 0.1.0
    spec:
      units:
        - unit: &unitPort
            name: "port"
            regex: "^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$"

        - unit: &unitUrl
            name: "url"
            regex: "^((https?|ftp|file)://)?[-a-zA-Z0-9+&@#}/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"
            examples:
              - "https://www.stackable.de/blog/"

        - unit: &unitCapacity
            name: "capacity"
            regex: "^[1-9]\\d*$"

        - unit: &unitMilliseconds
            name: "milliseconds"
            regex: "^[1-9]\\d*$"

    properties:
      - property: &zookeeperConnect
          propertyNames:
            - name: "zookeeper.connect"
              kind:
                type: "file"
                file: "server.properties"
          datatype:
            type: "string"
            unit: *unitUrl
          defaultValues:
            - fromVersion: "0.0.0"
              value: "localhost:2181"
          roles:
            - name: "broker"
              required: true
          asOfVersion: "0.0.0"
          description: "The zookeeper connection string"

      - property: &zookeeperTimeout
          propertyNames:
            - name: "zookeeper.connection.timeout.ms"
              kind:
                type: "file"
                file: "server.properties"
          datatype:
            type: "integer"
            unit: *unitMilliseconds
          defaultValues:
            - fromVersion: "0.0.0"
              value: "18000"
          roles:
            - name: "broker"
              required: true
          asOfVersion: "0.0.0"
          description: "Zookeeper connection timeout in milliseconds."

      - property: &opaAuthorizerClassName
          propertyNames:
            - name: "authorizer.class.name"
              kind:
                type: "file"
                file: "server.properties"
          datatype:
            type: "string"
          defaultValues:
            - fromVersion: "0.0.0"
              value: "com.bisnode.kafka.authorization.OpaAuthorizer"
            - fromVersion: "3.0.0"
              value: "org.openpolicyagent.kafka.OpaAuthorizer"
          roles:
            - name: "broker"
              required: false
          asOfVersion: "0.0.0"
          description: "OPA Authorizer class name"

      - property: &opaAuthorizerUrl
          propertyNames:
            - name: "opa.authorizer.url"
              kind:
                type: "file"
                file: "server.properties"
          datatype:
            type: "string"
            unit: *unitUrl
          roles:
            - name: "broker"
              required: false
          asOfVersion: "0.0.0"
          description: "OPA Authorizer URL"

      - property: &opaAuthorizerInitialCacheCapacity
          propertyNames:
            - name: "opa.authorizer.cache.initial.capacity"
              kind:
                type: "file"
                file: "server.properties"
          datatype:
            type: "integer"
            unit: *unitCapacity
          defaultValues:
            - fromVersion: "0.0.0"
              value: "0"
          roles:
            - name: "broker"
              required: false
          asOfVersion: "0.0.0"
          description: "OPA Authorizer initial cache capacity"

      - property: &opaAuthorizerMaxCacheSize
          propertyNames:
            - name: "opa.authorizer.cache.maximum.size"
              kind:
                type: "file"
                file: "server.properties"
          datatype:
            type: "integer"
            unit: *unitCapacity
          defaultValues:
            - fromVersion: "0.0.0"
              value: "0"
          roles:
            - name: "broker"
              required: false
          asOfVersion: "0.0.0"
          description: "OPA authorizer max cache size"

      - property: &opaAuthorizerCacheExpireAfterSeconds
          propertyNames:
            - name: "opa.authorizer.cache.expire.after.seconds"
              kind:
                type: "file"
                file: "server.properties"
          datatype:
            type: "integer"
            unit: *unitCapacity
          defaultValues:
            - fromVersion: "0.0.0"
              value: "0"
          roles:
            - name: "broker"
              required: false
          asOfVersion: "0.0.0"
          description: "The number of seconds after which the OPA authorizer cache expires"

      - property: &logDirs
          propertyNames:
            - name: "log.dirs"
              kind:
                type: "file"
                file: "server.properties"
          datatype:
            type: "string"
          recommendedValues:
            - value: "/stackable/data/topicdata"
          roles:
            - name: "broker"
              required: true
          asOfVersion: "0.0.0"
          description: "A comma separated list of directories under which to store log files"
kind: ConfigMap
metadata:
  name: kafka-operator-configmap
  labels:
    app.kubernetes.io/name: kafka-operator
    app.kubernetes.io/instance: kafka-operator
    app.kubernetes.io/version: "0.6.0-nightly"
