# 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: apps/v1
kind: Deployment
metadata:
  name: eventing-kafka-channel-controller
  namespace: knative-eventing
  labels:
    app: eventing-kafka-channel-controller
    kafka.eventing.knative.dev/release: devel
spec:
  replicas: 1
  selector:
    matchLabels:
      app: eventing-kafka-channel-controller
      name: eventing-kafka-channel-controller
  template:
    metadata:
      labels:
        app: eventing-kafka-channel-controller
        name: eventing-kafka-channel-controller
    spec:
      serviceAccountName: eventing-kafka-channel-controller
      containers:
      - name: eventing-kafka
        image: ko://knative.dev/eventing-kafka/cmd/channel/distributed/controller
        imagePullPolicy: IfNotPresent # Must be IfNotPresent or Never if used with ko.local
        ports:
        - containerPort: 8081
          name: metrics
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: SYSTEM_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: CONFIG_LOGGING_NAME
          value: config-logging
        - name: CONFIG_LEADERELECTION_NAME
          value: config-leader-election
        - name: SERVICE_ACCOUNT
          valueFrom:
            fieldRef:
              fieldPath: spec.serviceAccountName
        - name: METRICS_PORT
          value: "8081"
        - name: METRICS_DOMAIN
          value: "eventing-kafka"
        - name: RECEIVER_IMAGE
          value: "ko://knative.dev/eventing-kafka/cmd/channel/distributed/receiver"
        - name: DISPATCHER_IMAGE
          value: "ko://knative.dev/eventing-kafka/cmd/channel/distributed/dispatcher"
        resources:
          requests:
            cpu: 20m
            memory: 25Mi
          limits:
            cpu: 100m
            memory: 50Mi
