apiVersion: apps/v1
kind: Deployment
metadata:
  name: supertokens
  labels:
    app: flxn
    component: supertokens
spec:
  replicas: 1
  selector:
    matchLabels:
      app: flxn
      component: supertokens
  template:
    metadata:
      labels:
        app: flxn
        component: supertokens
    spec:
      enableServiceLinks: false
      containers:
      - name: supertokens
        image: registry.supertokens.io/supertokens/supertokens-postgresql:latest
        ports:
        - containerPort: 3567
          name: http
          protocol: TCP
        env:
        - name: PORT
          value: "3567"
        - name: POSTGRESQL_USER
          value: supertokens
        - name: POSTGRESQL_PASSWORD
          valueFrom:
            secretKeyRef:
              name: supertokens-secrets
              key: postgres_password
        - name: POSTGRESQL_HOST
          value: supertokens-db
        - name: POSTGRESQL_PORT
          value: "5432"
        - name: POSTGRESQL_DATABASE_NAME
          value: supertokens
        - name: API_KEYS
          valueFrom:
            secretKeyRef:
              name: supertokens-secrets
              key: api_keys
        resources:
          requests:
            memory: "256Mi"
            cpu: "100m"
          limits:
            memory: "512Mi"
            cpu: "500m"
        livenessProbe:
          httpGet:
            path: /hello
            port: 3567
          initialDelaySeconds: 30
          periodSeconds: 30
          timeoutSeconds: 5
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /hello
            port: 3567
          initialDelaySeconds: 10
          periodSeconds: 10
          timeoutSeconds: 3
          failureThreshold: 3
