---
apiVersion: v1
kind: List
items:
- apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: cloudmoa-trace-agent
    #namespace: {{ .Values.global.AGENT_NAMESPACE }}
    labels:
      app: cloudmoa-trace-agent
  spec:
    selector:
      matchLabels:
        app: cloudmoa-trace-agent
    replicas: 1
    strategy:
      type: Recreate
    template:
      metadata:
        labels:
          app: cloudmoa-trace-agent
      spec:
        securityContext:
          runAsNonRoot: true
          runAsUser: 65534
        containers:
          - image: {{ .Values.global.IMXC_IN_REGISTRY }}/trace-agent:{{ .Values.global.TRACE_AGENT_VERSION }}
            name: cloudmoa-trace-agent
            resources:
              requests:
                cpu: 100m
                memory: 50Mi
              limits:
                cpu: 200m
                memory: 100Mi
            ports:
              - containerPort: 5775
                protocol: UDP
              - containerPort: 6831
                protocol: UDP
              - containerPort: 6832
                protocol: UDP
              - containerPort: 5778
                protocol: TCP
            env:
              - name: LOG_LEVEL
                value: "INFO"
              - name: CLUSTER_ID
                value: {{ .Values.global.CLUSTER_ID }}
              - name: DATAGATE
                value: {{ .Values.global.DATAGATE }}
- apiVersion: v1
  kind: Service
  metadata:
    name: cloudmoa-trace-agent
    #namespace: {{ .Values.global.AGENT_NAMESPACE }}
    labels:
      app: cloudmoa-trace-agent
  spec:
    ports:
      - name: agent-zipkin-thrift
        port: 5775
        protocol: UDP
        targetPort: 5775
      - name: agent-compact
        port: 6831
        protocol: UDP
        targetPort: 6831
      - name: agent-binary
        port: 6832
        protocol: UDP
        targetPort: 6832
      - name: agent-configs
        port: 5778
        protocol: TCP
        targetPort: 5778
    selector:
      app: cloudmoa-trace-agent
    type: ClusterIP

