From cdcd5180236cd08bb07c268865193ada2d03aaa6 Mon Sep 17 00:00:00 2001 From: Davi Aliaga Date: Wed, 23 Sep 2026 03:45:59 -0300 Subject: [PATCH] feat/import: adiciona import-api e seus secrets ao kustomization.yaml --- apps/config/import-api-secrets.yaml | 39 ++++++++ apps/import-api.yaml | 134 ++++++++++++++++++++++++++++ apps/kustomization.yaml | 2 + 3 files changed, 175 insertions(+) create mode 100644 apps/config/import-api-secrets.yaml create mode 100644 apps/import-api.yaml diff --git a/apps/config/import-api-secrets.yaml b/apps/config/import-api-secrets.yaml new file mode 100644 index 0000000..cebf6bc --- /dev/null +++ b/apps/config/import-api-secrets.yaml @@ -0,0 +1,39 @@ +apiVersion: secrets.infisical.com/v1alpha1 +kind: InfisicalSecret + +metadata: + name: acta-import-api-secrets + +spec: + hostAPI: https://app.infisical.com/api + resyncInterval: 60 + + authentication: + universalAuth: + credentialsRef: + secretName: infisical-universal-auth + secretNamespace: acta-prod + secretsScope: + projectId: 051dcf5e-00ed-4d46-8b36-baad0a621f5d + envSlug: prod + secretsPath: /import-api + recursive: false + + managedKubeSecretReferences: + - secretName: acta-import-api-env + secretNamespace: acta-prod + creationPolicy: Owner + + template: + includeAllSecrets: false + data: + DB_URL: "{{ .DB_URL.Value }}" + CLOUDINARY_CLOUD_NAME: "{{ .CLOUDINARY_CLOUD_NAME.Value }}" + CLOUDINARY_API_KEY: "{{ .CLOUDINARY_API_KEY.Value }}" + CLOUDINARY_API_SECRET: "{{ .CLOUDINARY_API_SECRET.Value }}" + ACTA_PG_API_URL: "{{ .ACTA_PG_API_URL.Value }}" + ACTA_IA_TOKEN: "{{ .ACTA_IA_TOKEN.Value }}" + REDIS_HOST: "{{ .REDIS_HOST.Value }}" + REDIS_PORT: "{{ .REDIS_PORT.Value }}" + REDIS_DB: "{{ .REDIS_DB.Value }}" + REDIS_PASSWORD: "{{ .REDIS_PASSWORD.Value }}" \ No newline at end of file diff --git a/apps/import-api.yaml b/apps/import-api.yaml new file mode 100644 index 0000000..5d8e805 --- /dev/null +++ b/apps/import-api.yaml @@ -0,0 +1,134 @@ +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: acta-import-api + annotations: + # reinicia os pods quando o infisical atualizar os secrets + secrets.infisical.com/auto-reload: "true" + labels: + app.kubernetes.io/name: acta-import-api + app.kubernetes.io/part-of: acta + +spec: + replicas: 1 + revisionHistoryLimit: 1 + + selector: + matchLabels: + app.kubernetes.io/name: acta-import-api + + template: + metadata: + labels: + app.kubernetes.io/name: acta-import-api + app.kubernetes.io/part-of: acta + + spec: + containers: + - name: acta-import-api + image: ghcr.io/appacta/acta-import-api:sha-23b88f8b6d2c4cd3625da6366ae669a5dd8ba8e3 + imagePullPolicy: IfNotPresent + + ports: + - name: http + containerPort: 8000 + protocol: TCP + + envFrom: + - secretRef: + name: acta-import-api-env + + startupProbe: + tcpSocket: + port: http + periodSeconds: 10 + failureThreshold: 60 + + readinessProbe: + tcpSocket: + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + + livenessProbe: + tcpSocket: + port: http + periodSeconds: 20 + timeoutSeconds: 5 + failureThreshold: 3 + + resources: + requests: + cpu: 100m + memory: 256Mi + limits: + cpu: 500m + memory: 512Mi +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: acta-import-worker + annotations: + # reinicia os pods quando o infisical atualizar os secrets + secrets.infisical.com/auto-reload: "true" + labels: + app.kubernetes.io/name: acta-import-worker + app.kubernetes.io/part-of: acta + +spec: + replicas: 1 + revisionHistoryLimit: 1 + + selector: + matchLabels: + app.kubernetes.io/name: acta-import-worker + + template: + metadata: + labels: + app.kubernetes.io/name: acta-import-worker + app.kubernetes.io/part-of: acta + + spec: + containers: + - name: acta-import-worker + image: ghcr.io/appacta/acta-import-api:sha-23b88f8b6d2c4cd3625da6366ae669a5dd8ba8e3 + imagePullPolicy: IfNotPresent + command: ["python", "worker.py"] + + envFrom: + - secretRef: + name: acta-import-api-env + + resources: + requests: + cpu: 100m + memory: 256Mi + limits: + cpu: 500m + memory: 512Mi +--- +apiVersion: v1 +kind: Service + +metadata: + name: acta-import-api + labels: + app.kubernetes.io/name: acta-import-api + app.kubernetes.io/part-of: acta + +spec: + type: ClusterIP + + selector: + app.kubernetes.io/name: acta-import-api + + ports: + - name: http + port: 8000 + targetPort: http + protocol: TCP \ No newline at end of file diff --git a/apps/kustomization.yaml b/apps/kustomization.yaml index ca75c5b..023f6e7 100644 --- a/apps/kustomization.yaml +++ b/apps/kustomization.yaml @@ -6,5 +6,7 @@ namespace: acta-prod resources: - pg-api.yaml - mongo-api.yaml + - import-api.yaml - config/pg-api-secrets.yaml - config/mongo-api-secrets.yaml + - config/import-api-secrets.yaml \ No newline at end of file