# Copyright 2020 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: v1
kind: ConfigMap
metadata:
  name: config-kafka-sink-data-plane
  namespace: knative-eventing
  labels:
    kafka.eventing.knative.dev/release: devel
  annotations:
    knative.dev/example-checksum: "a8ce4acb"
data:
  _example: |
    ################################
    #                              #
    #    EXAMPLE CONFIGURATION     #
    #                              #
    ################################

    # This block is not actually functional configuration,
    # but serves to illustrate the available configuration
    # options and document them in a way that is accessible
    # to users that `kubectl edit` this config map.
    #
    # These sample configuration options may be copied out of
    # this example block and unindented to be in the data block
    # to actually change the configuration.

    # All configurations in this ConfigMap are globally applied to each
    # resource and there is no way to change them on a per-resource basis,
    # unless otherwise specified.

    # Producer configuration are documented in https://kafka.apache.org/documentation/#producerconfigs
    # Some configurations might be forced by the actual code to make sure we respect the Knative Eventing
    # delivery constraints, for example, `key.serializer` and `value.serializer`.
    config-kafka-sink-producer.properties: |
      key.serializer=org.apache.kafka.common.serialization.StringSerializer
      value.serializer=io.cloudevents.kafka.CloudEventSerializer
      acks=all

    # Available Vertx HTTPServerOptions are documented in
    # https://vertx.io/docs/apidocs/io/vertx/core/http/HttpServerOptions.html.
    #
    # Each receiver pod creates a single HTTP server.
    #
    # The mapping is the following:
    #  for each method starting with `set` there is a property that can be set with the name that follows the `set`
    #  prefix starting with a lowercase letter.
    # For example, there is a method called `setIdleTimeout` and the associated property is `idleTimeout`.
    config-kafka-sink-httpserver.properties: |
      idleTimeout=0
  config-kafka-sink-producer.properties: |
    key.serializer=org.apache.kafka.common.serialization.StringSerializer
    value.serializer=io.cloudevents.kafka.CloudEventSerializer
    acks=all
    buffer.memory=33554432
    # compression.type=snappy
    retries=2147483647
    batch.size=16384
    client.dns.lookup=use_all_dns_ips
    connections.max.idle.ms=600000
    delivery.timeout.ms=120000
    linger.ms=0
    max.block.ms=60000
    max.request.size=1048576
    partitioner.class=org.apache.kafka.clients.producer.internals.DefaultPartitioner
    receive.buffer.bytes=-1
    request.timeout.ms=2000
    enable.idempotence=false
    max.in.flight.requests.per.connection=5
    metadata.max.age.ms=300000
    # metric.reporters=""
    metrics.num.samples=2
    metrics.recording.level=INFO
    metrics.sample.window.ms=30000
    reconnect.backoff.max.ms=1000
    reconnect.backoff.ms=50
    retry.backoff.ms=100
    # transaction.timeout.ms=60000
    # transactional.id=null
  config-kafka-sink-httpserver.properties: |
    idleTimeout=0
