From 9ca4563a550550e0cfb671c12dfc614a97b57f1d Mon Sep 17 00:00:00 2001
From: "Volodymyr Pienskoi [EPAM / GCP]" <volodymyr_pienskoi@epam.com>
Date: Mon, 14 Nov 2022 15:33:39 +0000
Subject: [PATCH] GONRG-5835: Merge GCP helms to the common one

---
 .gitlab-ci.yml                                |   3 +
 devops/gcp/configmap/Chart.yaml               |  24 ---
 devops/gcp/configmap/README.md                | 155 ------------------
 .../templates/configmap-bootstrap.yml         |  18 --
 .../configmap/templates/legal-variables.yml   |  14 --
 devops/gcp/configmap/values.yaml              |  21 ---
 devops/gcp/deploy/README.md                   |  36 ++--
 .../templates/bootstrap-deployment.yaml       |  38 +++++
 .../deploy/templates/bootstrap-deployment.yml |  38 -----
 .../deploy/templates/configmap-bootstrap.yaml |  18 ++
 devops/gcp/deploy/templates/legal-deploy.yaml |  47 ++++++
 devops/gcp/deploy/templates/legal-deploy.yml  |  47 ------
 .../templates/legal-service-account.yaml      |   7 +
 .../templates/legal-service-account.yml       |   7 -
 .../{legal-service.yml => legal-service.yaml} |  10 +-
 .../gcp/deploy/templates/legal-variables.yaml |  14 ++
 ...service.yml => legal-virtual-service.yaml} |   6 +-
 devops/gcp/deploy/values.yaml                 |  10 ++
 18 files changed, 170 insertions(+), 343 deletions(-)
 delete mode 100644 devops/gcp/configmap/Chart.yaml
 delete mode 100644 devops/gcp/configmap/README.md
 delete mode 100644 devops/gcp/configmap/templates/configmap-bootstrap.yml
 delete mode 100644 devops/gcp/configmap/templates/legal-variables.yml
 delete mode 100644 devops/gcp/configmap/values.yaml
 create mode 100644 devops/gcp/deploy/templates/bootstrap-deployment.yaml
 delete mode 100644 devops/gcp/deploy/templates/bootstrap-deployment.yml
 create mode 100644 devops/gcp/deploy/templates/configmap-bootstrap.yaml
 create mode 100644 devops/gcp/deploy/templates/legal-deploy.yaml
 delete mode 100644 devops/gcp/deploy/templates/legal-deploy.yml
 create mode 100644 devops/gcp/deploy/templates/legal-service-account.yaml
 delete mode 100644 devops/gcp/deploy/templates/legal-service-account.yml
 rename devops/gcp/deploy/templates/{legal-service.yml => legal-service.yaml} (54%)
 create mode 100644 devops/gcp/deploy/templates/legal-variables.yaml
 rename devops/gcp/deploy/templates/{legal-virtual-service.yml => legal-virtual-service.yaml} (74%)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b71cdea2a..77adbab21 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -30,6 +30,9 @@ variables:
   IBM_HELM_CONFIG_PATH: devops/ibm/ibm-legal-config
   IBM_HELM_DEPLOY_PATH: devops/ibm/ibm-legal-deploy
 
+  # FIXME remove when all services are migrated to a single helm
+  OSDU_GCP_ENABLE_HELM_CONFIG: "false"
+
 include:
   - project: "osdu/platform/ci-cd-pipelines"
     file: "standard-setup.yml"
diff --git a/devops/gcp/configmap/Chart.yaml b/devops/gcp/configmap/Chart.yaml
deleted file mode 100644
index 3f0f7b646..000000000
--- a/devops/gcp/configmap/Chart.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-apiVersion: v2
-name: gcp-legal-configmap
-description: A Helm chart for Kubernetes
-
-# A chart can be either an 'application' or a 'library' chart.
-#
-# Application charts are a collection of templates that can be packaged into versioned archives
-# to be deployed.
-#
-# Library charts provide useful utilities or functions for the chart developer. They're included as
-# a dependency of application charts to inject those utilities and functions into the rendering
-# pipeline. Library charts do not define any templates and therefore cannot be deployed.
-type: application
-
-# This is the chart version. This version number should be incremented each time you make changes
-# to the chart and its templates, including the app version.
-# Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.1.0
-
-# This is the version number of the application being deployed. This version number should be
-# incremented each time you make changes to the application. Versions are not expected to
-# follow Semantic Versioning. They should reflect the version the application is using.
-# It is recommended to use it with quotes.
-appVersion: "1.16.0"
diff --git a/devops/gcp/configmap/README.md b/devops/gcp/configmap/README.md
deleted file mode 100644
index 2f6d1dbcf..000000000
--- a/devops/gcp/configmap/README.md
+++ /dev/null
@@ -1,155 +0,0 @@
-<!--- Configmap -->
-
-# Configmap helm chart
-
-## Introduction
-
-This chart bootstraps a configmap deployment on a [Kubernetes](https://kubernetes.io) cluster using [Helm](https://helm.sh) package manager.
-
-## Prerequisites
-
-The code was tested on **Kubernetes cluster** (v1.21.11) with **Istio** (1.12.6)
-  > Istio is installed with Istio Ingress Gateway
-
-- Kubernetes cluster version can be checked with the command:
-
-    `kubectl version --short | grep Server`
-
-    The output will be similar to the following:
-
-  ```console
-  Server Version: v1.21.11-gke.1100
-  ```
-
-- Istio version can be checked in different ways, it is out of scope for this README. You can find more information [here](https://istio.io/latest/docs/setup/install/).
-
-    The following command shows how to check version if Anthos Service Mesh is used:
-
-    `kubectl -n istio-system get pods -lapp=istiod -o=jsonpath='{.items[0].metadata.labels.istio\.io/rev}'`
-
-    The output will be similar to the following:
-
-  ```console
-  asm-1132-5
-  ```
-
-> It is possible to use other versions, but it hasn't been tested
-
-This example describes installation in **Development mode**:
-
-- In this mode helm chart is installed to the namespace **not labeled with Istio**.
-  > More information about labeling can be found [here](https://istio.io/latest/docs/setup/additional-setup/sidecar-injection) (Istio) or [here](https://cloud.google.com/service-mesh/docs/managed/select-a-release-channel#default-injection-labels) (Anthos Service Mesh)
-
-    You can find all labels for your namespace with the command:
-
-     `kubectl get namespace <namespace> -o jsonpath={.metadata.labels}`
-
-    The output shows that there are no any labels related to Istio:
-  
-    ```console
-    {"kubernetes.io/metadata.name":"default"}
-    ```
-
-    When the namespace is labeled with Istio, the output could be:
-
-    ```console
-    {"istio-injection":"enabled","kubernetes.io/metadata.name":"default"}
-    ```
-
-### Operation system
-
-The code works in Debian-based Linux (Debian 10 and Ubuntu 20.04) and Windows WSL 2. Also, it works but is not guaranteed in Google Cloud Shell. All other operating systems, including macOS, are not verified and supported.
-
-### Packages
-
-Packages are only needed for installation from a local computer.
-
-- **HELM** (version: v3.7.1 or higher) [helm](https://helm.sh/docs/intro/install/)
-
-    Helm version can be checked with the command:
-
-    `helm version --short`
-
-    The output will be similar to the following:
-
-  ```console
-  v3.7.1+gd141386
-  ```
-
-- **Kubectl** (version: v1.21.0 or higher) [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl)
-
-    Kubectl version can be checked with the command:
-
-    `kubectl version --short | grep Client`
-
-    The output will be similar to the following:
-
-  ```console
-  Client Version: v1.21.0
-  ```
-
-## Installation
-
-First you need to set variables in **values.yaml** file using any code editor. Some of the values are prefilled, but you need to specify some values as well. You can find more information about them below.
-
-### Common variables
-
-| Name | Description | Type | Default |Required |
-|------|-------------|------|---------|---------|
-**logLevel** | logging level | string | INFO | yes
-**springProfilesActive** | active spring profile | string | gcp | yes
-
-### Google Cloud variables
-
-| Name | Description | Type | Default |Required |
-|------|-------------|------|---------|---------|
-**acceptHttp** | accept Http traffic | string | true | yes
-**googleAudiences** | your Google Cloud client ID | string | - | yes
-
-> googleAudiences: If you are connected to Google Cloud console with `gcloud auth application-default login --no-browser` from your terminal, you can get your client_id using the command:
-
-```console
-cat ~/.config/gcloud/application_default_credentials.json | grep client_id
-```
-
-### Bootstrap variables
-
-| Name | Description | Type | Default |Required |
-|------|-------------|------|---------|---------|
-**dataPartitionId** | ID of data partition | string | - | yes
-**entitlementsHost** | Entitlements host URL | string | http://entitlements | yes
-**defaultLegalTag** | Default legal tag | string | default-data-tag| yes
-**legalHost** | Legal host URL | string | http://legal | yes
-
-### Config variables
-
-| Name | Description | Type | Default |Required |
-|------|-------------|------|---------|---------|
-**configmap** | configmap to be used | string | legal-config | yes
-**appName** | name of the app | string | legal | yes
-**onPremEnabled** | whether on-prem is enabled | boolean | false | yes
-**bootstrapEnabled** | whether bootstrap is enabled | boolean | false | yes
-
-### Install the helm chart
-
-Run this command from within this directory:
-
-```console
-helm install gcp-legal-configmap .
-```
-
-## Uninstalling the Chart
-
-To uninstall the helm deployment:
-
-```console
-helm uninstall gcp-legal-configmap
-```
-
-To delete secrets and PVCs:
-
-```console
-kubectl delete secret --all; kubectl delete pvc --all
-```
-
-[Move-to-Top](#configmap-helm-chart)
diff --git a/devops/gcp/configmap/templates/configmap-bootstrap.yml b/devops/gcp/configmap/templates/configmap-bootstrap.yml
deleted file mode 100644
index 0f51bf536..000000000
--- a/devops/gcp/configmap/templates/configmap-bootstrap.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-{{- if .Values.conf.bootstrapEnabled }}
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  labels:
-    app: "{{ .Values.conf.appName }}-bootstrap"
-  name: "{{ .Values.conf.configmap }}-bootstrap"
-  namespace: "{{ .Release.Namespace }}"
-data:
-  DATA_PARTITION_ID: "{{ .Values.data.dataPartitionId }}"
-  ENTITLEMENTS_HOST: "{{ .Values.data.entitlementsHost }}"
-  LEGAL_HOST: "{{ .Values.data.legalHost }}"
-  DEFAULT_LEGAL_TAG: "{{ .Values.data.defaultLegalTag }}"
-  ONPREM_ENABLED: "{{ .Values.conf.onPremEnabled }}"
-  {{- if not .Values.conf.onPremEnabled }}
-  GOOGLE_AUDIENCES: "{{ .Values.data.googleAudiences }}"
-  {{- end }}
-{{- end }}
diff --git a/devops/gcp/configmap/templates/legal-variables.yml b/devops/gcp/configmap/templates/legal-variables.yml
deleted file mode 100644
index c3dbfb7a1..000000000
--- a/devops/gcp/configmap/templates/legal-variables.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  labels:
-    app: "{{ .Values.conf.appName }}"
-  name: "{{ .Values.conf.configmap }}"
-  namespace: "{{ .Release.Namespace }}"
-data:
-  ACCEPT_HTTP: "{{ .Values.data.acceptHttp }}"
-  LOG_LEVEL: "{{ .Values.data.logLevel }}"
-  SPRING_PROFILES_ACTIVE: "{{ .Values.data.springProfilesActive }}"
-  {{- if not .Values.conf.onPremEnabled }}
-  GOOGLE_AUDIENCES: "{{ .Values.data.googleAudiences }}"
-  {{- end }}
diff --git a/devops/gcp/configmap/values.yaml b/devops/gcp/configmap/values.yaml
deleted file mode 100644
index 6ea247661..000000000
--- a/devops/gcp/configmap/values.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-# Default values for legal-configmap.
-# This is a YAML-formatted file.
-# Declare variables to be passed into your templates.
-
-data:
-  logLevel: "ERROR"
-  springProfilesActive: "gcp"
-  # gcp
-  acceptHttp: "true"
-  googleAudiences: ""
-  # bootstrap
-  dataPartitionId: ""
-  entitlementsHost: "http://entitlements"
-  defaultLegalTag: "default-data-tag"
-  legalHost: "http://legal"
-
-conf:
-  configmap: "legal-config"
-  appName: "legal"
-  onPremEnabled: false
-  bootstrapEnabled: false
diff --git a/devops/gcp/deploy/README.md b/devops/gcp/deploy/README.md
index dbd78a3b3..ba84e3922 100644
--- a/devops/gcp/deploy/README.md
+++ b/devops/gcp/deploy/README.md
@@ -92,26 +92,40 @@ Packages are only needed for installation from a local computer.
 
 First you need to set variables in **values.yaml** file using any code editor. Some of the values are prefilled, but you need to specify some values as well. You can find more information about them below.
 
-### Common variables
+### Configmap variables
 
 | Name | Description | Type | Default |Required |
 |------|-------------|------|---------|---------|
-**requestsCpu** | amount of requests CPU | string | 0.1 | yes
-**requestsMemory** | amount of requests memory| string | 384M | yes
-**limitsCpu** | CPU limit | string | 1 | yes
-**limitsMemory** | memory limit | string | 1G | yes
-**serviceAccountName** | name of your service account | string | legal | yes
-**imagePullPolicy** | when to pull image | string | IfNotPresent | yes
-**image** | your image name | string | - | yes
+**logLevel** | logging level | string | ERROR | yes
+**springProfilesActive** | active spring profile | string | gcp | yes
+**acceptHttp** | accept Http traffic | string | true | yes
+**googleAudiences** | your GCP client id | string | - | yes
+**dataPartitionId** | data partition id | string | - | yes
+**entitlementsHost** | Entitlements host URL | string | http://entitlements | yes
+**defaultLegalTag** | Default legal tag | string | default-data-tag| yes
+**legalHost** | Legal host URL | string | http://legal | yes
+
+> googleAudiences: If you are connected to GCP console with `gcloud auth application-default login --no-browser` from your terminal, you can get your client_id using the command:
+
+```console
+cat ~/.config/gcloud/application_default_credentials.json | grep client_id
+```
 
-### Bootstrap variables
+### Deployment variables
 
 | Name | Description | Type | Default |Required |
 |------|-------------|------|---------|---------|
+**requestsCpu** | amount of requests CPU | string | 0.1 | yes
+**requestsMemory** | amount of requests memory| string | 384M | yes
+**limitsCpu** | CPU limit | string | 1 | yes
+**limitsMemory** | memory limit | string | 1G | yes
 **bootstrapImage** | name of the bootstrap image | string | - | yes
-**bootstrapServiceAccountName** | name of the bootstrap SA | string | - | yes
+**bootstrapServiceAccountName** | name of the bootstrap service account | string | - | yes
+**serviceAccountName** | name of your service account | string | legal | yes
+**imagePullPolicy** | when to pull the image | string | IfNotPresent | yes
+**image** | path to the image in a registry | string | - | yes
 
-### Config variables
+### Configuration variables
 
 | Name | Description | Type | Default |Required |
 |------|-------------|------|---------|---------|
diff --git a/devops/gcp/deploy/templates/bootstrap-deployment.yaml b/devops/gcp/deploy/templates/bootstrap-deployment.yaml
new file mode 100644
index 000000000..63032f289
--- /dev/null
+++ b/devops/gcp/deploy/templates/bootstrap-deployment.yaml
@@ -0,0 +1,38 @@
+{{- if .Values.conf.bootstrapEnabled }}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  labels:
+    app: {{ printf "%s-bootstrap" .Values.conf.appName | quote }}
+  name: {{ printf "%s-bootstrap" .Values.conf.appName | quote }}
+  namespace: {{ .Release.Namespace | quote }}
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: {{ printf "%s-bootstrap" .Values.conf.appName | quote }}
+  template:
+    metadata:
+      labels:
+        app: {{ printf "%s-bootstrap" .Values.conf.appName | quote }}
+      annotations:
+        rollme: {{ randAlphaNum 5 | quote }}
+    spec:
+      containers:
+        - name: {{ printf "%s-bootstrap" .Values.conf.appName | quote }}
+          image: {{ .Values.data.bootstrapImage | quote }}
+          readinessProbe:
+            exec:
+              command:
+              - cat
+              - /tmp/bootstrap_ready
+          imagePullPolicy: {{ .Values.data.imagePullPolicy | quote }}
+          envFrom:
+          - configMapRef:
+              name: {{ printf "%s-bootstrap" .Values.conf.configmap | quote }}
+          {{- if .Values.conf.onPremEnabled }}
+          - secretRef:
+              name: {{ .Values.conf.bootstrapSecretName | quote }}
+          {{- end }}
+      serviceAccountName: {{ .Values.data.bootstrapServiceAccountName | quote }}
+{{- end }}
diff --git a/devops/gcp/deploy/templates/bootstrap-deployment.yml b/devops/gcp/deploy/templates/bootstrap-deployment.yml
deleted file mode 100644
index c4ecb6ed3..000000000
--- a/devops/gcp/deploy/templates/bootstrap-deployment.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-{{- if .Values.conf.bootstrapEnabled }}
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  labels:
-    app: "{{ .Values.conf.appName }}-bootstrap"
-  name: "{{ .Values.conf.appName }}-bootstrap"
-  namespace: "{{ .Release.Namespace }}"
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      app: "{{ .Values.conf.appName }}-bootstrap"
-  template:
-    metadata:
-      labels:
-        app: "{{ .Values.conf.appName }}-bootstrap"
-      annotations:
-        rollme: {{ randAlphaNum 5 | quote }}
-    spec:
-      containers:
-        - name: "{{ .Values.conf.appName }}-bootstrap"
-          image: "{{ .Values.data.bootstrapImage }}"
-          readinessProbe:
-            exec:
-              command:
-              - cat
-              - /tmp/bootstrap_ready
-          imagePullPolicy: "{{ .Values.data.imagePullPolicy }}"
-          envFrom:
-          - configMapRef:
-              name: "{{ .Values.conf.configmap }}-bootstrap"
-          {{- if .Values.conf.onPremEnabled }}
-          - secretRef:
-              name: "{{ .Values.conf.bootstrapSecretName }}"
-          {{- end }}
-      serviceAccountName: "{{ .Values.data.bootstrapServiceAccountName }}"
-{{- end }}
diff --git a/devops/gcp/deploy/templates/configmap-bootstrap.yaml b/devops/gcp/deploy/templates/configmap-bootstrap.yaml
new file mode 100644
index 000000000..69d88aabc
--- /dev/null
+++ b/devops/gcp/deploy/templates/configmap-bootstrap.yaml
@@ -0,0 +1,18 @@
+{{- if .Values.conf.bootstrapEnabled }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  labels:
+    app: {{ printf "%s-bootstrap" .Values.conf.appName | quote }}
+  name: {{ printf "%s-bootstrap" .Values.conf.configmap | quote }}
+  namespace: {{ .Release.Namespace | quote }}
+data:
+  DATA_PARTITION_ID: {{ .Values.data.dataPartitionId | quote }}
+  ENTITLEMENTS_HOST: {{ .Values.data.entitlementsHost | quote }}
+  LEGAL_HOST: {{ .Values.data.legalHost | quote }}
+  DEFAULT_LEGAL_TAG: {{ .Values.data.defaultLegalTag | quote }}
+  ONPREM_ENABLED: {{ .Values.conf.onPremEnabled | quote }}
+  {{- if not .Values.conf.onPremEnabled }}
+  GOOGLE_AUDIENCES: {{ .Values.data.googleAudiences | quote }}
+  {{- end }}
+{{- end }}
diff --git a/devops/gcp/deploy/templates/legal-deploy.yaml b/devops/gcp/deploy/templates/legal-deploy.yaml
new file mode 100644
index 000000000..0557b204a
--- /dev/null
+++ b/devops/gcp/deploy/templates/legal-deploy.yaml
@@ -0,0 +1,47 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  labels:
+    app: {{ .Values.conf.appName | quote }}
+  name: {{ .Values.conf.appName | quote }}
+  namespace: {{ .Release.Namespace | quote }}
+spec:
+  selector:
+    matchLabels:
+      app: {{ .Values.conf.appName | quote }}
+  replicas: 1
+  template:
+    metadata:
+      labels:
+        app: {{ .Values.conf.appName | quote }}
+      annotations:
+        rollme: {{ randAlphaNum 5 | quote }}
+    spec:
+      containers:
+      - name: {{ .Values.conf.appName | quote }}
+        image: {{ .Values.data.image | quote }}
+        imagePullPolicy: {{ .Values.data.imagePullPolicy | quote }}
+        envFrom:
+        - configMapRef:
+            name: {{ .Values.conf.configmap | quote }}
+        {{- if .Values.conf.onPremEnabled }}
+        - secretRef:
+            name: {{ .Values.conf.minioSecretName | quote }}
+        - secretRef:
+            name: {{ .Values.conf.postgresSecretName | quote }}
+        - secretRef:
+            name: {{ .Values.conf.rabbitmqSecretName | quote }}
+        {{- end }}
+        securityContext:
+          allowPrivilegeEscalation: false
+          runAsUser: 0
+        ports:
+        - containerPort: 8080
+        resources:
+          requests:
+            cpu: {{ .Values.data.requestsCpu | quote }}
+            memory: {{ .Values.data.requestsMemory | quote }}
+          limits:
+            cpu: {{ .Values.data.limitsCpu | quote }}
+            memory: {{ .Values.data.limitsMemory | quote }}
+      serviceAccountName: {{ .Values.data.serviceAccountName | quote }}
diff --git a/devops/gcp/deploy/templates/legal-deploy.yml b/devops/gcp/deploy/templates/legal-deploy.yml
deleted file mode 100644
index e5872a60d..000000000
--- a/devops/gcp/deploy/templates/legal-deploy.yml
+++ /dev/null
@@ -1,47 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  labels:
-    app: "{{ .Values.conf.appName }}"
-  name: "{{ .Values.conf.appName }}"
-  namespace: "{{ .Release.Namespace }}"
-spec:
-  selector:
-    matchLabels:
-      app: "{{ .Values.conf.appName }}"
-  replicas: 1
-  template:
-    metadata:
-      labels:
-        app: "{{ .Values.conf.appName }}"
-      annotations:
-        rollme: {{ randAlphaNum 5 | quote }}
-    spec:
-      containers:
-      - name: "{{ .Values.conf.appName }}"
-        image: "{{ .Values.data.image }}"
-        imagePullPolicy: "{{ .Values.data.imagePullPolicy }}"
-        envFrom:
-        - configMapRef:
-            name: "{{ .Values.conf.configmap }}"
-        {{- if .Values.conf.onPremEnabled }}
-        - secretRef:
-            name: "{{ .Values.conf.minioSecretName }}"
-        - secretRef:
-            name: "{{ .Values.conf.postgresSecretName }}"
-        - secretRef:
-            name: "{{ .Values.conf.rabbitmqSecretName }}"
-        {{- end }}
-        securityContext:
-          allowPrivilegeEscalation: false
-          runAsUser: 0
-        ports:
-        - containerPort: 8080
-        resources:
-          requests:
-            cpu: "{{ .Values.data.requestsCpu }}"
-            memory: "{{ .Values.data.requestsMemory }}"
-          limits:
-            cpu: "{{ .Values.data.limitsCpu }}"
-            memory: "{{ .Values.data.limitsMemory }}"
-      serviceAccountName: "{{ .Values.data.serviceAccountName }}"
diff --git a/devops/gcp/deploy/templates/legal-service-account.yaml b/devops/gcp/deploy/templates/legal-service-account.yaml
new file mode 100644
index 000000000..f0771985c
--- /dev/null
+++ b/devops/gcp/deploy/templates/legal-service-account.yaml
@@ -0,0 +1,7 @@
+{{- if .Values.conf.onPremEnabled }}
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: {{ .Values.data.serviceAccountName | quote }}
+  namespace: {{ .Release.Namespace | quote }}
+{{- end }}
diff --git a/devops/gcp/deploy/templates/legal-service-account.yml b/devops/gcp/deploy/templates/legal-service-account.yml
deleted file mode 100644
index 25fd74efb..000000000
--- a/devops/gcp/deploy/templates/legal-service-account.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-{{- if .Values.conf.onPremEnabled }}
-apiVersion: v1
-kind: ServiceAccount
-metadata:
-  name: "{{ .Values.data.serviceAccountName }}"
-  namespace: "{{ .Release.Namespace }}"
-{{- end }}
diff --git a/devops/gcp/deploy/templates/legal-service.yml b/devops/gcp/deploy/templates/legal-service.yaml
similarity index 54%
rename from devops/gcp/deploy/templates/legal-service.yml
rename to devops/gcp/deploy/templates/legal-service.yaml
index 0e9843b97..7647df549 100644
--- a/devops/gcp/deploy/templates/legal-service.yml
+++ b/devops/gcp/deploy/templates/legal-service.yaml
@@ -1,15 +1,15 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: "{{ .Values.conf.appName }}"
+  name: {{ .Values.conf.appName | quote }}
   {{- if not .Values.conf.onPremEnabled }}
   annotations:
     cloud.google.com/neg: '{"ingress": true}'
   {{- end }}
-  namespace: "{{ .Release.Namespace }}"
+  namespace: {{ .Release.Namespace | quote }}
   labels:
-    app: "{{ .Values.conf.appName }}"
-    service: "{{ .Values.conf.appName }}"
+    app: {{ .Values.conf.appName | quote }}
+    service: {{ .Values.conf.appName | quote }}
 spec:
   ports:
     - protocol: TCP
@@ -17,4 +17,4 @@ spec:
       targetPort: 8080
       name: http
   selector:
-    app: "{{ .Values.conf.appName }}"
+    app: {{ .Values.conf.appName | quote }}
diff --git a/devops/gcp/deploy/templates/legal-variables.yaml b/devops/gcp/deploy/templates/legal-variables.yaml
new file mode 100644
index 000000000..00d63c90c
--- /dev/null
+++ b/devops/gcp/deploy/templates/legal-variables.yaml
@@ -0,0 +1,14 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  labels:
+    app: {{ printf "%s-bootstrap" .Values.conf.appName | quote }}
+  name: {{ .Values.conf.configmap | quote }}
+  namespace: {{ .Release.Namespace | quote }}
+data:
+  ACCEPT_HTTP: {{ .Values.data.acceptHttp | quote }}
+  LOG_LEVEL: {{ .Values.data.logLevel | quote }}
+  SPRING_PROFILES_ACTIVE: {{ .Values.data.springProfilesActive | quote }}
+  {{- if not .Values.conf.onPremEnabled }}
+  GOOGLE_AUDIENCES: {{ .Values.data.googleAudiences | quote }}
+  {{- end }}
diff --git a/devops/gcp/deploy/templates/legal-virtual-service.yml b/devops/gcp/deploy/templates/legal-virtual-service.yaml
similarity index 74%
rename from devops/gcp/deploy/templates/legal-virtual-service.yml
rename to devops/gcp/deploy/templates/legal-virtual-service.yaml
index 2b4b78df6..9933ef577 100644
--- a/devops/gcp/deploy/templates/legal-virtual-service.yml
+++ b/devops/gcp/deploy/templates/legal-virtual-service.yaml
@@ -2,8 +2,8 @@
 apiVersion: networking.istio.io/v1alpha3
 kind: VirtualService
 metadata:
-  name: "{{ .Values.conf.appName }}"
-  namespace: "{{ .Release.Namespace }}"
+  name: {{ .Values.conf.appName | quote }}
+  namespace: {{ .Release.Namespace | quote }}
 spec:
   hosts:
     {{- if and .Values.conf.domain .Values.conf.onPremEnabled }}
@@ -23,5 +23,5 @@ spec:
         - destination:
             port:
               number: 80
-            host: "{{ .Values.conf.appName }}.{{ .Release.Namespace }}.svc.cluster.local"
+            host: {{ printf "%s.%s.svc.cluster.local" .Values.conf.appName .Release.Namespace | quote }}
 {{- end }}
diff --git a/devops/gcp/deploy/values.yaml b/devops/gcp/deploy/values.yaml
index 094b6ed85..a138a3526 100644
--- a/devops/gcp/deploy/values.yaml
+++ b/devops/gcp/deploy/values.yaml
@@ -3,6 +3,16 @@
 # Declare variables to be passed into your templates.
 
 data:
+  # configmaps
+  logLevel: "ERROR"
+  springProfilesActive: "gcp"
+  acceptHttp: "true"
+  googleAudiences: ""
+  dataPartitionId: ""
+  entitlementsHost: "http://entitlements"
+  defaultLegalTag: "default-data-tag"
+  legalHost: "http://legal"
+  # deployments
   requestsCpu: "0.1"
   requestsMemory: "384M"
   limitsCpu: "1"
-- 
GitLab