---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: proxy
  namespace: default
spec:
  selector:
    matchLabels:
      app: proxy
  serviceName: proxy-headless-svc
  replicas: 1
  template:
    metadata:
      annotations:
        rometheus.io/port: "9001"
        prometheus.io/scrape: "true"
      labels:
        app: proxy
    spec:
      containers:
      - name: massa-proxy
        image: docker.io/eigr/massa-proxy:0.1.0
        ports:
        - containerPort: 9000
        - containerPort: 9001
        - containerPort: 4369
        imagePullPolicy: Always
        env:
        - name: NODE_COOKIE
          value: "massa_proxy_6eycE1E/S341t4Bcto262ffyFWklCWHQIKloJDJYR7Y="
        - name: PROXY_POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /health
            port: 9001
            scheme: HTTP
          initialDelaySeconds: 300
          periodSeconds: 3600
          successThreshold: 1
          timeoutSeconds: 1200
        resources:
          limits:
            memory: 1024Mi
          requests:
            memory: 70Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        envFrom:
        - configMapRef:
            name: proxy-cm

      - name: user-function
        image: docker.io/cloudstateio/cloudstate-python-tck:latest
        ports:
        - containerPort: 8080
          name: http
