diff --git a/apps/workspaces/base/backend-deployment.yaml b/apps/workspaces/base/backend-deployment.yaml new file mode 100644 index 0000000..33cd497 --- /dev/null +++ b/apps/workspaces/base/backend-deployment.yaml @@ -0,0 +1,104 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: workspaces-api + namespace: workspaces + labels: + app: workspaces-api +spec: + replicas: 1 + selector: + matchLabels: + app: workspaces-api + template: + metadata: + labels: + app: workspaces-api + spec: + containers: + - name: workspaces-api + image: cr.yandex/crp3ccidau046kdj8g9q/workspaces:prod_4961b1f1 + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 8000 + protocol: TCP + env: + - name: POSTGRES_POOL_SIZE + value: "3" + - name: BUNDLES_RETRY_COUNT + value: "5" + - name: BUNDLES_NJOBS + value: "5" + - name: API_ADDRESS + value: 0.0.0.0:8000 + - name: NAMESPACE + value: workspaces + - name: ENABLE_SQL_QUERY + value: "0" + - name: ENABLE_SSL + value: "0" + - name: DOCUMENTATION_HOST + value: http://documentations-api.documentations.svc.cluster.local:8080 + - name: DOCUMENTATION_LOGGER_FEATURE + value: "0" + - name: DOCUMENTATION_ORIGINATOR + value: prod_ws + - name: ENVIRONMENT + value: prod + - name: DJANGO_HOST + value: http://backend.django.svc.cluster.local:8000 + - name: DJANGO_ORIGINATOR + value: docs_prod + - name: POSTGRES_DB + valueFrom: + secretKeyRef: + key: database + name: postgresql-secret + - name: POSTGRES_PORT + valueFrom: + secretKeyRef: + key: port + name: postgresql-secret + - name: POSTGRES_ADDRESS + valueFrom: + secretKeyRef: + key: hostname + name: postgresql-secret + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + key: username + name: postgresql-secret + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + key: password + name: postgresql-secret + - name: DJANGO_BASIC_AUTH + valueFrom: + secretKeyRef: + key: key + name: django-auth + + resources: + requests: + cpu: 100m + memory: 100Mi + livenessProbe: + httpGet: + path: /ping + port: 8000 + initialDelaySeconds: 10 + periodSeconds: 60 + failureThreshold: 10 + readinessProbe: + httpGet: + path: /ping + port: 8000 + initialDelaySeconds: 5 + periodSeconds: 5 + failureThreshold: 20 + imagePullSecrets: + - name: regcred diff --git a/apps/workspaces/base/backend-service.yaml b/apps/workspaces/base/backend-service.yaml new file mode 100644 index 0000000..046ddcd --- /dev/null +++ b/apps/workspaces/base/backend-service.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: backend-service + namespace: workspaces +spec: + type: ClusterIP + selector: + app: backend + ports: + - name: http + port: 8000 + targetPort: 8000 + protocol: TCP diff --git a/apps/workspaces/base/frontend-deployment.yaml b/apps/workspaces/base/frontend-deployment.yaml new file mode 100644 index 0000000..f718edf --- /dev/null +++ b/apps/workspaces/base/frontend-deployment.yaml @@ -0,0 +1,46 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: frontend + namespace: workspaces + labels: + app: frontend +spec: + replicas: 1 + selector: + matchLabels: + app: frontend + template: + metadata: + labels: + app: frontend + spec: + containers: + - name: frontend + image: cr.yandex/crp3ccidau046kdj8g9q/workspaces-v2-frontend:contour_7f95769f + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 80 + protocol: TCP + resources: + requests: + cpu: 100m + memory: 100Mi + 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/workspaces/base/frontend-service.yaml b/apps/workspaces/base/frontend-service.yaml new file mode 100644 index 0000000..b09b11e --- /dev/null +++ b/apps/workspaces/base/frontend-service.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: frontend-service + namespace: workspaces +spec: + type: ClusterIP + selector: + app: frontend + ports: + - name: http + port: 80 + targetPort: 80 + protocol: TCP diff --git a/apps/workspaces/base/kustomization.yaml b/apps/workspaces/base/kustomization.yaml new file mode 100644 index 0000000..47414e4 --- /dev/null +++ b/apps/workspaces/base/kustomization.yaml @@ -0,0 +1,10 @@ +--- +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 diff --git a/apps/workspaces/base/namespace.yaml b/apps/workspaces/base/namespace.yaml new file mode 100644 index 0000000..7790980 --- /dev/null +++ b/apps/workspaces/base/namespace.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: workspaces + labels: + istio-injection: enabled diff --git a/apps/workspaces/yc-k8s-test/kustomization.yaml b/apps/workspaces/yc-k8s-test/kustomization.yaml new file mode 100644 index 0000000..79e4c45 --- /dev/null +++ b/apps/workspaces/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: comparisons diff --git a/apps/workspaces/yc-k8s-test/postgresql.yaml b/apps/workspaces/yc-k8s-test/postgresql.yaml new file mode 100644 index 0000000..aa2979f --- /dev/null +++ b/apps/workspaces/yc-k8s-test/postgresql.yaml @@ -0,0 +1,113 @@ +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: postgresql + namespace: workspaces +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 + resources: + requests: + memory: 512Mi + 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: workspaces_db + user: workspaces + extensions: [] + restoreFromDump: false + s3-proxy: + endpointUrl: "s3-proxy-service.postgresql.svc.cluster.local" \ No newline at end of file diff --git a/apps/workspaces/yc-k8s-test/replicas.yaml b/apps/workspaces/yc-k8s-test/replicas.yaml new file mode 100644 index 0000000..cc9af30 --- /dev/null +++ b/apps/workspaces/yc-k8s-test/replicas.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: backend + namespace: workspaces +spec: + replicas: 1 diff --git a/clusters/yc-k8s-test/kustomization.yaml b/clusters/yc-k8s-test/kustomization.yaml index 538e203..115ead6 100644 --- a/clusters/yc-k8s-test/kustomization.yaml +++ b/clusters/yc-k8s-test/kustomization.yaml @@ -27,4 +27,5 @@ resources: - ../../apps/faas/yc-k8s-test - ../../apps/stamp-verification/yc-k8s-test - ../../apps/eav/yc-k8s-test - - ../../apps/resources/yc-k8s-test \ No newline at end of file + - ../../apps/resources/yc-k8s-test + - ../../apps/workspaces/yc-k8s-test \ No newline at end of file