---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: api
spec:
  selector:
    matchLabels:
      app: api
  template:
    metadata:
      labels:
        app: api
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/path: /metrics
        prometheus.io/port: "5050"
    spec:
      securityContext:
        fsGroup: 1000
      containers:
        - name: api
          image: shokohsc/moleculer-ouistity
          securityContext:
            runAsUser: 1000
            runAsGroup: 1000
          env:
            - name: APP_GLOBAL_GATEWAY_URL
              value: http://api.svc.cluster.local
            - name: APP_MOLECULER_APOLLO_HOSTNAME
              value: graphql
            - name: APP_NATS_HOSTNAME
              value: nats
          args:
            - services/api-gateway.service.js
          ports:
            - name: http
              containerPort: 5000
              protocol: TCP
            - name: apollo
              containerPort: 7000
              protocol: TCP
            - name: metrics
              containerPort: 5050
              protocol: TCP
          livenessProbe:
            httpGet:
              port: http
              path: /status/liveness
          readinessProbe:
            httpGet:
              port: http
              path: /status/readiness
