---
apiVersion: v1
kind: Service
metadata:
  name: spy
  labels:
    app: spy
spec:
  clusterIP: None
  selector:
    app: spy
  ports:
    - port: 7777
      name: spy
      protocol: TCP
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: spy
spec:
  selector:
    matchLabels:
      app: spy
  serviceName: spy
  template:
    metadata:
      labels:
        app: spy
    spec:
      restartPolicy: Always
      terminationGracePeriodSeconds: 0
      containers:
        - name: spy
          image: spy:latest
          env:
            - name: MONGODB_URI
              value: mongodb://mongo-0.mongo/?replicaSet=rs0
            - name: MONGODB_DATABASE
              value: wormhole
            - name: GRPC_ADDRESS
              value: "0.0.0.0:7777"
