#
# This file only contains the deployment configuration for mixer
# with liveness / readiness. This file is supposed to be used after
# installing istio normally (like istio.yaml) to update mixer setup.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: istio-mixer
  namespace: {ISTIO_NAMESPACE}
spec:
  replicas: 1
  template:
    metadata:
      labels:
        istio: mixer
      annotations:
        sidecar.istio.io/inject: "false"
    spec:
      serviceAccountName: istio-mixer-service-account
      containers:
      - name: statsd-to-prometheus
        image: prom/statsd-exporter:v0.5.0
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 9102
        - containerPort: 9125
          protocol: UDP
        args:
        - '-statsd.mapping-config=/etc/statsd/mapping.conf'
        volumeMounts:
        - name: config-volume
          mountPath: /etc/statsd
      - name: mixer
        image: {MIXER_HUB}/mixer:{MIXER_TAG}
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 9091
        - containerPort: 9093
        - containerPort: 9094
        - containerPort: 42422
        args:
          - --configStoreURL=k8s://
          - --configDefaultNamespace={ISTIO_NAMESPACE}
          - --trace_zipkin_url=http://zipkin:9411/api/v1/spans
          - --livenessProbePath=/live
          - --livenessProbeInterval=5s
          - --readinessProbePath=/ready
          - --readinessProbeInterval=5s
        livenessProbe:
          exec:
            command:
            - /usr/local/bin/mixs
            - probe
            - --probe-path=/live
            - --interval=5s
          initialDelaySeconds: 60
          periodSeconds: 5
        readinessProbe:
          exec:
            command:
            - /usr/local/bin/mixs
            - probe
            - --probe-path=/ready
            - --interval=5s
          initialDelaySeconds: 5
          periodSeconds: 5
      - name: istio-proxy
        image: {PROXY_HUB}/{PROXY_IMAGE}:{PROXY_TAG}
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 15004
        args:
        - proxy
        - mixer
        - -v
        - "2"
        - --controlPlaneAuthPolicy
        - NONE #--controlPlaneAuthPolicy
        - --customConfigFile
        - /etc/istio/proxy/envoy_mixer.json
        volumeMounts:
        - name: istio-certs
          mountPath: /etc/certs
          readOnly: true
      volumes:
      - name: istio-certs
        secret:
          secretName: istio.istio-mixer-service-account
          optional: true
      - name: config-volume
        configMap:
          name: istio-mixer
