---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ambassador-operator
  namespace: {{ ingress_ambassador_namespace }}
  labels:
    app.kubernetes.io/name: ambassador-operator
    app.kubernetes.io/part-of: ambassador-operator
    getambassador.io/installer: operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: ambassador-operator
      app.kubernetes.io/name: ambassador-operator
      app.kubernetes.io/part-of: ambassador-operator
  template:
    metadata:
      labels:
        name: ambassador-operator
        getambassador.io/installer: operator
        app.kubernetes.io/name: ambassador-operator
        app.kubernetes.io/part-of: ambassador-operator
    spec:
      serviceAccountName: ambassador-operator
      containers:
        - name: ambassador-operator
          image: {{ ingress_ambassador_image_repo }}:{{ ingress_ambassador_image_tag }}
          command:
          - ambassador-operator
          imagePullPolicy: {{ k8s_image_pull_policy }}
          env:
            - name: WATCH_NAMESPACE
{% if ingress_ambassador_multi_namespaces %}
              value: ''
{% else %}
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
{% endif %}
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: OPERATOR_NAME
              value: "ambassador-operator"
