
apiVersion: apps/v1
kind: Deployment
metadata:
  name: edfi-admin-app
spec:
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  replicas: 1
  selector:
    matchLabels:
      app: edfi-admin-app
  template:
    metadata:
      labels:
        app: edfi-admin-app
    spec:
      containers:
      - name: edfi-admin-app
        image: us-central1-docker.pkg.dev/<GOOGLE_PROJECT_ID>/my-repository/edfi-admin-app:latest
        resources:
          limits:
            memory: "2Gi"
            cpu: "2"
        readinessProbe:
          httpGet:
            path: /health
            port: 80
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: 80
            scheme: HTTP
          initialDelaySeconds: 15
          periodSeconds: 20
        env:
          - name: POSTGRES_USER
            valueFrom:
              secretKeyRef:
                name: cloud-sql-creds
                key: username
          - name: POSTGRES_PASSWORD
            valueFrom:
              secretKeyRef:
                name: cloud-sql-creds
                key: password
          - name: POSTGRES_PORT
            value: "5432"
          - name: ODS_POSTGRES_HOST
            value: pgbouncer-service.default.svc.cluster.local
          - name: ADMIN_POSTGRES_HOST
            value: pgbouncer-service.default.svc.cluster.local
          - name: API_MODE
            value: "YearSpecific"
          - name: API_EXTERNAL_URL
            value: "https://<DOMAIN_NAME>"
          - name: ENCRYPTION_KEY
            valueFrom:
              secretKeyRef:
                name: edfi-admin-app-creds
                key: key
          - name: ADMINAPP_VIRTUAL_NAME
            value: "edfi-admin-app"
          - name: API_INTERNAL_URL
            value: "https://<DOMAIN_NAME>"
          - name: ADMINAPP_HEALTHCHECK_TEST
            value: "curl -f edfi-admin-app/health"
          - name: ODS_WAIT_POSTGRES_HOSTS
            value: "pgbouncer-service.default.svc.cluster.local "
        ports:
          - containerPort: 80
