From 38799d540ffda6402f32541e5df8f6e9870b8697 Mon Sep 17 00:00:00 2001
From: Sanjeev Pellikoduku <SPellikoduku@slb.com>
Date: Tue, 7 Sep 2021 17:48:31 -0500
Subject: [PATCH] Add Virtual Service

---
 devops/azure/chart/helm-config.yaml           |  2 ++
 .../chart/templates/virtual-service.yaml      | 36 +++++++++++++++++++
 devops/azure/chart/values.yaml                |  2 ++
 3 files changed, 40 insertions(+)
 create mode 100644 devops/azure/chart/templates/virtual-service.yaml

diff --git a/devops/azure/chart/helm-config.yaml b/devops/azure/chart/helm-config.yaml
index 89157496f..d2c8d58c4 100644
--- a/devops/azure/chart/helm-config.yaml
+++ b/devops/azure/chart/helm-config.yaml
@@ -14,3 +14,5 @@ image:
   repository: #{container-registry}#.azurecr.io
   branch: #{ENVIRONMENT_NAME}#
   tag: #{Build.SourceVersion}#
+
+istioDnsHost: #{ISTIO_DNS_HOST}#
\ No newline at end of file
diff --git a/devops/azure/chart/templates/virtual-service.yaml b/devops/azure/chart/templates/virtual-service.yaml
new file mode 100644
index 000000000..8f80398a0
--- /dev/null
+++ b/devops/azure/chart/templates/virtual-service.yaml
@@ -0,0 +1,36 @@
+---
+# Source: /devops/azure/chart/templates/virtual-service.yaml
+apiVersion: networking.istio.io/v1alpha3
+kind: VirtualService
+metadata:
+  name: {{ .Chart.Name }}
+  namespace: osdu
+spec:
+  hosts:
+  - "{{ .Values.istioDnsHost }}"
+  gateways:
+  - istio-gateway
+  http:  
+  - match:
+    - uri:
+        prefix: "/api/{{ .Chart.Name }}/v2"
+    route:
+    - destination:
+        host: {{ .Chart.Name }}
+        port:
+          number: 80
+    corsPolicy:
+      maxAge: "60m"
+      allowCredentials: true
+      allowHeaders:
+      - Authorization
+      - Data-Partition-Id
+      - Correlation-Id
+      allowMethods:
+      - POST
+      - GET
+      - PUT
+      - PATCH
+      - DELETE
+      allowOrigins:
+      - prefix: "*" 
\ No newline at end of file
diff --git a/devops/azure/chart/values.yaml b/devops/azure/chart/values.yaml
index 7ad7ec09d..dc84d4810 100644
--- a/devops/azure/chart/values.yaml
+++ b/devops/azure/chart/values.yaml
@@ -21,3 +21,5 @@ image:
   repository: community.opengroup.org:5555/osdu/platform/system/indexer-service
   branch: master
   tag: latest
+
+istioDnsHost: ""
\ No newline at end of file
-- 
GitLab