---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: orders
  labels:
    name: orders
    tags.datadoghq.com/env: "production"
    tags.datadoghq.com/service: "orders"
    tags.datadoghq.com/version: "v1"
  namespace: sock-shop
spec:
  replicas: 1
  selector:
    matchLabels:
      name: orders
  template:
    metadata:
      labels:
        name: orders
        tags.datadoghq.com/env: "production"
        tags.datadoghq.com/service: "orders"
        tags.datadoghq.com/version: "v1"
    spec:
      containers:
      - name: orders
        image: orders
        env:
          - name: DD_AGENT_HOST
            valueFrom:
              fieldRef:
                fieldPath: status.hostIP
          - name: DD_ENV
            valueFrom:
              fieldRef:
                fieldPath: metadata.labels['tags.datadoghq.com/env']
          - name: DD_SERVICE
            valueFrom:
              fieldRef:
                fieldPath: metadata.labels['tags.datadoghq.com/service']
          - name: DD_VERSION
            valueFrom:
              fieldRef:
                fieldPath: metadata.labels['tags.datadoghq.com/version']
          - name: DD_PROFILING_ENABLED
            value: "true"
          - name: DD_LOGS_INJECTION
            value: "true"
          - name: DD_TRACE_SAMPLE_RATE
            value: "1"
          - name: ZIPKIN
            value: zipkin.jaeger.svc.cluster.local
          - name: JAVA_OPTS
            value: -javaagent:./dd-java-agent.jar -Ddd.profiling.enabled=true -XX:FlightRecorderOptions=stackdepth=256 -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom
          - name: DOTNET_NOLOGO
            value: "1"
          - name: DOTNET_CLI_HOME
            value: "/tmp/DOTNET_CLI_HOME"
          - name: DOTNET_CLI_TELEMETRY_OPTOUT
            value: "1"
        resources:
          limits:
            cpu: 750m
            memory: 1500Mi
          requests:
            cpu: 500m
            memory: 1000Mi
        ports:
        - containerPort: 80
        # securityContext:
        #   runAsNonRoot: true
        #   runAsUser: 10001
        #   capabilities:
        #     drop:
        #       - all
        #     add:
        #       - NET_BIND_SERVICE
        #   #readOnlyRootFilesystem: true
        volumeMounts:
        - mountPath: /tmp
          name: tmp-volume
        livenessProbe:
          httpGet:
            path: /health
            port: 80
          initialDelaySeconds: 300
          periodSeconds: 3
        readinessProbe:
          httpGet:
            path: /health
            port: 80
          initialDelaySeconds: 180
          periodSeconds: 3
      volumes:
        - name: tmp-volume
          emptyDir:
            medium: Memory
      nodeSelector:
        beta.kubernetes.io/os: linux
