apiVersion: apps/v1
kind: Deployment
metadata:
  name: webhook-consumer
  namespace: default
  labels:
    app: webhook-consumer
    type: webhook
spec:
  replicas: 0
  selector:
    matchLabels:
      app: webhook-consumer
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: webhook-consumer
    spec:
      containers:
      - name: app
        image: "{{ .Values.global.containerRegistry}}/{{ .Values.image }}:{{ .Values.global.appImageTag }}"
        imagePullPolicy: Always
        env:
        - name: KAFKA_BROKERS
          valueFrom:
            configMapKeyRef:
              name: kafka-config
              key: KAFKA_BROKERS
        - name: KAFKA_SCHEMA_REGISTRY_URL
          valueFrom:
            configMapKeyRef:
              name: kafka-config
              key: KAFKA_SCHEMA_REGISTRY_URL
        - name: SERVICE_NAME
          value: webhook-consumer
        - name: REDIS_HOSTNAME
          valueFrom:
            configMapKeyRef:
              name: redis-config
              key: REDIS_HOSTNAME
        - name: REDIS_PORT
          valueFrom:
            configMapKeyRef:
              name: redis-config
              key: REDIS_PORT
        livenessProbe:
            httpGet:
              path: /health
              port: 8080
              httpHeaders:
                - name: Health-Check
                  value: health-check
            initialDelaySeconds: 60
            periodSeconds: 10
            failureThreshold: 3
