From b4ec7f497876f404c7446245d903ca1b955ed057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= Date: Wed, 18 Dec 2024 08:36:26 +0100 Subject: [PATCH] docs: add k8s deployment files for t2 in CLARA --- clara-app/version.txt | 2 +- .../t2-reference-architecture/index.md | 35 ++---- t2-deployment/mongodb/mongo-values.yaml | 29 +++++ t2-deployment/start-microservices.sh | 24 ++++ t2-deployment/stop-microservices.sh | 19 +++ t2-deployment/t2-microservices/cart.yaml | 77 +++++++++++++ .../t2-microservices/cdcservice.yaml | 108 ++++++++++++++++++ .../t2-microservices/creditinstitute.yaml | 96 ++++++++++++++++ t2-deployment/t2-microservices/inventory.yaml | 93 +++++++++++++++ .../t2-microservices/kustomization.yaml | 14 +++ .../t2-microservices/orchestrator.yaml | 83 ++++++++++++++ t2-deployment/t2-microservices/order.yaml | 85 ++++++++++++++ t2-deployment/t2-microservices/payment.yaml | 89 +++++++++++++++ .../t2-microservices/postgres_inventory.yaml | 83 ++++++++++++++ .../postgres_orchestrator.yaml | 83 ++++++++++++++ t2-deployment/t2-microservices/ui.yaml | 69 +++++++++++ t2-deployment/t2-microservices/uibackend.yaml | 83 ++++++++++++++ 17 files changed, 1044 insertions(+), 28 deletions(-) create mode 100644 t2-deployment/mongodb/mongo-values.yaml create mode 100755 t2-deployment/start-microservices.sh create mode 100755 t2-deployment/stop-microservices.sh create mode 100644 t2-deployment/t2-microservices/cart.yaml create mode 100644 t2-deployment/t2-microservices/cdcservice.yaml create mode 100644 t2-deployment/t2-microservices/creditinstitute.yaml create mode 100644 t2-deployment/t2-microservices/inventory.yaml create mode 100644 t2-deployment/t2-microservices/kustomization.yaml create mode 100644 t2-deployment/t2-microservices/orchestrator.yaml create mode 100644 t2-deployment/t2-microservices/order.yaml create mode 100644 t2-deployment/t2-microservices/payment.yaml create mode 100644 t2-deployment/t2-microservices/postgres_inventory.yaml create mode 100644 t2-deployment/t2-microservices/postgres_orchestrator.yaml create mode 100644 t2-deployment/t2-microservices/ui.yaml create mode 100644 t2-deployment/t2-microservices/uibackend.yaml diff --git a/clara-app/version.txt b/clara-app/version.txt index cb174d5..d2d61a7 100644 --- a/clara-app/version.txt +++ b/clara-app/version.txt @@ -1 +1 @@ -1.2.1 \ No newline at end of file +1.2.2 \ No newline at end of file diff --git a/docs/content/validation/t2-reference-architecture/index.md b/docs/content/validation/t2-reference-architecture/index.md index 96d9b42..3c2ed7a 100644 --- a/docs/content/validation/t2-reference-architecture/index.md +++ b/docs/content/validation/t2-reference-architecture/index.md @@ -93,33 +93,14 @@ The setup consists of the Gropius setup, the minikube setup, the T2-Project setu kubectl create ns clara ``` -## 3. T2-Project Configuration -- Clone the [T2-Project's devops subproject](https://github.com/t2-project/devops). - ```sh - git clone https://github.com/t2-project/devops.git - ``` - or - ```sh - git clone git@github.com:t2-project/devops.git - ``` -- Navigate to the directory `devops/k8s/t2-microservices/base`, where you find the deployment manifests for the T2-Project microservices. -- Insert the following into each of the `Deployment` part of the respective yaml file (except for the postgres services): - ```yaml - spec: - template: - metadata: - annotations: - instrumentation.opentelemetry.io/inject-java: "true" - ``` -- You will deploy the microservices below in [5. Deploy T2-Project](#5-deploy-t2-project) **after** the CLARA setup. -## 4. CLARA Setup +## 3. CLARA Setup - Setup CLARA on your local machine as described in steps 1 and 2 on the [setup page](../../setup/index.md#1-prerequisites). * Use `clara` as the target namespace. - * In step 2.1 you can skip the injection of the annotations into the deployments, as you have already done this. + * In step 2.1 you can skip the injection of the annotations into the deployments, as we prepared this for the recreation of the T2-Project recovery. - **DO NOT RUN CLARA YET**, as the T2-Project is not yet deployed. -## 5. Deploy T2-Project -- In the T2-Project's `devops`-repository navigate back to `devops/k8s` and execute the following to install the T2-Project into the cluster: +## 4. Deploy T2-Project +- In the CLARA-repository change directory to `t2-deployment` and execute the following to install the T2-Project into the cluster: ```sh chmod +x ./start-microservices.sh ./start-microservices.sh clara @@ -129,8 +110,8 @@ The setup consists of the Gropius setup, the minikube setup, the T2-Project setu - For further questions regarding the T2-Project, check the official [deployment instructions](https://t2-documentation.readthedocs.io/en/latest/microservices/deploy.html). -## 6. Execution -### 6.1 Create Traffic +## 5. Execution +### 5.1 Create Traffic - Create traffic during the execution by manually clicking around the web shop. - To do that, create a port forward to the T2-Project UI from your shell: ```sh @@ -138,12 +119,12 @@ The setup consists of the Gropius setup, the minikube setup, the T2-Project setu ``` - Open the shop under http://localhost:7000/ui/products and click around the shop and order some tea to create traffic. -### 6.2 Execute CLARA +### 5.2 Execute CLARA - Execute CLARA as described in step 3 on the [setup page](../../setup/index.md#3-run-clara). - You can use the default config as provided. No need to change anything. - Check the CLARA logs during execution and ensure spans are coming in, when clicking around the web shop. -### 6.3 Visit the results +### 5.3 Visit the results - CLARA should now execute without any issues. - If so, in the end open the Gropius UI under http://localhost:4200 and open your project. - You should see the recovered architecture of the T2-Project in the UI now. \ No newline at end of file diff --git a/t2-deployment/mongodb/mongo-values.yaml b/t2-deployment/mongodb/mongo-values.yaml new file mode 100644 index 0000000..5480dd8 --- /dev/null +++ b/t2-deployment/mongodb/mongo-values.yaml @@ -0,0 +1,29 @@ + +auth: + enabled: false + +resources: + requests: + cpu: 150m + memory: 150Mi +# limits: +# cpu: 500m +# memory: 500Mi + +# Liveness and readiness probes cause high CPU usage (2x 10%) +# Therefore we disable it for now +# See following issue for more information: https://github.com/bitnami/charts/issues/10264 +livenessProbe: + enabled: false + # initialDelaySeconds: 30 + # periodSeconds: 20 + # timeoutSeconds: 10 + # failureThreshold: 6 + # successThreshold: 1 +readinessProbe: + enabled: false + # initialDelaySeconds: 5 + # periodSeconds: 20 + # timeoutSeconds: 10 + # failureThreshold: 6 + # successThreshold: 1 diff --git a/t2-deployment/start-microservices.sh b/t2-deployment/start-microservices.sh new file mode 100755 index 0000000..97a698b --- /dev/null +++ b/t2-deployment/start-microservices.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Documentation: https://t2-documentation.readthedocs.io/en/latest/microservices/deploy.html + +MY_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# If an argument is given, use it as the namespace +if [ $# -gt 0 ]; then + NAMESPACE=$1 +else + NAMESPACE="default" +fi + +if [ $NAMESPACE != "default" ]; then + kubectl create namespace $NAMESPACE --dry-run=client -o yaml | kubectl apply -f - +fi + +helm repo add bitnami https://charts.bitnami.com/bitnami +helm repo update +helm install mongo-cart -f $MY_DIR/mongodb/mongo-values.yaml bitnami/mongodb -n $NAMESPACE +helm install mongo-order -f $MY_DIR/mongodb/mongo-values.yaml bitnami/mongodb -n $NAMESPACE +helm install kafka bitnami/kafka --version 18.5.0 --set replicaCount=1 -n $NAMESPACE + +kubectl apply -k $MY_DIR/t2-microservices/ -n $NAMESPACE diff --git a/t2-deployment/stop-microservices.sh b/t2-deployment/stop-microservices.sh new file mode 100755 index 0000000..9ae11f0 --- /dev/null +++ b/t2-deployment/stop-microservices.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +MY_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +if [ $# -gt 0 ]; then + NAMESPACE=$1 +else + NAMESPACE="default" +fi + +kubectl delete -k $MY_DIR/t2-microservices/base/ -n $NAMESPACE + +helm uninstall mongo-cart -n $NAMESPACE +helm uninstall mongo-order -n $NAMESPACE +helm uninstall kafka -n $NAMESPACE + +if [ $NAMESPACE != "default" ]; then + kubectl delete namespace $NAMESPACE +fi diff --git a/t2-deployment/t2-microservices/cart.yaml b/t2-deployment/t2-microservices/cart.yaml new file mode 100644 index 0000000..6429ce0 --- /dev/null +++ b/t2-deployment/t2-microservices/cart.yaml @@ -0,0 +1,77 @@ +apiVersion: v1 +kind: Service +metadata: + name: cart + labels: + app.kubernetes.io/name: cart + app.kubernetes.io/instance: cart + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + annotations: + prometheus.io/scrape: "true" +spec: + selector: + app.kubernetes.io/instance: cart + app.kubernetes.io/part-of: t2-microservices + ports: + - port: 80 + targetPort: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: cart + labels: + app.kubernetes.io/name: cart + app.kubernetes.io/instance: cart + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices +spec: + selector: + matchLabels: + app.kubernetes.io/instance: cart + app.kubernetes.io/part-of: t2-microservices + template: + metadata: + annotations: + instrumentation.opentelemetry.io/inject-java: "true" + labels: + app.kubernetes.io/name: cart + app.kubernetes.io/instance: cart + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + spec: + containers: + - name: cart + imagePullPolicy: Always + env: + - name: MONGO_HOST + value: mongo-cart-mongodb + - name: T2_CART_TTL + value: "0" + - name: T2_CART_TASKRATE + value: "0" + - name: T2_JAEGER_ENABLED + value: "FALSE" + - name: T2_JAEGER_HOST + value: simplest-agent #todo + image: t2project/cart:main + ports: + - containerPort: 8080 + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 250m + memory: 250Mi + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 5 + restartPolicy: Always diff --git a/t2-deployment/t2-microservices/cdcservice.yaml b/t2-deployment/t2-microservices/cdcservice.yaml new file mode 100644 index 0000000..c3ee130 --- /dev/null +++ b/t2-deployment/t2-microservices/cdcservice.yaml @@ -0,0 +1,108 @@ +apiVersion: v1 +kind: Service +metadata: + name: cdcservice + labels: + app.kubernetes.io/name: cdcservice + app.kubernetes.io/instance: cdcservice + app.kubernetes.io/component: middleware + app.kubernetes.io/version: 0.16.0.RELEASE + app.kubernetes.io/part-of: t2-microservices +spec: + ports: + - name: "8099" + port: 8099 + targetPort: 8080 + selector: + app.kubernetes.io/instance: cdcservice + app.kubernetes.io/part-of: t2-microservices +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: cdcservice + labels: + app.kubernetes.io/name: cdcservice + app.kubernetes.io/instance: cdcservice + app.kubernetes.io/component: middleware + app.kubernetes.io/version: 0.16.0.RELEASE + app.kubernetes.io/part-of: t2-microservices +spec: + selector: + matchLabels: + app.kubernetes.io/instance: cdcservice + app.kubernetes.io/part-of: t2-microservices + template: + metadata: + annotations: + instrumentation.opentelemetry.io/inject-java: "true" + labels: + app.kubernetes.io/name: cdcservice + app.kubernetes.io/instance: cdcservice + app.kubernetes.io/component: middleware + app.kubernetes.io/version: 0.16.0.RELEASE + app.kubernetes.io/part-of: t2-microservices + spec: + containers: + - name: cdcservice + image: eventuateio/eventuate-cdc-service:0.16.0.RELEASE + imagePullPolicy: Always + ports: + - containerPort: 8080 + env: + - name: JAVA_OPTS + value: -Xmx64m + - name: EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS + value: kafka:9092 + - name: EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING + value: kafka-zookeeper:2181 + - name: EVENTUATE_CDC_PIPELINE_PIPELINE1_TYPE + value: eventuate-tram + - name: EVENTUATE_CDC_PIPELINE_PIPELINE1_READER + value: reader1 + - name: EVENTUATE_CDC_PIPELINE_PIPELINE2_TYPE + value: eventuate-tram + - name: EVENTUATE_CDC_PIPELINE_PIPELINE2_READER + value: reader2 + - name: EVENTUATE_CDC_READER_READER1_TYPE + value: postgres-wal + - name: EVENTUATE_CDC_READER_READER1_DATASOURCEURL + value: jdbc:postgresql://postgres-orchestrator/eventuate + - name: EVENTUATE_CDC_READER_READER1_DATASOURCEUSERNAME + value: eventuate + - name: EVENTUATE_CDC_READER_READER1_DATASOURCEPASSWORD + value: eventuate + - name: EVENTUATE_CDC_READER_READER1_DATASOURCEDRIVERCLASSNAME + value: org.postgresql.Driver + - name: EVENTUATE_CDC_READER_READER1_LEADERSHIPLOCKPATH + value: /eventuate/cdc/leader/orchestrator + - name: EVENTUATE_CDC_READER_READER1_OUTBOXID + value: "1" + - name: EVENTUATE_CDC_READER_READER2_TYPE + value: postgres-wal + - name: EVENTUATE_CDC_READER_READER2_DATASOURCEURL + value: jdbc:postgresql://postgres-inventory/inventory + - name: EVENTUATE_CDC_READER_READER2_DATASOURCEUSERNAME + value: inventory + - name: EVENTUATE_CDC_READER_READER2_DATASOURCEPASSWORD + value: inventory + - name: EVENTUATE_CDC_READER_READER2_DATASOURCEDRIVERCLASSNAME + value: org.postgresql.Driver + - name: EVENTUATE_CDC_READER_READER2_LEADERSHIPLOCKPATH + value: /eventuate/cdc/leader/inventory_service + - name: EVENTUATE_CDC_READER_READER2_OUTBOXID + value: "2" + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 250m + memory: 250Mi + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 5 + restartPolicy: Always diff --git a/t2-deployment/t2-microservices/creditinstitute.yaml b/t2-deployment/t2-microservices/creditinstitute.yaml new file mode 100644 index 0000000..6b8be86 --- /dev/null +++ b/t2-deployment/t2-microservices/creditinstitute.yaml @@ -0,0 +1,96 @@ +apiVersion: v1 +kind: Service +metadata: + name: creditinstitute + labels: + app.kubernetes.io/name: creditinstitute + app.kubernetes.io/instance: creditinstitute + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + annotations: + prometheus.io/scrape: "true" +spec: + selector: + app.kubernetes.io/instance: creditinstitute + app.kubernetes.io/part-of: t2-microservices + ports: + - port: 80 + targetPort: 8080 +# --- +# apiVersion: v1 +# kind: Service +# metadata: +# name: creditinstitute-solomon +# labels: +# app.kubernetes.io/name: creditinstitute +# app.kubernetes.io/component: backend +# app.kubernetes.io/version: "1.3" +# app.kubernetes.io/part-of: t2-microservices +# monitoring: "true" +# solomonTarget: "true" +# # annotations: +# # prometheus.io/scrape: "true" +# # prometheus.io/path: /metrics +# # prometheus.io/port: "5000" +# spec: +# selector: +# app.kubernetes.io/instance: creditinstitute +# app.kubernetes.io/part-of: t2-microservices +# ports: +# - protocol: TCP +# name: http +# port: 80 +# targetPort: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: creditinstitute + labels: + app.kubernetes.io/name: creditinstitute + app.kubernetes.io/instance: creditinstitute + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices +spec: + selector: + matchLabels: + app.kubernetes.io/instance: creditinstitute + app.kubernetes.io/part-of: t2-microservices + template: + metadata: + annotations: + instrumentation.opentelemetry.io/inject-java: "true" + labels: + app.kubernetes.io/name: creditinstitute + app.kubernetes.io/instance: creditinstitute + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + spec: + containers: + - name: creditinstitute + imagePullPolicy: Always + env: + - name: T2_JAEGER_ENABLED + value: "FALSE" + - name: T2_JAEGER_HOST + value: simplest-agent #todo + image: t2project/creditinstitute:main + ports: + - containerPort: 8080 + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 250m + memory: 250Mi + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 5 + restartPolicy: Always diff --git a/t2-deployment/t2-microservices/inventory.yaml b/t2-deployment/t2-microservices/inventory.yaml new file mode 100644 index 0000000..94fe083 --- /dev/null +++ b/t2-deployment/t2-microservices/inventory.yaml @@ -0,0 +1,93 @@ +apiVersion: v1 +kind: Service +metadata: + name: inventory + labels: + app.kubernetes.io/name: inventory + app.kubernetes.io/instance: inventory + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + annotations: + prometheus.io/scrape: "true" +spec: + selector: + app.kubernetes.io/instance: inventory + app.kubernetes.io/part-of: t2-microservices + ports: + - port: 80 + targetPort: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: inventory + labels: + app.kubernetes.io/name: inventory + app.kubernetes.io/instance: inventory + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices +spec: + selector: + matchLabels: + app.kubernetes.io/instance: inventory + app.kubernetes.io/part-of: t2-microservices + template: + metadata: + annotations: + instrumentation.opentelemetry.io/inject-java: "true" + labels: + app.kubernetes.io/name: inventory + app.kubernetes.io/instance: inventory + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + spec: + containers: + - name: inventory + imagePullPolicy: Always + env: + - name: EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS + value: kafka:9092 + - name: EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING + value: kafka-zookeeper:2181 + - name: T2_INVENTORY_SIZE + value: "25" + - name: T2_INVENTORY_TASKRATE + value: "0" + - name: T2_INVENTORY_TTL + value: "0" + - name: T2_INVENTORY_SET_UNITS_TO_MAX + value: "FALSE" + - name: SPRING_DATASOURCE_DRIVER_CLASS_NAME + value: org.postgresql.Driver + - name: SPRING_DATASOURCE_PASSWORD + value: inventory + - name: SPRING_DATASOURCE_URL + value: jdbc:postgresql://postgres-inventory/inventory + - name: SPRING_DATASOURCE_USERNAME + value: inventory + - name: SPRING_PROFILES_ACTIVE + value: saga + - name: T2_JAEGER_ENABLED + value: "FALSE" + - name: T2_JAEGER_HOST + value: simplest-agent #todo + image: t2project/inventory:main + ports: + - containerPort: 8080 + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 250m + memory: 250Mi + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 5 + restartPolicy: Always diff --git a/t2-deployment/t2-microservices/kustomization.yaml b/t2-deployment/t2-microservices/kustomization.yaml new file mode 100644 index 0000000..489241e --- /dev/null +++ b/t2-deployment/t2-microservices/kustomization.yaml @@ -0,0 +1,14 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- cart.yaml +- cdcservice.yaml +- creditinstitute.yaml +- inventory.yaml +- orchestrator.yaml +- order.yaml +- payment.yaml +- postgres_inventory.yaml +- postgres_orchestrator.yaml +- ui.yaml +- uibackend.yaml diff --git a/t2-deployment/t2-microservices/orchestrator.yaml b/t2-deployment/t2-microservices/orchestrator.yaml new file mode 100644 index 0000000..fd3659a --- /dev/null +++ b/t2-deployment/t2-microservices/orchestrator.yaml @@ -0,0 +1,83 @@ +apiVersion: v1 +kind: Service +metadata: + name: orchestrator + labels: + app.kubernetes.io/name: orchestrator + app.kubernetes.io/instance: orchestrator + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + annotations: + prometheus.io/scrape: "true" +spec: + selector: + app.kubernetes.io/instance: orchestrator + app.kubernetes.io/part-of: t2-microservices + ports: + - port: 80 + targetPort: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: orchestrator + labels: + app.kubernetes.io/name: orchestrator + app.kubernetes.io/instance: orchestrator + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices +spec: + selector: + matchLabels: + app.kubernetes.io/instance: orchestrator + app.kubernetes.io/part-of: t2-microservices + template: + metadata: + annotations: + instrumentation.opentelemetry.io/inject-java: "true" + labels: + app.kubernetes.io/name: orchestrator + app.kubernetes.io/instance: orchestrator + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + spec: + containers: + - name: orchestrator + imagePullPolicy: Always + env: + - name: EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS + value: kafka:9092 + - name: EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING + value: kafka-zookeeper:2181 + - name: SPRING_DATASOURCE_DRIVER_CLASS_NAME + value: org.postgresql.Driver + - name: SPRING_DATASOURCE_PASSWORD + value: eventuate + - name: SPRING_DATASOURCE_URL + value: jdbc:postgresql://postgres-orchestrator/eventuate + - name: SPRING_DATASOURCE_USERNAME + value: eventuate + - name: T2_JAEGER_ENABLED + value: "FALSE" + - name: T2_JAEGER_HOST + value: simplest-agent #todo + image: t2project/orchestrator:main + ports: + - containerPort: 8080 + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 250m + memory: 250Mi + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 5 + restartPolicy: Always diff --git a/t2-deployment/t2-microservices/order.yaml b/t2-deployment/t2-microservices/order.yaml new file mode 100644 index 0000000..685d4a1 --- /dev/null +++ b/t2-deployment/t2-microservices/order.yaml @@ -0,0 +1,85 @@ +apiVersion: v1 +kind: Service +metadata: + name: order + labels: + app.kubernetes.io/name: order + app.kubernetes.io/instance: order + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + annotations: + prometheus.io/scrape: "true" +spec: + ports: + - port: 80 + targetPort: 8080 + selector: + app.kubernetes.io/instance: order + app.kubernetes.io/part-of: t2-microservices +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: order + labels: + app.kubernetes.io/name: order + app.kubernetes.io/instance: order + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices +spec: + selector: + matchLabels: + app.kubernetes.io/instance: order + app.kubernetes.io/part-of: t2-microservices + template: + metadata: + annotations: + instrumentation.opentelemetry.io/inject-java: "true" + labels: + app.kubernetes.io/name: order + app.kubernetes.io/instance: order + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + spec: + containers: + - name: order + imagePullPolicy: Always + env: + - name: EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS + value: kafka:9092 + - name: EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING + value: kafka-zookeeper:2181 + - name: MONGO_HOST + value: mongo-order-mongodb + - name: SPRING_DATASOURCE_DRIVER_CLASS_NAME + value: org.postgresql.Driver + - name: SPRING_DATASOURCE_PASSWORD + value: eventuate + - name: SPRING_DATASOURCE_URL + value: jdbc:postgresql://postgres-orchestrator/eventuate + - name: SPRING_DATASOURCE_USERNAME + value: eventuate + - name: T2_JAEGER_ENABLED + value: "FALSE" + - name: T2_JAEGER_HOST + value: simplest-agent #todo + image: t2project/order:main + ports: + - containerPort: 8080 + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 250m + memory: 250Mi + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 5 + restartPolicy: Always diff --git a/t2-deployment/t2-microservices/payment.yaml b/t2-deployment/t2-microservices/payment.yaml new file mode 100644 index 0000000..7b79d37 --- /dev/null +++ b/t2-deployment/t2-microservices/payment.yaml @@ -0,0 +1,89 @@ +apiVersion: v1 +kind: Service +metadata: + name: payment + labels: + app.kubernetes.io/name: payment + app.kubernetes.io/instance: payment + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + annotations: + prometheus.io/scrape: "true" +spec: + ports: + - port: 80 + targetPort: 8080 + selector: + app.kubernetes.io/instance: payment + app.kubernetes.io/part-of: t2-microservices +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: payment + labels: + app.kubernetes.io/name: payment + app.kubernetes.io/instance: payment + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices +spec: + selector: + matchLabels: + app.kubernetes.io/instance: payment + app.kubernetes.io/part-of: t2-microservices + template: + metadata: + annotations: + instrumentation.opentelemetry.io/inject-java: "true" + labels: + app.kubernetes.io/name: payment + app.kubernetes.io/instance: payment + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + spec: + containers: + - name: payment + image: t2project/payment:main + ports: + - containerPort: 8080 + imagePullPolicy: Always + env: + - name: EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS + value: kafka:9092 + - name: EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING + value: kafka-zookeeper:2181 + - name: SPRING_DATASOURCE_DRIVER_CLASS_NAME + value: org.postgresql.Driver + - name: SPRING_DATASOURCE_PASSWORD + value: eventuate + - name: SPRING_DATASOURCE_URL + value: jdbc:postgresql://postgres-orchestrator/eventuate + - name: SPRING_DATASOURCE_USERNAME + value: eventuate + - name: T2_PAYMENT_PROVIDER_ENABLED + value: "TRUE" + - name: T2_PAYMENT_PROVIDER_DUMMY_URL + value: http://creditinstitute/pay + - name: T2_PAYMENT_PROVIDER_TIMEOUT + value: "5" + - name: T2_JAEGER_ENABLED + value: "FALSE" + - name: T2_JAEGER_HOST + value: simplest-agent #todo + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 250m + memory: 250Mi + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 5 + restartPolicy: Always diff --git a/t2-deployment/t2-microservices/postgres_inventory.yaml b/t2-deployment/t2-microservices/postgres_inventory.yaml new file mode 100644 index 0000000..e362c3d --- /dev/null +++ b/t2-deployment/t2-microservices/postgres_inventory.yaml @@ -0,0 +1,83 @@ +apiVersion: v1 +kind: Service # headless +metadata: + name: postgres-inventory + labels: + app.kubernetes.io/name: eventuate-tram-sagas-postgres + app.kubernetes.io/instance: postgres-inventory + app.kubernetes.io/component: database + app.kubernetes.io/version: 0.23.0.RELEASE + app.kubernetes.io/part-of: t2-microservices +spec: + ports: + - port: 5432 + targetPort: 5432 + clusterIP: None + selector: + app.kubernetes.io/instance: postgres-inventory + app.kubernetes.io/part-of: t2-microservices +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: postgres-inventory + labels: + app.kubernetes.io/name: eventuate-tram-sagas-postgres + app.kubernetes.io/instance: postgres-inventory + app.kubernetes.io/component: database + app.kubernetes.io/version: 0.23.0.RELEASE + app.kubernetes.io/part-of: t2-microservices +spec: + serviceName: postgres-inventory + selector: + matchLabels: + app.kubernetes.io/instance: postgres-inventory + app.kubernetes.io/part-of: t2-microservices + template: + metadata: + labels: + app.kubernetes.io/name: eventuate-tram-sagas-postgres + app.kubernetes.io/instance: postgres-inventory + app.kubernetes.io/component: database + app.kubernetes.io/version: 0.23.0.RELEASE + app.kubernetes.io/part-of: t2-microservices + spec: + containers: + - name: postgres + image: eventuateio/eventuate-tram-sagas-postgres:0.23.0.RELEASE + env: + - name: POSTGRES_DB + value: inventory + - name: POSTGRES_PASSWORD + value: inventory + - name: POSTGRES_USER + value: inventory + - name: USE_DB_ID + value: "true" + args: + - -c + - max_connections=1000 # default: 100 + - -c + - shared_buffers=256MB # default: 128MB + ports: + - containerPort: 5432 + volumeMounts: + - name: datadir + mountPath: /var/lib/postgresql/data + subPath: postgres + resources: + # limits: + # cpu: 500m + # memory: 500Mi + requests: + cpu: 150m + memory: 150Mi + restartPolicy: Always + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 1Gi diff --git a/t2-deployment/t2-microservices/postgres_orchestrator.yaml b/t2-deployment/t2-microservices/postgres_orchestrator.yaml new file mode 100644 index 0000000..eb00942 --- /dev/null +++ b/t2-deployment/t2-microservices/postgres_orchestrator.yaml @@ -0,0 +1,83 @@ +apiVersion: v1 +kind: Service # headless +metadata: + name: postgres-orchestrator + labels: + app.kubernetes.io/name: eventuate-tram-sagas-postgres + app.kubernetes.io/instance: postgres-orchestrator + app.kubernetes.io/component: database + app.kubernetes.io/version: 0.23.0.RELEASE + app.kubernetes.io/part-of: t2-microservices +spec: + ports: + - port: 5432 + targetPort: 5432 + clusterIP: None + selector: + app.kubernetes.io/instance: postgres-orchestrator + app.kubernetes.io/part-of: t2-microservices +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: postgres-orchestrator + labels: + app.kubernetes.io/name: eventuate-tram-sagas-postgres + app.kubernetes.io/instance: postgres-orchestrator + app.kubernetes.io/component: database + app.kubernetes.io/version: 0.23.0.RELEASE + app.kubernetes.io/part-of: t2-microservices +spec: + serviceName: postgres-orchestrator + selector: + matchLabels: + app.kubernetes.io/instance: postgres-orchestrator + app.kubernetes.io/part-of: t2-microservices + template: + metadata: + labels: + app.kubernetes.io/name: eventuate-tram-sagas-postgres + app.kubernetes.io/instance: postgres-orchestrator + app.kubernetes.io/component: database + app.kubernetes.io/version: 0.23.0.RELEASE + app.kubernetes.io/part-of: t2-microservices + spec: + containers: + - name: postgres + image: eventuateio/eventuate-tram-sagas-postgres:0.23.0.RELEASE + env: + - name: POSTGRES_DB + value: eventuate + - name: POSTGRES_PASSWORD + value: eventuate + - name: POSTGRES_USER + value: eventuate + - name: USE_DB_ID + value: "true" + args: + - -c + - max_connections=1000 # default: 100 + - -c + - shared_buffers=256MB # default: 128MB + ports: + - containerPort: 5432 + volumeMounts: + - name: datadir + mountPath: /var/lib/postgresql/data + subPath: postgres + resources: + # limits: + # cpu: 500m + # memory: 500Mi + requests: + cpu: 150m + memory: 150Mi + restartPolicy: Always + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 1Gi diff --git a/t2-deployment/t2-microservices/ui.yaml b/t2-deployment/t2-microservices/ui.yaml new file mode 100644 index 0000000..2312e15 --- /dev/null +++ b/t2-deployment/t2-microservices/ui.yaml @@ -0,0 +1,69 @@ +apiVersion: v1 +kind: Service +metadata: + name: ui + labels: + app.kubernetes.io/name: ui + app.kubernetes.io/instance: ui + app.kubernetes.io/component: frontend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + annotations: + prometheus.io/scrape: "true" +spec: + ports: + - port: 80 + targetPort: 8080 + selector: + app.kubernetes.io/instance: ui + app.kubernetes.io/part-of: t2-microservices +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ui + labels: + app.kubernetes.io/name: ui + app.kubernetes.io/instance: ui + app.kubernetes.io/component: frontend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices +spec: + selector: + matchLabels: + app.kubernetes.io/instance: ui + app.kubernetes.io/part-of: t2-microservices + template: + metadata: + annotations: + instrumentation.opentelemetry.io/inject-java: "true" + labels: + app.kubernetes.io/name: ui + app.kubernetes.io/instance: ui + app.kubernetes.io/component: frontend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + spec: + containers: + - name: ui + imagePullPolicy: Always + env: + - name: T2_UIBACKEND_URL + value: http://uibackend + image: t2project/ui:main + ports: + - containerPort: 8080 + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 250m + memory: 250Mi + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 5 + restartPolicy: Always diff --git a/t2-deployment/t2-microservices/uibackend.yaml b/t2-deployment/t2-microservices/uibackend.yaml new file mode 100644 index 0000000..37fa944 --- /dev/null +++ b/t2-deployment/t2-microservices/uibackend.yaml @@ -0,0 +1,83 @@ +apiVersion: v1 +kind: Service +metadata: + name: uibackend + labels: + app.kubernetes.io/name: uibackend + app.kubernetes.io/instance: uibackend + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + annotations: + prometheus.io/scrape: "true" +spec: + ports: + - port: 80 + targetPort: 8080 + selector: + app.kubernetes.io/instance: uibackend + app.kubernetes.io/part-of: t2-microservices +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: uibackend + labels: + app.kubernetes.io/name: uibackend + app.kubernetes.io/instance: uibackend + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices +spec: + selector: + matchLabels: + app.kubernetes.io/instance: uibackend + app.kubernetes.io/part-of: t2-microservices + template: + metadata: + annotations: + instrumentation.opentelemetry.io/inject-java: "true" + labels: + app.kubernetes.io/name: uibackend + app.kubernetes.io/instance: uibackend + app.kubernetes.io/component: backend + app.kubernetes.io/version: "1.3" + app.kubernetes.io/part-of: t2-microservices + spec: + containers: + - name: uibackend + imagePullPolicy: Always + env: + - name: T2_ORCHESTRATOR_URL + value: http://orchestrator/order + - name: T2_CART_URL + value: http://cart/cart + - name: T2_INVENTORY_URL + value: http://inventory/inventory + - name: T2_RESERVATION_ENDPOINT + value: reservation + - name: T2_COMPUTATION_SIMULATOR_ENABLED + value: "FALSE" + - name: T2_COMPUTATION_SIMULATOR_URL + value: http://computation-simulator/compute + - name: T2_JAEGER_ENABLED + value: "FALSE" + - name: T2_JAEGER_HOST + value: simplest-agent #todo + image: t2project/uibackend:main + ports: + - containerPort: 8080 + resources: + limits: + cpu: 500m + memory: 500Mi + requests: + cpu: 250m + memory: 250Mi + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 5 + restartPolicy: Always