Add deployment, service, and PostgreSQL configurations for drawings app in yc-k8s-test
This commit is contained in:
parent
597903e01b
commit
dac1248d4a
55
apps/drawings/base/deployment.yaml
Normal file
55
apps/drawings/base/deployment.yaml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: backend
|
||||||
|
namespace: drawings
|
||||||
|
labels:
|
||||||
|
app: backend
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: backend
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: backend
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: backend
|
||||||
|
image: cr.yandex/crp3ccidau046kdj8g9q/drawings-api:015e68e1b2a3dcc13f0b405e1f761b154a825d24
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 8080
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_POOL_SIZE
|
||||||
|
value: "3"
|
||||||
|
- name: API_ADDRESS
|
||||||
|
value: 0.0.0.0:8000
|
||||||
|
- name: ENABLE_SSL
|
||||||
|
value: "0"
|
||||||
|
- name: POSTGRES_ADDRESS
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: postgresql-secrets
|
||||||
|
key: hostname
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: postgresql-secrets
|
||||||
|
key: database
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: postgresql-secrets
|
||||||
|
key: username
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: postgresql-secrets
|
||||||
|
key: password
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
8
apps/drawings/base/kustomization.yaml
Normal file
8
apps/drawings/base/kustomization.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
namespace: drawings
|
||||||
|
resources:
|
||||||
|
- namespace.yaml
|
||||||
|
- deployment.yaml
|
||||||
|
- service.yaml
|
||||||
7
apps/drawings/base/namespace.yaml
Normal file
7
apps/drawings/base/namespace.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: drawings
|
||||||
|
labels:
|
||||||
|
istio-injection: enabled
|
||||||
15
apps/drawings/base/service.yaml
Normal file
15
apps/drawings/base/service.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: backend-service
|
||||||
|
namespace: drawings
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app: backend
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 8000
|
||||||
|
targetPort: 8000
|
||||||
|
protocol: TCP
|
||||||
11
apps/drawings/yc-k8s-test/kustomization.yaml
Normal file
11
apps/drawings/yc-k8s-test/kustomization.yaml
Normal 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: backend
|
||||||
110
apps/drawings/yc-k8s-test/postgresql.yaml
Normal file
110
apps/drawings/yc-k8s-test/postgresql.yaml
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: postgresql
|
||||||
|
namespace: drawings
|
||||||
|
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: drawings_db
|
||||||
|
user: drawings
|
||||||
|
extensions: []
|
||||||
|
restoreFromDump: false
|
||||||
|
s3-proxy:
|
||||||
|
endpointUrl: "s3-proxy-service.postgresql.svc.cluster.local"
|
||||||
8
apps/drawings/yc-k8s-test/replicas.yaml
Normal file
8
apps/drawings/yc-k8s-test/replicas.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: backend
|
||||||
|
namespace: drawings
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
@ -12,4 +12,5 @@ resources:
|
|||||||
- ../../apps/cross-section/yc-k8s-test
|
- ../../apps/cross-section/yc-k8s-test
|
||||||
- ../../apps/mapper/yc-k8s-test
|
- ../../apps/mapper/yc-k8s-test
|
||||||
- ../../apps/attachments/yc-k8s-test
|
- ../../apps/attachments/yc-k8s-test
|
||||||
- ../../apps/measurements/yc-k8s-test
|
- ../../apps/measurements/yc-k8s-test
|
||||||
|
- ../../apps/drawings/yc-k8s-test
|
||||||
Loading…
Reference in New Issue
Block a user