From 1f5dadeb63157141652c64493aef7edf8785d7fd Mon Sep 17 00:00:00 2001
From: "Volodymyr Pienskoi [EPAM / GCP]" <volodymyr_pienskoi@epam.com>
Date: Thu, 27 Oct 2022 14:05:43 +0000
Subject: [PATCH] GONRG-5806: Improve multi_partition_enabled in DF TF

---
 NOTICE                                                  | 9 +++++++--
 devops/gcp/configmap/README.md                          | 3 +--
 devops/gcp/configmap/templates/configmap-bootstrap.yml  | 5 -----
 devops/gcp/configmap/values.yaml                        | 1 -
 provider/partition-gcp/bootstrap/bootstrap_partition.sh | 6 +++---
 5 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/NOTICE b/NOTICE
index f0356fbe2..ab7d6b6fc 100644
--- a/NOTICE
+++ b/NOTICE
@@ -42,6 +42,7 @@ The following software have components provided under the terms of this license:
 - Maven Monitor (from https://repo1.maven.org/maven2/org/apache/maven/maven-monitor)
 - Maven Plugin Descriptor Model (from https://repo1.maven.org/maven2/org/apache/maven/maven-plugin-descriptor)
 - Maven Plugin Parameter Documenter API (from https://repo1.maven.org/maven2/org/apache/maven/maven-plugin-parameter-documenter)
+- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
@@ -506,6 +507,7 @@ The following software have components provided under the terms of this license:
 - Maven Repository Metadata Model (from https://repo1.maven.org/maven2/org/apache/maven/maven-repository-metadata)
 - Maven Settings (from https://repo1.maven.org/maven2/org/apache/maven/maven-settings)
 - Metrics Core (from https://repo1.maven.org/maven2/io/dropwizard/metrics/metrics-core)
+- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
@@ -737,6 +739,7 @@ The following software have components provided under the terms of this license:
 - Jakarta Activation API (from https://github.com/eclipse-ee4j/jaf, https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api)
 - Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
 - Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec)
+- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
@@ -760,6 +763,7 @@ Beerware
 ========================================================================
 The following software have components provided under the terms of this license:
 
+- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
@@ -785,6 +789,7 @@ CC-BY-4.0
 ========================================================================
 The following software have components provided under the terms of this license:
 
+- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
@@ -978,8 +983,6 @@ The following software have components provided under the terms of this license:
 ========================================================================
 JSON
 ========================================================================
-The following software have components provided under the terms of this license:
-
 - JSON in Java (from https://github.com/douglascrockford/JSON-java)
 
 ========================================================================
@@ -1053,6 +1056,7 @@ The following software have components provided under the terms of this license:
 - Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec)
 - Java Client Runtime for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java)
 - Java JWT (from http://www.jwt.io, https://github.com/auth0/java-jwt)
+- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java)
 - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
@@ -1207,6 +1211,7 @@ The following software have components provided under the terms of this license:
 - Bouncy Castle Provider (from http://www.bouncycastle.org/java.html, https://www.bouncycastle.org/java.html)
 - Guava: Google Core Libraries for Java (from http://code.google.com/p/guava-libraries, https://github.com/google/guava, https://repo1.maven.org/maven2/com/google/guava/guava)
 - HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
+- JSON in Java (from https://github.com/douglascrockford/JSON-java)
 - JTidy (from http://jtidy.sourceforge.net)
 - Joda-Time (from http://joda-time.sourceforge.net, http://www.joda.org/joda-time/, https://www.joda.org/joda-time/)
 - LatencyUtils (from http://latencyutils.github.io/LatencyUtils/)
diff --git a/devops/gcp/configmap/README.md b/devops/gcp/configmap/README.md
index fd2b4ff27..c65858ff5 100644
--- a/devops/gcp/configmap/README.md
+++ b/devops/gcp/configmap/README.md
@@ -120,7 +120,7 @@ cat ~/.config/gcloud/application_default_credentials.json | grep client_id
 |------|-------------|------|---------|---------|
 **partitionName** | name of the partition | string | partition | yes
 **dataPartitionId** | ID of data partition | string | - | yes
-**dataPartitionIdList** | List of data partitions | array of strings | [] | no
+**dataPartitionIdList** | List of data partitions - if not empty multipartition is enabled | array of strings | [] | no
 **datafierSa** | datafier service account | string | datafier | yes
 
 ### Bootstrap on-prem variables
@@ -137,7 +137,6 @@ cat ~/.config/gcloud/application_default_credentials.json | grep client_id
 **configmap** | configmap to be used | string | partition-config | yes
 **appName** | name of the app | string | partition | yes
 **onPremEnabled** | whether on-prem is enabled | boolean | false | yes
-**multiPartitionEnabled** | whether multipartition is enabled | boolean | false | yes
 
 ### Install the helm chart
 
diff --git a/devops/gcp/configmap/templates/configmap-bootstrap.yml b/devops/gcp/configmap/templates/configmap-bootstrap.yml
index 7da45e068..fba1927b0 100644
--- a/devops/gcp/configmap/templates/configmap-bootstrap.yml
+++ b/devops/gcp/configmap/templates/configmap-bootstrap.yml
@@ -24,9 +24,4 @@ data:
   SERVICE_ACCOUNT: {{ printf "%s@%s.iam.gserviceaccount.com" .Values.data.datafierSa .Values.data.projectId | quote }}
   AUDIENCES: "{{ .Values.data.googleAudiences }}"
   {{- end }}
-  {{- if .Values.conf.multiPartitionEnabled }}
   DATA_PARTITION_ID_LIST: {{ join "," .Values.data.dataPartitionIdList | quote }}
-  MULTI_PARTITON_ENABLED: "{{ .Values.conf.multiPartitionEnabled }}"
-  {{- else }}
-  MULTI_PARTITON_ENABLED: "{{ .Values.conf.multiPartitionEnabled }}"
-  {{- end }}
diff --git a/devops/gcp/configmap/values.yaml b/devops/gcp/configmap/values.yaml
index cd4e0b86c..0268164a1 100644
--- a/devops/gcp/configmap/values.yaml
+++ b/devops/gcp/configmap/values.yaml
@@ -21,4 +21,3 @@ conf:
   configmap: "partition-config"
   appName: "partition"
   onPremEnabled: false
-  multiPartitionEnabled: false
diff --git a/provider/partition-gcp/bootstrap/bootstrap_partition.sh b/provider/partition-gcp/bootstrap/bootstrap_partition.sh
index 8a471136d..b5f6d85d7 100644
--- a/provider/partition-gcp/bootstrap/bootstrap_partition.sh
+++ b/provider/partition-gcp/bootstrap/bootstrap_partition.sh
@@ -101,11 +101,11 @@ bootstrap_gcp() {
   fi
 }
 
-if [[ "${ENVIRONMENT}" == "anthos" && "${MULTI_PARTITON_ENABLED}" == "false" ]]; then
+if [[ "${ENVIRONMENT}" == "anthos" && "${DATA_PARTITION_ID_LIST}" == "" ]]; then
   bootstrap_anthos "${DATA_PARTITION_ID}" "${DATA_PARTITION_ID^^}"
-elif [[ "${ENVIRONMENT}" == "gcp" && "${MULTI_PARTITON_ENABLED}" == "false" ]]; then
+elif [[ "${ENVIRONMENT}" == "gcp" && "${DATA_PARTITION_ID_LIST}" == "" ]]; then
   bootstrap_gcp "${DATA_PARTITION_ID}" "${DATA_PARTITION_ID^^}"
-elif [[ "${ENVIRONMENT}" == "gcp" && "${MULTI_PARTITON_ENABLED}" == "true" ]]; then
+elif [[ "${ENVIRONMENT}" == "gcp" && "${DATA_PARTITION_ID_LIST}" != "" ]]; then
 
   IFS=',' read -ra PARTITIONS <<< "${DATA_PARTITION_ID_LIST}"
   PARTITIONS=("${DATA_PARTITION_ID}" "${PARTITIONS[@]}")
-- 
GitLab