Merge "[CORD-3003] Make XOS GUI optional (enabled by default)"
diff --git a/examples/candidate-tag-values.yaml b/examples/candidate-tag-values.yaml
index aa11d0c..18fa211 100644
--- a/examples/candidate-tag-values.yaml
+++ b/examples/candidate-tag-values.yaml
@@ -1,5 +1,4 @@
 ---
-
 # Copyright 2018-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,11 +18,14 @@
 # in xos-core chart
 xos_coreImage: 'xosproject/xos-core:candidate'
 xos_chameleonImage: 'xosproject/chameleon:candidate'
-xos_guiImage: 'xosproject/xos-gui:candidate'
 xos_toscaImage: 'xosproject/xos-tosca:candidate'
-xos_wsImage: 'xosproject/xos-ws:candidate'
 xos_api_testerImage: 'xosproject/xos-api-tester:candidate'
 
+# in xos-gui sub-chart required by xos-core chart
+xos-gui:
+  xos_guiImage: 'xosproject/xos-gui:candidate'
+  xos_wsImage: 'xosproject/xos-ws:candidate'
+
 # in rcord-lite chart
 rcord_synchronizerImage: "xosproject/rcord-synchronizer:candidate"
 
diff --git a/examples/test-images.yaml b/examples/test-images.yaml
new file mode 100644
index 0000000..787193c
--- /dev/null
+++ b/examples/test-images.yaml
@@ -0,0 +1,38 @@
+---
+# Copyright 2018-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Whitelist for use with imagebuilder, only images needed for api-test
+
+docker_image_whitelist:
+- xosproject/chameleon
+- xosproject/xos-base
+- xosproject/xos-client
+- xosproject/xos-core
+- xosproject/xos-libraries
+- xosproject/xos-tosca
+- xosproject/xos-synchronizer-base
+- xosproject/rcord-synchronizer
+- xosproject/volt-synchronizer
+- xosproject/vtn-synchronizer
+- xosproject/onos-synchronizer
+- xosproject/addressmanager-synchronizer
+- xosproject/vsg-hw-synchronizer
+- xosproject/kubernetes-synchronizer
+- xosproject/fabric-synchronizer
+- xosproject/xos-api-tester
+- node
+- postgres
+- redis
+
diff --git a/xos-core/templates/ws-configmap.yaml b/examples/test-values.yaml
similarity index 68%
copy from xos-core/templates/ws-configmap.yaml
copy to examples/test-values.yaml
index 7dcc72b..9127993 100644
--- a/xos-core/templates/ws-configmap.yaml
+++ b/examples/test-values.yaml
@@ -1,5 +1,5 @@
 ---
-# Copyright 2017-present Open Networking Foundation
+# Copyright 2018-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -13,13 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: xos-ws
-  labels:
-    {{- include "xos-core.release_labels" . | indent 4 }}
-data:
-  config: |
-{{ include "xos-ws.gateway_config" . | indent 4 }}
+# API test values file
+
+xos-gui:
+  enabled: false
 
diff --git a/xos-core/templates/ws-configmap.yaml b/xos-core/requirements.yaml
similarity index 75%
copy from xos-core/templates/ws-configmap.yaml
copy to xos-core/requirements.yaml
index 7dcc72b..f77c942 100644
--- a/xos-core/templates/ws-configmap.yaml
+++ b/xos-core/requirements.yaml
@@ -13,13 +13,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: xos-ws
-  labels:
-    {{- include "xos-core.release_labels" . | indent 4 }}
-data:
-  config: |
-{{ include "xos-ws.gateway_config" . | indent 4 }}
+dependencies:
+- name: xos-gui
+  version: 0.1.0
+  repository: file://../xos-gui
+  condition: xos-gui.enabled
 
diff --git a/xos-core/values.yaml b/xos-core/values.yaml
index b06eb19..66130f5 100644
--- a/xos-core/values.yaml
+++ b/xos-core/values.yaml
@@ -13,15 +13,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+xos_gui:
+  enabled: true
+
 imagePullPolicy: 'IfNotPresent'
 
 # Docker images
 # YAML variable names can't contain `-`, so substituted with `_`
 xos_coreImage: 'xosproject/xos-core:master'
 xos_chameleonImage: 'xosproject/chameleon:master'
-xos_guiImage: 'xosproject/xos-gui:master'
 xos_toscaImage: 'xosproject/xos-tosca:master'
-xos_wsImage: 'xosproject/xos-ws:master'
 xos_api_testerImage: 'xosproject/xos-api-tester:master'
 
 postgresImage: 'postgres:10.3-alpine'
@@ -29,10 +30,8 @@
 redisImage: 'redis:3.2'
 
 # NodePorts
-xos_guiNodePort: 30001
 xos_chameleonNodePort: 30006
 xos_toscaNodePort: 30007
-xos_wsNodePort: 30008
 
 # XOS Admin username/password
 xosAdminUser: 'admin@opencord.org'
diff --git a/xos-gui/.helmignore b/xos-gui/.helmignore
new file mode 100644
index 0000000..f0c1319
--- /dev/null
+++ b/xos-gui/.helmignore
@@ -0,0 +1,21 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
diff --git a/xos-core/templates/ws-configmap.yaml b/xos-gui/Chart.yaml
similarity index 76%
copy from xos-core/templates/ws-configmap.yaml
copy to xos-gui/Chart.yaml
index 7dcc72b..c60ee86 100644
--- a/xos-core/templates/ws-configmap.yaml
+++ b/xos-gui/Chart.yaml
@@ -14,12 +14,8 @@
 # limitations under the License.
 
 apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: xos-ws
-  labels:
-    {{- include "xos-core.release_labels" . | indent 4 }}
-data:
-  config: |
-{{ include "xos-ws.gateway_config" . | indent 4 }}
+appVersion: "1.0"
+description: Web GUI for XOS
+name: xos-gui
+version: 0.1.0
 
diff --git a/xos-core/templates/_gui.tpl b/xos-gui/templates/_helpers.tpl
similarity index 81%
rename from xos-core/templates/_gui.tpl
rename to xos-gui/templates/_helpers.tpl
index 8939554..37909bc 100644
--- a/xos-core/templates/_gui.tpl
+++ b/xos-gui/templates/_helpers.tpl
@@ -14,6 +14,14 @@
 limitations under the License.
 */ -}}
 
+{{- define "xos-gui.release_labels" }}
+app: {{ printf "%s-%s" .Release.Name .Chart.Name | trunc 63 }}
+chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+release: {{ .Release.Name }}
+heritage: {{ .Release.Service }}
+version: {{ .Chart.Version }}
+{{- end }}
+
 {{- define "xos-gui.app_config" }}
 angular.module('app')
 .constant('AppConfig', {
diff --git a/xos-core/templates/_ws.tpl b/xos-gui/templates/_ws.tpl
similarity index 100%
rename from xos-core/templates/_ws.tpl
rename to xos-gui/templates/_ws.tpl
diff --git a/xos-core/templates/gui-configmap.yaml b/xos-gui/templates/gui-configmap.yaml
similarity index 88%
rename from xos-core/templates/gui-configmap.yaml
rename to xos-gui/templates/gui-configmap.yaml
index 273e001..0e4a5c5 100644
--- a/xos-core/templates/gui-configmap.yaml
+++ b/xos-gui/templates/gui-configmap.yaml
@@ -18,7 +18,7 @@
 metadata:
   name: gui-app-config
   labels:
-    {{- include "xos-core.release_labels" . | indent 4 }}
+    {{- include "xos-gui.release_labels" . | indent 4 }}
 data:
   config: |
 {{ include "xos-gui.app_config" . | indent 4 }}
@@ -31,7 +31,7 @@
 metadata:
   name: gui-style-config
   labels:
-    {{- include "xos-core.release_labels" . | indent 4 }}
+    {{- include "xos-gui.release_labels" . | indent 4 }}
 data:
   config: |
 {{ include "xos-gui.style_config" . | indent 4 }}
diff --git a/xos-core/templates/gui-deployment.yaml b/xos-gui/templates/gui-deployment.yaml
similarity index 96%
rename from xos-core/templates/gui-deployment.yaml
rename to xos-gui/templates/gui-deployment.yaml
index 4faecdf..c00e073 100644
--- a/xos-core/templates/gui-deployment.yaml
+++ b/xos-gui/templates/gui-deployment.yaml
@@ -18,7 +18,7 @@
 metadata:
   name: xos-gui
   labels:
-    {{- include "xos-core.release_labels" . | indent 4 }}
+    {{- include "xos-gui.release_labels" . | indent 4 }}
 spec:
   replicas: 1
   template:
diff --git a/xos-core/templates/gui-service.yaml b/xos-gui/templates/gui-service.yaml
similarity index 93%
rename from xos-core/templates/gui-service.yaml
rename to xos-gui/templates/gui-service.yaml
index 56aabb3..2504f58 100644
--- a/xos-core/templates/gui-service.yaml
+++ b/xos-gui/templates/gui-service.yaml
@@ -18,7 +18,7 @@
 metadata:
   name: "xos-gui"
   labels:
-    {{- include "xos-core.release_labels" . | indent 4 }}
+    {{- include "xos-gui.release_labels" . | indent 4 }}
 spec:
   type: NodePort
   ports:
diff --git a/xos-core/templates/ws-configmap.yaml b/xos-gui/templates/ws-configmap.yaml
similarity index 92%
rename from xos-core/templates/ws-configmap.yaml
rename to xos-gui/templates/ws-configmap.yaml
index 7dcc72b..f2caa68 100644
--- a/xos-core/templates/ws-configmap.yaml
+++ b/xos-gui/templates/ws-configmap.yaml
@@ -18,7 +18,7 @@
 metadata:
   name: xos-ws
   labels:
-    {{- include "xos-core.release_labels" . | indent 4 }}
+    {{- include "xos-gui.release_labels" . | indent 4 }}
 data:
   config: |
 {{ include "xos-ws.gateway_config" . | indent 4 }}
diff --git a/xos-core/templates/ws-deployment.yaml b/xos-gui/templates/ws-deployment.yaml
similarity index 95%
rename from xos-core/templates/ws-deployment.yaml
rename to xos-gui/templates/ws-deployment.yaml
index 5f4cad4..9d958bb 100644
--- a/xos-core/templates/ws-deployment.yaml
+++ b/xos-gui/templates/ws-deployment.yaml
@@ -18,7 +18,7 @@
 metadata:
   name: xos-ws
   labels:
-    {{- include "xos-core.release_labels" . | indent 4 }}
+    {{- include "xos-gui.release_labels" . | indent 4 }}
 spec:
   replicas: 1
   template:
diff --git a/xos-core/templates/ws-service.yaml b/xos-gui/templates/ws-service.yaml
similarity index 93%
rename from xos-core/templates/ws-service.yaml
rename to xos-gui/templates/ws-service.yaml
index 86912d1..41c1a07 100644
--- a/xos-core/templates/ws-service.yaml
+++ b/xos-gui/templates/ws-service.yaml
@@ -18,7 +18,7 @@
 metadata:
   name: "xos-ws"
   labels:
-    {{- include "xos-core.release_labels" . | indent 4 }}
+    {{- include "xos-gui.release_labels" . | indent 4 }}
 spec:
   type: NodePort
   ports:
diff --git a/xos-core/templates/ws-configmap.yaml b/xos-gui/values.yaml
similarity index 75%
copy from xos-core/templates/ws-configmap.yaml
copy to xos-gui/values.yaml
index 7dcc72b..3449931 100644
--- a/xos-core/templates/ws-configmap.yaml
+++ b/xos-gui/values.yaml
@@ -13,13 +13,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: xos-ws
-  labels:
-    {{- include "xos-core.release_labels" . | indent 4 }}
-data:
-  config: |
-{{ include "xos-ws.gateway_config" . | indent 4 }}
+imagePullPolicy: 'IfNotPresent'
+
+# Docker Images
+xos_guiImage: 'xosproject/xos-gui:master'
+xos_wsImage: 'xosproject/xos-ws:master'
+
+# NodePorts
+xos_guiNodePort: 30001
+xos_wsNodePort: 30008