From 66f7aac4108f40351c6d126573fe1ea05d3aca58 Mon Sep 17 00:00:00 2001 From: yingtingxu Date: Thu, 20 Jun 2024 09:17:15 +0800 Subject: [PATCH] Add kustomize production patches --- .../application/catalog-service/README.md | 9 +++++++ .../production/application-prod.yml | 5 ++++ .../production/kustomization.yml | 25 +++++++++++++++++++ .../catalog-service/production/patch-env.yml | 14 +++++++++++ .../production/patch-resources.yml | 16 ++++++++++++ .../production/patch-volumes.yml | 21 ++++++++++++++++ 6 files changed, 90 insertions(+) create mode 100644 mall-deployment/kubernetes/application/catalog-service/README.md create mode 100644 mall-deployment/kubernetes/application/catalog-service/production/application-prod.yml create mode 100644 mall-deployment/kubernetes/application/catalog-service/production/kustomization.yml create mode 100644 mall-deployment/kubernetes/application/catalog-service/production/patch-env.yml create mode 100644 mall-deployment/kubernetes/application/catalog-service/production/patch-resources.yml create mode 100644 mall-deployment/kubernetes/application/catalog-service/production/patch-volumes.yml diff --git a/mall-deployment/kubernetes/application/catalog-service/README.md b/mall-deployment/kubernetes/application/catalog-service/README.md new file mode 100644 index 0000000..eedc1ed --- /dev/null +++ b/mall-deployment/kubernetes/application/catalog-service/README.md @@ -0,0 +1,9 @@ +Output the Kustomize result + +```bash +cd ./staging +``` + +```bash +kubectl kustomize -o result.yml +``` \ No newline at end of file diff --git a/mall-deployment/kubernetes/application/catalog-service/production/application-prod.yml b/mall-deployment/kubernetes/application/catalog-service/production/application-prod.yml new file mode 100644 index 0000000..cd6fd21 --- /dev/null +++ b/mall-deployment/kubernetes/application/catalog-service/production/application-prod.yml @@ -0,0 +1,5 @@ +mall: + greeting: Welcome to the cloud native mall from a production Kubernetes environment! +spring: + config: + import: configtree:/workspace/secrets/*/ \ No newline at end of file diff --git a/mall-deployment/kubernetes/application/catalog-service/production/kustomization.yml b/mall-deployment/kubernetes/application/catalog-service/production/kustomization.yml new file mode 100644 index 0000000..31d601b --- /dev/null +++ b/mall-deployment/kubernetes/application/catalog-service/production/kustomization.yml @@ -0,0 +1,25 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - github.com/arch/cloud-native-mall/mall-catalog/k8s?ref=main + +patches: + - path: patch-env.yml + - path: patch-volumes.yml + - path: patch-resources.yml + +configMapGenerator: + - name: catalog-config + behavior: merge + files: + - application-prod.yml + +images: + - name: mall-catalog + newName: ghcr.io/arch/mall-catalog + newTag: latest + +replicas: + - name: catalog-service + count: 2 \ No newline at end of file diff --git a/mall-deployment/kubernetes/application/catalog-service/production/patch-env.yml b/mall-deployment/kubernetes/application/catalog-service/production/patch-env.yml new file mode 100644 index 0000000..750c486 --- /dev/null +++ b/mall-deployment/kubernetes/application/catalog-service/production/patch-env.yml @@ -0,0 +1,14 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: catalog-service +spec: + template: + spec: + containers: + - name: catalog-service + env: + - name: SPRING_PROFILES_ACTIVE + value: prod + - name: BPL_JVM_THREAD_COUNT + value: "100" \ No newline at end of file diff --git a/mall-deployment/kubernetes/application/catalog-service/production/patch-resources.yml b/mall-deployment/kubernetes/application/catalog-service/production/patch-resources.yml new file mode 100644 index 0000000..a5519cb --- /dev/null +++ b/mall-deployment/kubernetes/application/catalog-service/production/patch-resources.yml @@ -0,0 +1,16 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: catalog-service +spec: + template: + spec: + containers: + - name: catalog-service + resources: + requests: + memory: 756Mi + cpu: "0.1" + limits: + memory: 756Mi + cpu: "2" \ No newline at end of file diff --git a/mall-deployment/kubernetes/application/catalog-service/production/patch-volumes.yml b/mall-deployment/kubernetes/application/catalog-service/production/patch-volumes.yml new file mode 100644 index 0000000..bd88c4a --- /dev/null +++ b/mall-deployment/kubernetes/application/catalog-service/production/patch-volumes.yml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: catalog-service +spec: + template: + spec: + containers: + - name: catalog-service + volumeMounts: + - mountPath: /workspace/secrets/postgres + name: postgres-credentials-volume + - mountPath: /workspace/secrets/keycloak + name: keycloak-credentials-volume + volumes: + - name: postgres-credentials-volume + secret: + secretName: mall-postgres-catalog-credentials + - name: keycloak-credentials-volume + secret: + secretName: mall-keycloak-issuer-resourceserver-secret \ No newline at end of file