apiVersion: apps/v1
kind: Deployment
metadata:
  name: container-mom-operator
  namespace: container-mom-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: container-mom-operator
  template:
    metadata:
      labels:
        app: container-mom-operator
    spec:
      serviceAccountName: container-mom
      containers:
      - name: operator
        image: ghcr.io/pfeifferj/container-mom-operator:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 8081
          name: http
        env:
        - name: LISTEN_ADDR
          value: ":8081"
        - name: MONGODB_URI
          valueFrom:
            secretKeyRef:
              name: container-mom-mongodb
              key: uri
        - name: STRIPE_KEY
          valueFrom:
            secretKeyRef:
              name: container-mom-portal-backend
              key: stripe-secret-key
        - name: STRIPE_WEBHOOK_SECRET
          valueFrom:
            secretKeyRef:
              name: portal-backend-secrets
              key: stripe-webhook-secret
        - name: CLOUDFLARE_API_TOKEN
          valueFrom:
            secretKeyRef:
              name: cloudflare-api-token
              key: token
        - name: CLOUDFLARE_ZONE_ID
          valueFrom:
            secretKeyRef:
              name: cloudflare-api-token
              key: zone_id
        - name: ROUTER_URL
          valueFrom:
            configMapKeyRef:
              name: router-config
              key: ROUTER_URL
        livenessProbe:
          httpGet:
            path: /healthz
            port: http
          initialDelaySeconds: 15
          periodSeconds: 10
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /readyz
            port: http
          initialDelaySeconds: 15
          periodSeconds: 10
          failureThreshold: 3
        resources:
          limits:
            cpu: 500m
            memory: 512Mi
          requests:
            cpu: 100m
            memory: 128Mi