apiVersion: apps/v1
kind: Deployment
metadata:
  name: nats
  labels:
    app: nats
    {{- include "common.labels" . | nindent 4 }}
spec:
  selector:
    matchLabels:
      app: nats
      {{- include "common.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app: nats
        {{- include "common.selectorLabels" . | nindent 8 }}
    spec:
      securityContext:
        runAsUser: 1000
        runAsGroup: 1000
        fsGroup: 1000
      containers:
        - name: nats
          image: nats:2.11.8-scratch@sha256:e7c71e573e944705eeb1da5e73d5887677c0c2844921ae36eee4bf5df5370a53
          resources:
            requests:
              cpu: "0.1"
              memory: "64Mi"
            limits:
              cpu: "0.2"
              memory: "128Mi"
          readinessProbe:
            tcpSocket:
              port: 4222
          livenessProbe:
            tcpSocket:
              port: 4222
---
apiVersion: v1
kind: Service
metadata:
  name: nats
  labels:
    app: nats
    {{- include "common.labels" . | nindent 4 }}
spec:
  ports:
    - name: tcp
      port: 4222
      protocol: TCP
    - name: http
      port: 8222
      protocol: TCP
  selector:
    app: nats
    {{- include "common.selectorLabels" . | nindent 4 }}