| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: cidadao-api | |
| labels: | |
| app: cidadao-api | |
| spec: | |
| replicas: 3 | |
| selector: | |
| matchLabels: | |
| app: cidadao-api | |
| template: | |
| metadata: | |
| labels: | |
| app: cidadao-api | |
| spec: | |
| containers: | |
| - name: api | |
| image: cidadaoai/backend:latest | |
| ports: | |
| - containerPort: 8000 | |
| env: | |
| - name: DATABASE_URL | |
| valueFrom: | |
| secretKeyRef: | |
| name: cidadao-secrets | |
| key: database-url | |
| - name: REDIS_URL | |
| valueFrom: | |
| secretKeyRef: | |
| name: cidadao-secrets | |
| key: redis-url | |
| - name: MARITACA_API_KEY | |
| valueFrom: | |
| secretKeyRef: | |
| name: cidadao-secrets | |
| key: maritaca-api-key | |
| resources: | |
| requests: | |
| memory: "512Mi" | |
| cpu: "250m" | |
| limits: | |
| memory: "2Gi" | |
| cpu: "1000m" | |
| livenessProbe: | |
| httpGet: | |
| path: /health | |
| port: 8000 | |
| initialDelaySeconds: 30 | |
| periodSeconds: 10 | |
| readinessProbe: | |
| httpGet: | |
| path: /health/ready | |
| port: 8000 | |
| initialDelaySeconds: 5 | |
| periodSeconds: 5 | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: cidadao-api-service | |
| spec: | |
| selector: | |
| app: cidadao-api | |
| ports: | |
| - protocol: TCP | |
| port: 80 | |
| targetPort: 8000 | |
| type: LoadBalancer | |
| apiVersion: autoscaling/v2 | |
| kind: HorizontalPodAutoscaler | |
| metadata: | |
| name: cidadao-api-hpa | |
| spec: | |
| scaleTargetRef: | |
| apiVersion: apps/v1 | |
| kind: Deployment | |
| name: cidadao-api | |
| minReplicas: 2 | |
| maxReplicas: 10 | |
| metrics: | |
| - type: Resource | |
| resource: | |
| name: cpu | |
| target: | |
| type: Utilization | |
| averageUtilization: 70 | |
| - type: Resource | |
| resource: | |
| name: memory | |
| target: | |
| type: Utilization | |
| averageUtilization: 80 |