iac/apps/documentations/cronjobs/uralkal/sizer.yaml
2026-11-05 15:18:54 +02:00

85 lines
3.2 KiB
YAML

---
apiVersion: batch/v1
kind: CronJob
metadata:
name: cde-api-sizer
namespace: documentations
labels:
app.kubernetes.io/name: cde-api-sizer
app.kubernetes.io/part-of: cde-api
spec:
schedule: "0 0 * * *"
timeZone: Etc/UTC
suspend: false
concurrencyPolicy: Forbid
startingDeadlineSeconds: 1800
successfulJobsHistoryLimit: 2
failedJobsHistoryLimit: 3
jobTemplate:
spec:
backoffLimit: 0
activeDeadlineSeconds: 21600
template:
metadata:
labels:
app.kubernetes.io/name: cde-api-sizer
annotations:
proxy.istio.io/config: '{"terminationDrainDuration":"0s"}'
sidecar.istio.io/inject: "true"
sidecar.istio.io/nativeSidecar: "true"
traffic.sidecar.istio.io/excludeOutboundPorts: "8200"
vault.hashicorp.com/agent-init-first: "true"
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-pre-populate-only: "true"
vault.hashicorp.com/auth-path: auth/kubernetes
vault.hashicorp.com/role: documentations
vault.hashicorp.com/agent-inject-secret-cde-api-postgres: secrets/data/apps/documentations/postgres
vault.hashicorp.com/agent-inject-template-cde-api-postgres: |-
{{- with secret "secrets/data/apps/documentations/postgres" -}}
CDE_API_DATABASE__HOST={{ index .Data.data "host" }}
CDE_API_DATABASE__PORT={{ index .Data.data "port" }}
CDE_API_DATABASE__NAME={{ index .Data.data "database" }}
CDE_API_DATABASE__USER={{ index .Data.data "username" }}
CDE_API_DATABASE__PASSWORD={{ index .Data.data "password" }}
{{- end -}}
spec:
restartPolicy: Never
terminationGracePeriodSeconds: 30
serviceAccountName: documentations-vault
imagePullSecrets:
- name: regcred
containers:
- name: sizer
image: cr.yandex/crp3ccidau046kdj8g9q/cde-api-worker-sizer:prod_c9bc246
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-ec"]
args:
- |
set -a
[ -f /vault/secrets/cde-api-postgres ] && . /vault/secrets/cde-api-postgres
set +a
exec /opt/worker
resources:
requests:
cpu: 100m
memory: 128Mi
env:
- name: CDE_API_APP_NAME
value: "worker-sizer"
- name: CDE_API_LOG_LEVEL
value: "info"
- name: CDE_API_OBSERVABILITY_ENABLE
value: "false"
- name: CDE_API_SIZER_BATCH_SIZE
value: "10000"
- name: CDE_API_SIZER_NUM_WORKERS
value: "10"
- name: CDE_API_SIZER_JOB_HALF_PERIOD
value: "12h"
- name: CDE_API_SIZER_RUN_TIMEOUT
value: "6h"
- name: CDE_API_DATABASE__SSLMODE
value: "disable"
- name: CDE_API_DATABASE__INSECURE_SKIP_TLS
value: "false"