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: 8080
          name: http
        env:
        - name: LISTEN_ADDR
          value: ":8080"
        - 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: container-mom-portal-backend
              key: stripe-webhook-secret
        - name: MONGODB_SSL
          value: "true"
        - name: MONGODB_SSL_CA
          value: "/etc/ssl/certs/ca-certificates.crt"
        - name: MONGODB_DIRECT_CONNECTION
          value: "false"
        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
        volumeMounts:
        - name: ca-certs
          mountPath: /etc/ssl/certs
          readOnly: true
      volumes:
      - name: ca-certs
        hostPath:
          path: /etc/ssl/certs
          type: Directory 