apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: istio-tracing
  namespace: {{ .Release.Namespace }}
  labels:
    app: istio-tracing
    {{- template "common_labels" . }}
spec:
  replicas: {{ .Values.replicaCount }}
  template:
    metadata:
      labels:
        app: jaeger
      annotations:
        sidecar.istio.io/inject: "false"
        scheduler.alpha.kubernetes.io/critical-pod: ""
    spec:
{{- if .Values.global.priorityClassName }}
      priorityClassName: "{{ .Values.global.priorityClassName }}"
{{- end }}
{{- if .Values.global.imagePullSecrets }}
      imagePullSecrets:
{{- range .Values.global.imagePullSecrets }}
        - name: {{ . }}
{{- end }}
{{- end }}
      containers:
        - name: jaeger
          image: "{{ .Values.jaeger.hub }}/all-in-one:{{ .Values.jaeger.tag }}"
          imagePullPolicy: {{ .Values.global.imagePullPolicy }}
          ports:
            - containerPort: {{ .Values.service.internalPort }}
            - containerPort: {{ .Values.jaeger.ui.port }}
            - containerPort: 5775
              protocol: UDP
            - containerPort: 6831
              protocol: UDP
            - containerPort: 6832
              protocol: UDP
          env:
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                apiVersion: v1
                fieldPath: metadata.namespace
          - name: COLLECTOR_ZIPKIN_HTTP_PORT
            value: "{{ .Values.service.internalPort }}"
          - name: MEMORY_MAX_TRACES
            value: "{{ .Values.jaeger.memory.max_traces }}"
          livenessProbe:
            httpGet:
              path: /
              port: {{ .Values.jaeger.ui.port }}
          readinessProbe:
            httpGet:
              path: /
              port: {{ .Values.jaeger.ui.port }}
          resources:
{{- if .Values.resources }}
{{ toYaml .Values.resources | indent 12 }}
{{- else }}
{{ toYaml .Values.global.defaultResources | indent 12 }}
{{- end }}
      affinity:
      {{- include "nodeaffinity" . | indent 6 }}
