---
apiVersion: v1
kind: Service
metadata:
  name: pyth-price-service
  labels:
    app: pyth-price-service
spec:
  ports:
    - port: 8081
      name: prometheus
      protocol: TCP
    - port: 4200
      name: rest-api
      protocol: TCP
  clusterIP: None
  selector:
    app: pyth-price-service
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pyth-price-service
spec:
  selector:
    matchLabels:
      app: pyth-price-service
  serviceName: pyth-price-service
  replicas: 2
  template:
    metadata:
      labels:
        app: pyth-price-service
    spec:
      terminationGracePeriodSeconds: 0
      containers:
        - name: pyth-price-service
          image: pyth-price-service
          ports:
            - containerPort: 8081
              name: prometheus
              protocol: TCP
            - containerPort: 4200
              name: rest-api
              protocol: TCP
          readinessProbe:
            httpGet:
              path: "/ready"
              port: 4200
            initialDelaySeconds: 10
            periodSeconds: 1
            failureThreshold: 1
          livenessProbe:
            httpGet:
              path: "/live"
              port: 4200
            initialDelaySeconds: 20
            periodSeconds: 30
            timeoutSeconds: 30
          env:
            - name: SPY_SERVICE_HOST
              value: spy:7072
            - name: SPY_SERVICE_FILTERS
              value: '[{"chain_id":1,"emitter_address":"71f8dcb863d176e2c420ad6610cf687359612b6fb392e0642b0ca6b1f186aa3b"}]'
            - name: REST_PORT
              value: "4200"
            - name: PROM_PORT
              value: "8081"
            - name: READINESS_SPY_SYNC_TIME_SECONDS
              value: "5"
            - name: READINESS_NUM_LOADED_SYMBOLS
              value: "6"
            - name: LOG_LEVEL
              value: debug
