# Copyright 2020 Google Inc. All rights reserved.
#
# 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:
  labels:
    service: connect
  name: connect
spec:
  replicas: 1
  selector:
    matchLabels:
      service: connect
  template:
    metadata:
      labels:
        service: connect
    spec:
      containers:
      - env:
        - name: BOOTSTRAP_SERVERS
          value: kafka-0.kafka.default.svc.cluster.local:9092
        - name: CONFIG_STORAGE_TOPIC
          value: my_connect_configs
        - name: CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL
          value: http://schema-registry-0.schema-registry.default.svc.cluster.local:8081
        - name: CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL
          value: http://schema-registry-0.schema-registry.default.svc.cluster.local:8081
        - name: GROUP_ID
          value: "1"
        - name: INTERNAL_KEY_CONVERTER
          value: org.apache.kafka.connect.json.JsonConverter
        - name: INTERNAL_VALUE_CONVERTER
          value: org.apache.kafka.connect.json.JsonConverter
        - name: KEY_CONVERTER
          value: io.confluent.connect.avro.AvroConverter
        - name: OFFSET_STORAGE_TOPIC
          value: my_connect_offsets
        - name: STATUS_STORAGE_TOPIC
          value: my_connect_statuses
        - name: VALUE_CONVERTER
          value: io.confluent.connect.avro.AvroConverter
        image: gcr.io/cloud-solutions-images/connect
        name: connect
        imagePullPolicy: Always
        ports:
        - containerPort: 8083
        volumeMounts:
        - mountPath: /secrets
          name: service-account-creds
          readOnly: true
        - mountPath: /config/source.json
          subPath: source.json
          name: connector-source
          readOnly: true
        - mountPath: /config/sink.json
          subPath: sink.json
          name: connector-sink
          readOnly: true
      volumes:
      - name: service-account-creds
        secret:
          secretName: service-account-creds
      - name: connector-source
        configMap:
          name: connector-source
      - name: connector-sink
        configMap:
          name: connector-sink

