apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/component: knative-eventing
    app.kubernetes.io/name: knative-eventing
    eventing.knative.dev/release: v0.22.1
    knative.dev/high-availability: "true"
    kustomize.component: knative
  name: imc-dispatcher
  namespace: knative-eventing
spec:
  selector:
    matchLabels:
      app.kubernetes.io/component: knative-eventing
      app.kubernetes.io/name: knative-eventing
      kustomize.component: knative
      messaging.knative.dev/channel: in-memory-channel
      messaging.knative.dev/role: dispatcher
  template:
    metadata:
      labels:
        app.kubernetes.io/component: knative-eventing
        app.kubernetes.io/name: knative-eventing
        kustomize.component: knative
        messaging.knative.dev/channel: in-memory-channel
        messaging.knative.dev/role: dispatcher
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchLabels:
                  app.kubernetes.io/component: knative-eventing
                  app.kubernetes.io/name: knative-eventing
                  kustomize.component: knative
                  messaging.knative.dev/channel: in-memory-channel
                  messaging.knative.dev/role: dispatcher
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - env:
        - name: CONFIG_LOGGING_NAME
          value: config-logging
        - name: CONFIG_OBSERVABILITY_NAME
          value: config-observability
        - name: METRICS_DOMAIN
          value: knative.dev/inmemorychannel-dispatcher
        - name: SYSTEM_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: CONTAINER_NAME
          value: dispatcher
        - name: MAX_IDLE_CONNS
          value: "1000"
        - name: MAX_IDLE_CONNS_PER_HOST
          value: "1000"
        image: gcr.io/knative-releases/knative.dev/eventing/cmd/in_memory/channel_dispatcher@sha256:a6983f71c04619928199cc21e07ee6f1e1c87586621bc03b10c9ba1abd92bfa8
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 5
          periodSeconds: 2
          successThreshold: 1
          timeoutSeconds: 1
        name: dispatcher
        ports:
        - containerPort: 8080
          name: http
          protocol: TCP
        - containerPort: 9090
          name: metrics
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          periodSeconds: 2
          successThreshold: 1
          timeoutSeconds: 1
      enableServiceLinks: false
      serviceAccountName: imc-dispatcher
