From 7f10ada6e8716d3f3b9d581dbaa9c66cee080894 Mon Sep 17 00:00:00 2001 From: emelinda Date: Tue, 14 Apr 2026 16:46:51 +0300 Subject: [PATCH] Add comparisons app with deployment, service, configmaps, namespace, and PostgreSQL configurations in yc-k8s-test --- apps/comparisons/base/backend-deployment.yaml | 125 ++++++++++++++++++ apps/comparisons/base/backend-service.yaml | 15 +++ .../comparisons/base/frontend-deployment.yaml | 57 ++++++++ apps/comparisons/base/frontend-service.yaml | 15 +++ apps/comparisons/base/kustomization.yaml | 12 ++ apps/comparisons/base/namespace.yaml | 7 + apps/comparisons/base/nginx-configmap.yaml | 47 +++++++ .../base/tasks-execution-config.yaml | 104 +++++++++++++++ .../yc-k8s-test/kustomization.yaml | 11 ++ apps/comparisons/yc-k8s-test/postgresql.yaml | 110 +++++++++++++++ apps/comparisons/yc-k8s-test/replicas.yaml | 8 ++ clusters/yc-k8s-test/kustomization.yaml | 3 +- 12 files changed, 513 insertions(+), 1 deletion(-) create mode 100644 apps/comparisons/base/backend-deployment.yaml create mode 100644 apps/comparisons/base/backend-service.yaml create mode 100644 apps/comparisons/base/frontend-deployment.yaml create mode 100644 apps/comparisons/base/frontend-service.yaml create mode 100644 apps/comparisons/base/kustomization.yaml create mode 100644 apps/comparisons/base/namespace.yaml create mode 100644 apps/comparisons/base/nginx-configmap.yaml create mode 100644 apps/comparisons/base/tasks-execution-config.yaml create mode 100644 apps/comparisons/yc-k8s-test/kustomization.yaml create mode 100644 apps/comparisons/yc-k8s-test/postgresql.yaml create mode 100644 apps/comparisons/yc-k8s-test/replicas.yaml diff --git a/apps/comparisons/base/backend-deployment.yaml b/apps/comparisons/base/backend-deployment.yaml new file mode 100644 index 0000000..822d6b9 --- /dev/null +++ b/apps/comparisons/base/backend-deployment.yaml @@ -0,0 +1,125 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: backend + namespace: comparisons + labels: + app: backend +spec: + replicas: 1 + selector: + matchLabels: + app: backend + template: + metadata: + labels: + app: backend + spec: + volumes: + - name: tasks-execution-config + configMap: + name: tasks-execution-config-comparisons-v2 + items: + - key: tasks-execution-config-comparisons-v2.json + path: tasks-execution-config.json + containers: + - name: backend + image: cr.yandex/crp3ccidau046kdj8g9q/comparisons:prod_863df9f0 + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 8080 + protocol: TCP + env: + - name: APP_NAME + value: comparisons-api-v2 + - name: APP_VERSION + value: 0.0.1 + - name: LOGGER_LOG_LEVEL + value: info + - name: DATABASE_NAME + value: postgres + - name: HTTP_PORT + value: "8080" + - name: DOCUMENTATIONS_INTERNAL_HOST + value: http://documentations-service.documentations + - name: DOCUMENTATIONS_EXTERNAL_HOST + value: https://api.sarex.io/documentations + - name: WORKFLOWS_HOST + value: http://workflows-service.processing + - name: WORKFLOWS_IMAGE_VERSION + value: master + - name: WORKFLOWS_DJANGO_HOST + value: https://lk.sarex.io + - name: WORKFLOWS_BIMV2_INTERNAL_HOST + value: http://bim-backend-v2-service.bim-api + - name: WORKSPACES_HOST + value: http://workspaces-service.workspaces + - name: EAV_HOST + value: https://api.sarex.io/eav + - name: LAST_MASTER_BIM + value: "36311" + - name: LAST_SLAVE_1_BIM + value: "94015" + - name: LAST_SLAVE_2_BIM + value: "135771" + - name: ABAP_FIXED_CONC + value: "0" + - name: WORKFLOWS_CONFIG_FILEPATH + value: /etc/app/tasks-execution-config.json + - name: DATABASE_HOST + valueFrom: + secretKeyRef: + name: postgresql-secrets + key: host + - name: DATABASE_PORT + valueFrom: + secretKeyRef: + name: postgresql-secrets + key: port + - name: DATABASE_DB + valueFrom: + secretKeyRef: + name: postgresql-secrets + key: database + - name: DATABASE_USER + valueFrom: + secretKeyRef: + name: postgresql-secrets + key: username + - name: DATABASE_PASSWORD + valueFrom: + secretKeyRef: + name: postgresql-secrets + key: password + - name: AUTH_PUBLIC_KEY + valueFrom: + secretKeyRef: + name: auth-public-key + key: public_key + resources: + requests: + cpu: 100m + memory: 100Mi + volumeMounts: + - name: tasks-execution-config + readOnly: true + mountPath: /etc/app/tasks-execution-config.json + subPath: tasks-execution-config.json + livenessProbe: + httpGet: + path: /ping + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 60 + failureThreshold: 10 + readinessProbe: + httpGet: + path: /ping + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 5 + failureThreshold: 20 + imagePullSecrets: + - name: regcred diff --git a/apps/comparisons/base/backend-service.yaml b/apps/comparisons/base/backend-service.yaml new file mode 100644 index 0000000..54252ee --- /dev/null +++ b/apps/comparisons/base/backend-service.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: backend-service + namespace: comparisons +spec: + type: ClusterIP + selector: + app: backend + ports: + - name: http + port: 80 + targetPort: 8080 + protocol: TCP diff --git a/apps/comparisons/base/frontend-deployment.yaml b/apps/comparisons/base/frontend-deployment.yaml new file mode 100644 index 0000000..30c7593 --- /dev/null +++ b/apps/comparisons/base/frontend-deployment.yaml @@ -0,0 +1,57 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: frontend + namespace: comparisons + labels: + app: frontend +spec: + replicas: 1 + selector: + matchLabels: + app: frontend + template: + metadata: + labels: + app: frontend + spec: + volumes: + - name: nginx-configmap + configMap: + name: nginx-configmap + items: + - key: nginx.conf + path: nginx.conf + containers: + - name: frontend + image: cr.yandex/crp3ccidau046kdj8g9q/comparisons-frontend:prod_6dc6e0c2 + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 80 + protocol: TCP + resources: + requests: + cpu: 100m + memory: 100Mi + volumeMounts: + - name: nginx-configmap + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + livenessProbe: + httpGet: + path: /ping + port: 80 + initialDelaySeconds: 10 + periodSeconds: 10 + failureThreshold: 10 + readinessProbe: + httpGet: + path: /ping + port: 80 + initialDelaySeconds: 10 + periodSeconds: 10 + failureThreshold: 20 + imagePullSecrets: + - name: regcred diff --git a/apps/comparisons/base/frontend-service.yaml b/apps/comparisons/base/frontend-service.yaml new file mode 100644 index 0000000..2197ee6 --- /dev/null +++ b/apps/comparisons/base/frontend-service.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: frontend-service + namespace: comparisons +spec: + type: ClusterIP + selector: + app: frontend + ports: + - name: http + port: 80 + targetPort: 80 + protocol: TCP diff --git a/apps/comparisons/base/kustomization.yaml b/apps/comparisons/base/kustomization.yaml new file mode 100644 index 0000000..de740f3 --- /dev/null +++ b/apps/comparisons/base/kustomization.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: comparisons +resources: + - namespace.yaml +# - backend-deployment.yaml + - backend-service.yaml + - frontend-deployment.yaml + - frontend-service.yaml + - nginx-configmap.yaml +# - tasks-execution-config.yaml diff --git a/apps/comparisons/base/namespace.yaml b/apps/comparisons/base/namespace.yaml new file mode 100644 index 0000000..e9a7e63 --- /dev/null +++ b/apps/comparisons/base/namespace.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: comparisons + labels: + istio-injection: enabled diff --git a/apps/comparisons/base/nginx-configmap.yaml b/apps/comparisons/base/nginx-configmap.yaml new file mode 100644 index 0000000..4dc175f --- /dev/null +++ b/apps/comparisons/base/nginx-configmap.yaml @@ -0,0 +1,47 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-configmap + namespace: comparisons +data: + nginx.conf: | + user nginx; + worker_processes auto; + + error_log stderr warn; + pid /var/run/nginx.pid; + + events { + worker_connections 1024; + } + + http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /dev/stdout main; + + sendfile on; + + keepalive_timeout 65; + + gzip on; + + server { + client_header_buffer_size 16k; + large_client_header_buffers 4 16k; + listen 80; + server_name localhost; + root /dist; + expires off; + + location = /ping { + return 200 '{"result": "ok"}'; + } + } + } diff --git a/apps/comparisons/base/tasks-execution-config.yaml b/apps/comparisons/base/tasks-execution-config.yaml new file mode 100644 index 0000000..a36ef92 --- /dev/null +++ b/apps/comparisons/base/tasks-execution-config.yaml @@ -0,0 +1,104 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: tasks-execution-config-comparisons-v2 + namespace: comparisons +data: + tasks-execution-config-comparisons-v2.json: | + { + "abap": { + "executor": "k8s", + "resources": { + "cpu_requests": "8", + "memory_requests": "40Gi" + } + }, + "bim2bim_comparison": { + "executor": "k8s" + }, + "bim_api_metadata_inserter_v2": { + "executor": "k8s", + "resources": { + "memory_requests": "5Gi" + } + }, + "bim_api_metadata_inserter_v4": { + "executor": "k8s", + "resources": { + "memory_requests": "3Gi" + } + }, + "bim_abap_updater": { + "executor": "k8s" + }, + "build_ooc": { + "executor": "k8s", + "resources": { + "cpu_requests": "8", + "memory_requests": "40Gi" + } + }, + "calculate_deviation_job": { + "executor": "k8s", + "resources": { + "cpu_requests": "8", + "memory_requests": "40Gi" + } + }, + "cloud_to_cloud": { + "executor": "k8s", + "resources": { + "cpu_requests": "8", + "memory_requests": "40Gi" + } + }, + "cloud_to_surface": { + "executor": "k8s", + "resources": { + "cpu_requests": "8", + "memory_requests": "40Gi" + } + }, + "convert_to_potree": { + "executor": "k8s", + "resources": { + "cpu_requests": "900m", + "memory_requests": "3.3Gi" + } + }, + "deviation_icp": { + "executor": "k8s", + "resources": { + "cpu_requests": "8", + "memory_requests": "40Gi" + } + }, + "las_to_tiff": { + "executor": "k8s", + "resources": { + "cpu_requests": "8", + "memory_requests": "40Gi" + } + }, + "pdf_cv_comparer": { + "executor": "k8s", + "resources": { + "cpu_requests": "1", + "memory_requests": "512Mi" + } + }, + "pdf_georeferencing": { + "executor": "k8s" + }, + "split_pdf_document": { + "executor": "k8s", + "resources": { + "cpu_requests": "1", + "memory_requests": "512Mi" + } + }, + "webhook_caller": { + "executor": "k8s" + } + } diff --git a/apps/comparisons/yc-k8s-test/kustomization.yaml b/apps/comparisons/yc-k8s-test/kustomization.yaml new file mode 100644 index 0000000..c643c00 --- /dev/null +++ b/apps/comparisons/yc-k8s-test/kustomization.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../base + - postgresql.yaml +patches: + - path: replicas.yaml + target: + kind: Deployment + name: attachments diff --git a/apps/comparisons/yc-k8s-test/postgresql.yaml b/apps/comparisons/yc-k8s-test/postgresql.yaml new file mode 100644 index 0000000..f45515d --- /dev/null +++ b/apps/comparisons/yc-k8s-test/postgresql.yaml @@ -0,0 +1,110 @@ +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: postgresql + namespace: comparisons +spec: + interval: 5m + timeout: 2h + chart: + spec: + chart: postgresql-contour + version: "17.0.2" + sourceRef: + kind: HelmRepository + name: yc-oci-charts + namespace: flux-system + + install: + timeout: 2h + remediation: + retries: 3 + + upgrade: + timeout: 2h + remediation: + retries: 3 + + values: + global: + security: + allowInsecureImages: true + defaultStorageClass: local-path + postgresql: + auth: + username: "" + database: "" + secretKeys: + userPasswordKey: "postgres-password" + auth: + username: "" + database: "" + secretKeys: + userPasswordKey: "postgres-password" + image: + registry: cr.yandex/crp3ccidau046kdj8g9q + repository: contour/postgresql + tag: 17.0.2 + pullPolicy: Always + metrics: + enabled: false + prometheusRule: + enabled: false + primary: + containerSecurityContext: + readOnlyRootFilesystem: false + persistence: + storageClass: local-path + size: 20Gi + customLivenessProbe: + exec: + command: + - /bin/sh + - -c + - exec pg_isready -U "sarex" -d postgres -h 127.0.0.1 -p 5432 + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 6 + customReadinessProbe: + exec: + command: + - /bin/sh + - -c + - exec pg_isready -U "sarex" -d postgres -h 127.0.0.1 -p 5432 + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 6 + customStartupProbe: + exec: + command: + - /bin/sh + - -c + - exec pg_isready -U "sarex" -d postgres -h 127.0.0.1 -p 5432 + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 6 + nodeSelector: + dedicated: db + tolerations: + - key: dedicated + operator: Equal + value: db + effect: NoSchedule + contour: + enabled: true + adminUser: "" + adminPasswordSecretKey: "" + sharedPreloadLibraries: "pg_stat_statements,uuid-ossp" + databases: + - name: comparisons_db + user: comparisons + extensions: [] + restoreFromDump: false + s3-proxy: + endpointUrl: "s3-proxy-service.postgresql.svc.cluster.local" \ No newline at end of file diff --git a/apps/comparisons/yc-k8s-test/replicas.yaml b/apps/comparisons/yc-k8s-test/replicas.yaml new file mode 100644 index 0000000..9ead5d9 --- /dev/null +++ b/apps/comparisons/yc-k8s-test/replicas.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: backend + namespace: comparisons +spec: + replicas: 1 diff --git a/clusters/yc-k8s-test/kustomization.yaml b/clusters/yc-k8s-test/kustomization.yaml index d823a5d..abd5f52 100644 --- a/clusters/yc-k8s-test/kustomization.yaml +++ b/clusters/yc-k8s-test/kustomization.yaml @@ -13,4 +13,5 @@ resources: - ../../apps/mapper/yc-k8s-test - ../../apps/attachments/yc-k8s-test - ../../apps/measurements/yc-k8s-test - - ../../apps/drawings/yc-k8s-test \ No newline at end of file + - ../../apps/drawings/yc-k8s-test + - ../../apps/comparisons/yc-k8s-test \ No newline at end of file