apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "10"
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"policy-api","app.kubernetes.io/name":"policy-service","app.kubernetes.io/part-of":"archie-platform","component":"backend"},"name":"policy-api","namespace":"policy-service"},"spec":{"replicas":2,"selector":{"matchLabels":{"app":"policy-api","app.kubernetes.io/name":"policy-service","app.kubernetes.io/part-of":"archie-platform"}},"template":{"metadata":{"labels":{"app":"policy-api","app.kubernetes.io/name":"policy-service","app.kubernetes.io/part-of":"archie-platform","component":"backend"}},"spec":{"containers":[{"env":[{"name":"DATABASE_URL","value":"postgresql+asyncpg://policy_user@localhost:5432/archie_platform"},{"name":"ENVIRONMENT","value":"production"},{"name":"DEBUG","value":"False"},{"name":"JWT_SECRET_KEY","valueFrom":{"secretKeyRef":{"key":"jwt-secret-key","name":"policy-service-secrets"}}},{"name":"REDIS_URL","value":"rediss://10.86.215.187:6378"},{"name":"REDIS_PASSWORD","valueFrom":{"secretKeyRef":{"key":"password","name":"policy-redis-auth"}}}],"image":"us-central1-docker.pkg.dev/archie-v3-build/policy-service/api:latest","livenessProbe":{"failureThreshold":3,"httpGet":{"path":"/health","port":8080},"initialDelaySeconds":30,"periodSeconds":10,"timeoutSeconds":5},"name":"policy-api","ports":[{"containerPort":8080,"name":"http","protocol":"TCP"}],"readinessProbe":{"failureThreshold":3,"httpGet":{"path":"/health","port":8080},"initialDelaySeconds":10,"periodSeconds":5,"timeoutSeconds":3},"resources":{"limits":{"cpu":"1000m","memory":"1Gi"},"requests":{"cpu":"250m","memory":"512Mi"}}},{"args":["--structured-logs","--port=5432","archie-v3-build:us-central1:dev-policy-service-db"],"image":"gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.8.0","name":"cloud-sql-proxy","resources":{"limits":{"cpu":"200m","memory":"256Mi"},"requests":{"cpu":"100m","memory":"128Mi"}},"securityContext":{"runAsNonRoot":true}}],"serviceAccountName":"policy-service-sa"}}}}
  creationTimestamp: "2025-11-29T17:06:36Z"
  generation: 12
  labels:
    app: policy-api
    app.kubernetes.io/name: policy-service
    app.kubernetes.io/part-of: archie-platform
    component: backend
  name: policy-api
  namespace: policy-service
  resourceVersion: "1764615975805359014"
  uid: 65b1556c-9e5f-41fc-9a4f-e7fea011ea06
spec:
  progressDeadlineSeconds: 600
  replicas: 2
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: policy-api
      app.kubernetes.io/name: policy-service
      app.kubernetes.io/part-of: archie-platform
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/restartedAt: "2025-12-01T19:05:22Z"
      creationTimestamp: null
      labels:
        app: policy-api
        app.kubernetes.io/name: policy-service
        app.kubernetes.io/part-of: archie-platform
        component: backend
    spec:
      containers:
      - env:
        - name: DATABASE_URL
          value: postgresql+asyncpg://policy_user@localhost:5432/archie_platform
        - name: ENVIRONMENT
          value: production
        - name: DEBUG
          value: "False"
        - name: JWT_SECRET_KEY
          valueFrom:
            secretKeyRef:
              key: jwt-secret-key
              name: policy-service-secrets
        - name: REDIS_URL
          value: rediss://10.86.215.187:6378
        - name: REDIS_PASSWORD
          valueFrom:
            secretKeyRef:
              key: password
              name: policy-redis-auth
        image: us-central1-docker.pkg.dev/archie-v3-build/policy-service/api:latest
        imagePullPolicy: Always
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /health
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 30
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        name: policy-api
        ports:
        - containerPort: 8080
          name: http
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /health
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 5
          successThreshold: 1
          timeoutSeconds: 3
        resources:
          limits:
            cpu: "1"
            memory: 1Gi
          requests:
            cpu: 250m
            memory: 512Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      - args:
        - --structured-logs
        - --port=5432
        - archie-v3-build:us-central1:dev-policy-service-db
        image: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.8.0
        imagePullPolicy: IfNotPresent
        name: cloud-sql-proxy
        resources:
          limits:
            cpu: 200m
            memory: 256Mi
          requests:
            cpu: 100m
            memory: 128Mi
        securityContext:
          runAsNonRoot: true
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: policy-service-sa
      serviceAccountName: policy-service-sa
      terminationGracePeriodSeconds: 30
status:
  availableReplicas: 2
  conditions:
  - lastTransitionTime: "2025-12-01T19:05:51Z"
    lastUpdateTime: "2025-12-01T19:05:51Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2025-12-01T18:50:30Z"
    lastUpdateTime: "2025-12-01T19:06:15Z"
    message: ReplicaSet "policy-api-5b77855c74" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 12
  readyReplicas: 2
  replicas: 2
  updatedReplicas: 2
