apiVersion: v1
kind: Service
metadata:
  name: jetstream
  namespace: atproto
spec:
  selector:
    app: jetstream
  ports:
    - port: 6008
      targetPort: 6008
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jetstream-data
  namespace: atproto
spec:
  accessModes: ["ReadWriteOnce"]
  resources:
    requests:
      storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jetstream
  namespace: atproto
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jetstream
  template:
    metadata:
      labels:
        app: jetstream
    spec:
      containers:
        - name: jetstream
          image: registry/jetstream
          ports:
            - containerPort: 6008
          env:
            - name: JETSTREAM_WS_URL
              value: "ws://bgs:2470/xrpc/com.atproto.sync.subscribeRepos"
            - name: JETSTREAM_DATA_DIR
              value: "/data"
            - name: JETSTREAM_LISTEN_ADDR
              value: ":6008"
            - name: JETSTREAM_METRICS_LISTEN_ADDR
              value: ":6009"
            - name: JETSTREAM_LIVENESS_TTL
              value: "96h"
          volumeMounts:
            - name: data
              mountPath: /data
          livenessProbe:
            httpGet:
              path: /
              port: 6009
            initialDelaySeconds: 10
            periodSeconds: 10
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: jetstream-data
