Add comparisons app with deployment, service, configmaps, namespace, and PostgreSQL configurations in yc-k8s-test

This commit is contained in:
emelinda 2026-04-14 16:46:51 +03:00
parent db11e99b8a
commit 7f10ada6e8
12 changed files with 513 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: comparisons
labels:
istio-injection: enabled

View File

@ -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"}';
}
}
}

View File

@ -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"
}
}

View File

@ -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

View File

@ -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"

View File

@ -0,0 +1,8 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
namespace: comparisons
spec:
replicas: 1

View File

@ -14,3 +14,4 @@ resources:
- ../../apps/attachments/yc-k8s-test
- ../../apps/measurements/yc-k8s-test
- ../../apps/drawings/yc-k8s-test
- ../../apps/comparisons/yc-k8s-test