From 7c0ffeb5acf6963e60e0970ea59588d4fd40552c Mon Sep 17 00:00:00 2001 From: Gregory DALMAR Date: Sat, 30 Apr 2022 02:01:05 +0200 Subject: [PATCH] feat: Add the live deployment overlay --- .../app/api/overlays/live/kustomization.yaml | 16 ++++++--- .../overlays/live/kustomization.yaml | 36 +++++++++++++++++++ .../overlays/live/use-live-routing.yaml | 26 ++++++++++++++ .../overlays/live/kustomization.yaml | 13 ++++++- .../overlays/live/use-live-routing.yaml | 9 +++++ 5 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 deploy/app/interface/overlays/live/kustomization.yaml create mode 100644 deploy/app/interface/overlays/live/use-live-routing.yaml create mode 100644 deploy/app/jwtks-service/overlays/live/use-live-routing.yaml diff --git a/deploy/app/api/overlays/live/kustomization.yaml b/deploy/app/api/overlays/live/kustomization.yaml index dcf69775..8b0b5d2f 100644 --- a/deploy/app/api/overlays/live/kustomization.yaml +++ b/deploy/app/api/overlays/live/kustomization.yaml @@ -3,15 +3,15 @@ kind: Kustomization namePrefix: prod- resources: - ../../base -namespace: staging +namespace: production images: - name: app newName: ghcr.io/42atomys/stud42 newTag: latest patchesStrategicMerge: -- ./use-next-primary-postgres.yaml -- ./use-next-routing.yaml +- ./use-live-primary-postgres.yaml +- ./use-live-routing.yaml replacements: - source: @@ -24,4 +24,12 @@ replacements: name: api-http fieldPaths: - spec.http.*.name - - spec.http.*.route.*.destination.host \ No newline at end of file + - spec.http.*.route.*.destination.host +- source: + kind: Deployment + fieldPath: metadata.labels.[app.kubernetes.io/version] + targets: + - select: + kind: Deployment + fieldPaths: + - spec.template.spec.containers.[name=service].env.[name=APP_VERSION].value \ No newline at end of file diff --git a/deploy/app/interface/overlays/live/kustomization.yaml b/deploy/app/interface/overlays/live/kustomization.yaml new file mode 100644 index 00000000..2b6d554c --- /dev/null +++ b/deploy/app/interface/overlays/live/kustomization.yaml @@ -0,0 +1,36 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namePrefix: prod- +resources: +- ../../base +namespace: production +images: +- name: app + newName: ghcr.io/42atomys/stud42 + newTag: latest + +patchesStrategicMerge: +- ./use-live-routing.yaml + +replacements: +- source: + kind: Service + name: interface-http + fieldPath: metadata.name + targets: + - select: + kind: VirtualService + name: interface-http + fieldPaths: + - spec.http.*.name + - spec.http.*.route.*.destination.host +- source: + kind: Deployment + name: interface + fieldPath: metadata.labels.[app.kubernetes.io/version] + targets: + - select: + kind: Deployment + name: interface + fieldPaths: + - spec.template.spec.containers.[name=interface].env.[name=APP_VERSION].value diff --git a/deploy/app/interface/overlays/live/use-live-routing.yaml b/deploy/app/interface/overlays/live/use-live-routing.yaml new file mode 100644 index 00000000..caf9e903 --- /dev/null +++ b/deploy/app/interface/overlays/live/use-live-routing.yaml @@ -0,0 +1,26 @@ +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + name: interface-http +spec: + hosts: + - s42.app + gateways: + - s42-app + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: interface +spec: + selector: {} + template: + spec: + containers: + - name: interface + env: + - name: NEXT_PUBLIC_GRAPHQL_API + value: https://s42.app/graphql + - name: NEXTAUTH_URL + value: https://s42.app \ No newline at end of file diff --git a/deploy/app/jwtks-service/overlays/live/kustomization.yaml b/deploy/app/jwtks-service/overlays/live/kustomization.yaml index 303fca2f..7e84fdbe 100644 --- a/deploy/app/jwtks-service/overlays/live/kustomization.yaml +++ b/deploy/app/jwtks-service/overlays/live/kustomization.yaml @@ -9,6 +9,9 @@ images: newName: ghcr.io/42atomys/stud42 newTag: latest +patchesStrategicMerge: +- ./use-live-routing.yaml + replacements: - source: kind: Service @@ -30,4 +33,12 @@ replacements: name: jwtks-service-http fieldPaths: - spec.http.*.name - - spec.http.*.route.*.destination.host \ No newline at end of file + - spec.http.*.route.*.destination.host +- source: + kind: Deployment + fieldPath: metadata.labels.[app.kubernetes.io/version] + targets: + - select: + kind: Deployment + fieldPaths: + - spec.template.spec.containers.[name=service].env.[name=APP_VERSION].value \ No newline at end of file diff --git a/deploy/app/jwtks-service/overlays/live/use-live-routing.yaml b/deploy/app/jwtks-service/overlays/live/use-live-routing.yaml new file mode 100644 index 00000000..ab9d3137 --- /dev/null +++ b/deploy/app/jwtks-service/overlays/live/use-live-routing.yaml @@ -0,0 +1,9 @@ +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + name: jwtks-service-http +spec: + hosts: + - s42.app + gateways: + - s42-app