---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jaeger
  namespace: monitoring
  labels:
    app: jaeger
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jaeger
  template:
    metadata:
      labels:
        app: jaeger
    spec:
      containers:
      - name: jaeger
        image: jaegertracing/all-in-one:1.51
        env:
        - name: COLLECTOR_ZIPKIN_HOST_PORT
          value: ":9411"
        - name: COLLECTOR_OTLP_ENABLED
          value: "true"
        - name: SPAN_STORAGE_TYPE
          value: "badger"
        - name: BADGER_EPHEMERAL
          value: "false"
        - name: BADGER_DIRECTORY_VALUE
          value: "/badger/data"
        - name: BADGER_DIRECTORY_KEY
          value: "/badger/key"
        ports:
        - containerPort: 5775
          protocol: UDP
          name: zipkin-compact
        - containerPort: 6831
          protocol: UDP
          name: jaeger-compact
        - containerPort: 6832
          protocol: UDP
          name: jaeger-binary
        - containerPort: 5778
          protocol: TCP
          name: config-rest
        - containerPort: 16686
          protocol: TCP
          name: query
        - containerPort: 14250
          protocol: TCP
          name: grpc
        - containerPort: 14268
          protocol: TCP
          name: c-tchan-trft
        - containerPort: 14269
          protocol: TCP
          name: admin-http
        - containerPort: 9411
          protocol: TCP
          name: zipkin
        - containerPort: 4317
          protocol: TCP
          name: otlp-grpc
        - containerPort: 4318
          protocol: TCP
          name: otlp-http
        volumeMounts:
        - name: jaeger-storage
          mountPath: /badger
        resources:
          requests:
            memory: "512Mi"
            cpu: "250m"
          limits:
            memory: "1Gi"
            cpu: "500m"
        livenessProbe:
          httpGet:
            path: /
            port: 14269
          initialDelaySeconds: 30
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /
            port: 14269
          initialDelaySeconds: 5
          periodSeconds: 5
      volumes:
      - name: jaeger-storage
        persistentVolumeClaim:
          claimName: jaeger-storage

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jaeger-storage
  namespace: monitoring
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi

---
apiVersion: v1
kind: Service
metadata:
  name: jaeger-query
  namespace: monitoring
  labels:
    app: jaeger
spec:
  type: ClusterIP
  ports:
  - port: 16686
    targetPort: 16686
    protocol: TCP
    name: query
  selector:
    app: jaeger

---
apiVersion: v1
kind: Service
metadata:
  name: jaeger-collector
  namespace: monitoring
  labels:
    app: jaeger
spec:
  type: ClusterIP
  ports:
  - port: 14268
    targetPort: 14268
    protocol: TCP
    name: c-tchan-trft
  - port: 14250
    targetPort: 14250
    protocol: TCP
    name: grpc
  - port: 9411
    targetPort: 9411
    protocol: TCP
    name: zipkin
  - port: 4317
    targetPort: 4317
    protocol: TCP
    name: otlp-grpc
  - port: 4318
    targetPort: 4318
    protocol: TCP
    name: otlp-http
  selector:
    app: jaeger

---
apiVersion: v1
kind: Service
metadata:
  name: jaeger-agent
  namespace: monitoring
  labels:
    app: jaeger
spec:
  type: ClusterIP
  clusterIP: None
  ports:
  - port: 5775
    targetPort: 5775
    protocol: UDP
    name: zipkin-compact
  - port: 6831
    targetPort: 6831
    protocol: UDP
    name: jaeger-compact
  - port: 6832
    targetPort: 6832
    protocol: UDP
    name: jaeger-binary
  - port: 5778
    targetPort: 5778
    protocol: TCP
    name: config-rest
  selector:
    app: jaeger
