From d1a85ba1a3178ab8cbf219f1539f064a34f5003a Mon Sep 17 00:00:00 2001
From: David Hoese <david.hoese@ssec.wisc.edu>
Date: Tue, 28 Jul 2020 12:10:54 -0500
Subject: [PATCH] Add client deployment and rename directories to reflect
 environments

---
 .gitlab-ci.yml                                | 104 ++++++++++++++----
 README.md                                     |   4 +-
 .../geotiff-pvc.yaml                          |   0
 ci_geosphere-test/values-client.yaml          |   8 ++
 .../values-geo2grid-g16-radf.yaml             |   0
 .../values-geosphere-rabbit.yaml              |   0
 .../values-grb-g16.yaml                       |   0
 .../values-mapcache.yaml                      |   0
 .../values-mapserver.yaml                     |   0
 ci_geosphere/values-client.yaml               |   8 ++
 10 files changed, 103 insertions(+), 21 deletions(-)
 rename {production => ci_geosphere-test}/geotiff-pvc.yaml (100%)
 create mode 100644 ci_geosphere-test/values-client.yaml
 rename {production => ci_geosphere-test}/values-geo2grid-g16-radf.yaml (100%)
 rename {production => ci_geosphere-test}/values-geosphere-rabbit.yaml (100%)
 rename {production => ci_geosphere-test}/values-grb-g16.yaml (100%)
 rename {production => ci_geosphere-test}/values-mapcache.yaml (100%)
 rename {production => ci_geosphere-test}/values-mapserver.yaml (100%)
 create mode 100644 ci_geosphere/values-client.yaml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1b18fc1..5a7dfba 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,6 +7,7 @@ stages:
   - deploy G2G
   - deploy WMS
   - deploy WMTS
+  - deploy Client
 
 variables:
   DOCKER_TLS_CERTDIR: ""
@@ -64,12 +65,12 @@ create geotiff storage:
     # copy secret kubeconfig to the mounted (pwd) directory
     - cp $kubekorner_k3s_config .
     - kubeconfig=$(basename $kubekorner_k3s_config)
-    - ./helpers/create_pvc.sh "$ns" "production/geotiff-pvc.yaml" "cspp-geo-geo2grid" "$kubeconfig"
+    - ./helpers/create_pvc.sh "$ns" "ci_geosphere-test/geotiff-pvc.yaml" "cspp-geo-geo2grid" "$kubeconfig"
   # this job doesn't actually need any artifacts from previous jobs
   dependencies: []
   rules:
     - changes:
-        - production/geotiff-pvc.yaml
+        - ci_geosphere-test/geotiff-pvc.yaml
       when: always
     - if: $CREATE_STORAGE
       when: always
@@ -82,9 +83,10 @@ create geotiff storage:
     # required:
     SUBCOMP_REPOS: ""
     SUBCOMP_CHART_DIR: ""
+    SUBCOMP_BRANCH: "master"
   script:
     - repos_url="${SUBCOMP_REPOS_BASE}/${SUBCOMP_REPOS}"
-    - git clone --depth 1 $repos_url
+    - git clone --depth 1 --branch ${SUBCOMP_BRANCH} $repos_url
     - cd ${SUBCOMP_REPOS}
     # most recent docker image should be tagged with most recent SHA
     - docker_tag=$(git rev-parse --short=8 HEAD)
@@ -133,10 +135,23 @@ get_chart_mapcache:
     SUBCOMP_REPOS: "geosphere-mapcache"
     SUBCOMP_CHART_DIR: "geosphere-mapcache"
 
+get_chart_client:
+  extends: .get_chart_tmpl
+  variables:
+    SUBCOMP_REPOS: "geosphere-client"
+    SUBCOMP_CHART_DIR: "geosphere-client"
+
+get_chart_client_test:
+  extends: .get_chart_tmpl
+  variables:
+    SUBCOMP_REPOS: "geosphere-client"
+    SUBCOMP_CHART_DIR: "geosphere-client"
+    SUBCOMP_BRANCH: "develop"
+
 deploy_prod_rabbit:
   environment:
-    name: production
-    url: http://geosphere.ssec.wisc.edu
+    name: geosphere-test
+    url: http://geosphere-test.ssec.wisc.edu
   extends: .helm_based_job
   stage: deploy rabbit
   script:
@@ -157,7 +172,7 @@ deploy_prod_rabbit:
     - echo $EXTRA_ARGS
     # install third-party rabbitmq server
     - helm repo add bitnami "https://charts.bitnami.com/bitnami"
-    - helm upgrade -v 2 --install --kubeconfig $kubeconfig -f production/values-geosphere-rabbit.yaml $EXTRA_ARGS --namespace $ns geosphere-rabbit bitnami/rabbitmq
+    - helm upgrade -v 2 --install --kubeconfig $kubeconfig -f ci_geosphere-test/values-geosphere-rabbit.yaml $EXTRA_ARGS --namespace $ns geosphere-rabbit bitnami/rabbitmq
   # this job doesn't actually need any artifacts from previous jobs
   dependencies: []
   rules:
@@ -167,16 +182,15 @@ deploy_prod_rabbit:
     - if: $CI_PIPELINE_SOURCE == "pipeline"
       when: never
     - changes:
-        - production/values-geosphere-rabbit.yaml
+        - ci_geosphere-test/values-geosphere-rabbit.yaml
       when: always
     - if: $DEPLOY_RABBIT
       when: always
 
-
 deploy_g16_grb:
   environment:
-    name: production
-    url: http://geosphere.ssec.wisc.edu
+    name: geosphere-test
+    url: http://geosphere-test.ssec.wisc.edu
   extends: .helm_based_job
   stage: deploy GRB
   script:
@@ -188,7 +202,7 @@ deploy_g16_grb:
     - kubeconfig=$(basename $kubekorner_k3s_config)
     - echo "Deploying version $docker_tag to cluster namespace $ns"
     # copy extra values files to the local directory (where helm has access via docker mount)
-    - cp ../../production/values-grb-g16.yaml .
+    - cp ../../ci_geosphere-test/values-grb-g16.yaml .
     # namespace names are the same as domain names
     - helm upgrade -v 2 --install --kubeconfig $kubeconfig --namespace $ns --set persistence.enabled=true --set persistence.storageClass=longhorn -f values-grb-g16.yaml cspp-geo-grb cspp-geo-grb/
   dependencies:
@@ -200,8 +214,8 @@ deploy_g16_grb:
 
 deploy_geo2grid_g16_radf:
   environment:
-    name: production
-    url: http://geosphere.ssec.wisc.edu
+    name: geosphere-test
+    url: http://geosphere-test.ssec.wisc.edu
   extends: .helm_based_job
   stage: deploy G2G
   script:
@@ -213,7 +227,7 @@ deploy_geo2grid_g16_radf:
     - kubeconfig=$(basename $kubekorner_k3s_config)
     - echo "Deploying version $docker_tag to cluster namespace $ns"
     # copy extra values files to the local directory (where helm has access via docker mount)
-    - cp ../../production/values-geo2grid-g16-radf.yaml .
+    - cp ../../ci_geosphere-test/values-geo2grid-g16-radf.yaml .
     # namespace names are the same as domain names
     - helm upgrade -v 2 --install --kubeconfig $kubeconfig --namespace $ns -f values-geo2grid-g16-radf.yaml cspp-geo-geo2grid cspp-geo-geo2grid/
   dependencies:
@@ -225,8 +239,8 @@ deploy_geo2grid_g16_radf:
 
 deploy_mapserver:
   environment:
-    name: production
-    url: http://geosphere.ssec.wisc.edu
+    name: geosphere-test
+    url: http://geosphere-test.ssec.wisc.edu
   extends: .helm_based_job
   stage: deploy WMS
   script:
@@ -238,7 +252,7 @@ deploy_mapserver:
     - kubeconfig=$(basename $kubekorner_k3s_config)
     - echo "Deploying version $docker_tag to cluster namespace $ns"
     # copy extra values files to the local directory (where helm has access via docker mount)
-    - cp ../../production/values-mapserver.yaml .
+    - cp ../../ci_geosphere-test/values-mapserver.yaml .
     # namespace names are the same as domain names
     - helm upgrade -v 2 --install --kubeconfig $kubeconfig --namespace $ns -f values-mapserver.yaml geosphere-mapserver geosphere-mapserver/
   dependencies:
@@ -250,8 +264,8 @@ deploy_mapserver:
 
 deploy_mapcache:
   environment:
-    name: production
-    url: http://geosphere.ssec.wisc.edu
+    name: geosphere-test
+    url: http://geosphere-test.ssec.wisc.edu
   extends: .helm_based_job
   stage: deploy WMTS
   script:
@@ -263,7 +277,7 @@ deploy_mapcache:
     - kubeconfig=$(basename $kubekorner_k3s_config)
     - echo "Deploying version $docker_tag to cluster namespace $ns"
     # copy extra values files to the local directory (where helm has access via docker mount)
-    - cp ../../production/values-mapcache.yaml .
+    - cp ../../ci_geosphere-test/values-mapcache.yaml .
     # namespace names are the same as domain names
     - helm upgrade -v 2 --install --kubeconfig $kubeconfig --namespace $ns -f values-mapcache.yaml geosphere-mapcache geosphere-mapcache/
   dependencies:
@@ -272,3 +286,53 @@ deploy_mapcache:
     - if: '$kubekorner_k3s_config == ""'
       when: never
     - when: on_success
+
+deploy_client_test:
+  environment:
+    name: geosphere-test
+    url: http://geosphere-test.ssec.wisc.edu
+  extends: .helm_based_job
+  stage: deploy Client
+  script:
+    - ns="geosphere"
+    - cd geosphere-client/chart
+    - source geosphere-client/cibuild.env
+    # copy secret kubeconfig to the mounted (pwd) directory
+    - cp $kubekorner_k3s_config .
+    - kubeconfig=$(basename $kubekorner_k3s_config)
+    - echo "Deploying version $docker_tag to cluster namespace $ns"
+    # copy extra values files to the local directory (where helm has access via docker mount)
+    - cp ../../ci_geosphere-test/values-client.yaml .
+    # namespace names are the same as domain names
+    - helm upgrade -v 2 --install --kubeconfig $kubeconfig --namespace $ns -f values-client.yaml geosphere-client geosphere-client/
+  dependencies:
+    - get_chart_client_test
+  rules:
+    - if: '$kubekorner_k3s_config == ""'
+      when: never
+    - when: on_success
+
+deploy_client_production:
+  environment:
+    name: geosphere
+    url: http://geosphere.ssec.wisc.edu
+  extends: .helm_based_job
+  stage: deploy Client
+  script:
+    - ns="geosphere"
+    - cd geosphere-client/chart
+    - source geosphere-client/cibuild.env
+    # copy secret kubeconfig to the mounted (pwd) directory
+    - cp $kubekorner_k3s_config .
+    - kubeconfig=$(basename $kubekorner_k3s_config)
+    - echo "Deploying version $docker_tag to cluster namespace $ns"
+    # copy extra values files to the local directory (where helm has access via docker mount)
+    - cp ../../ci_geosphere/values-client.yaml .
+    # namespace names are the same as domain names
+    - helm upgrade -v 2 --install --kubeconfig $kubeconfig --namespace $ns -f values-client.yaml geosphere-client geosphere-client/
+  dependencies:
+    - get_chart_client
+  rules:
+    - if: '$kubekorner_k3s_config == ""'
+      when: never
+    - when: on_success
diff --git a/README.md b/README.md
index 0db9d6f..3350f13 100644
--- a/README.md
+++ b/README.md
@@ -17,8 +17,10 @@ repositories to use for building and testing their pieces.
   are **not** run as part of continuous integration.
 * cichart: Docker image configuration used by certain CI jobs to build or
   download helm charts.
-* production: Extra helm chart "values" YAML files to configure GeoSphere for
+* ci_geosphere: Extra helm chart "values" YAML files to configure GeoSphere for
   the production environment.
+* ci_geosphere-test: Extra helm chart "values" YAML files to configure GeoSphere for
+  the development (geosphere-test) environment.
 * sidecars: Docker image configurations for various "sidecar" containers that
   don't fit in one subcomponent's project.
 * .gitlab-ci.yml: Continuous Integration (CI) configuration
\ No newline at end of file
diff --git a/production/geotiff-pvc.yaml b/ci_geosphere-test/geotiff-pvc.yaml
similarity index 100%
rename from production/geotiff-pvc.yaml
rename to ci_geosphere-test/geotiff-pvc.yaml
diff --git a/ci_geosphere-test/values-client.yaml b/ci_geosphere-test/values-client.yaml
new file mode 100644
index 0000000..7a9a0eb
--- /dev/null
+++ b/ci_geosphere-test/values-client.yaml
@@ -0,0 +1,8 @@
+ingress:
+  enabled: true
+  hosts:
+    - host: geosphere-test.ssec.wisc.edu
+      paths: ["/"]
+
+infoServer: "http://geosphere-test.ssec.wisc.edu"
+tileServer: "http://geosphere-test.ssec.wisc.edu/mapcache/wmts"
diff --git a/production/values-geo2grid-g16-radf.yaml b/ci_geosphere-test/values-geo2grid-g16-radf.yaml
similarity index 100%
rename from production/values-geo2grid-g16-radf.yaml
rename to ci_geosphere-test/values-geo2grid-g16-radf.yaml
diff --git a/production/values-geosphere-rabbit.yaml b/ci_geosphere-test/values-geosphere-rabbit.yaml
similarity index 100%
rename from production/values-geosphere-rabbit.yaml
rename to ci_geosphere-test/values-geosphere-rabbit.yaml
diff --git a/production/values-grb-g16.yaml b/ci_geosphere-test/values-grb-g16.yaml
similarity index 100%
rename from production/values-grb-g16.yaml
rename to ci_geosphere-test/values-grb-g16.yaml
diff --git a/production/values-mapcache.yaml b/ci_geosphere-test/values-mapcache.yaml
similarity index 100%
rename from production/values-mapcache.yaml
rename to ci_geosphere-test/values-mapcache.yaml
diff --git a/production/values-mapserver.yaml b/ci_geosphere-test/values-mapserver.yaml
similarity index 100%
rename from production/values-mapserver.yaml
rename to ci_geosphere-test/values-mapserver.yaml
diff --git a/ci_geosphere/values-client.yaml b/ci_geosphere/values-client.yaml
new file mode 100644
index 0000000..5da57c7
--- /dev/null
+++ b/ci_geosphere/values-client.yaml
@@ -0,0 +1,8 @@
+ingress:
+  enabled: true
+  hosts:
+    - host: geosphere.ssec.wisc.edu
+      paths: ["/"]
+
+infoServer: "http://presto.ssec.wisc.edu:8888"
+tileServer: "http://g2g{1-4}.ssec.wisc.edu:8889/mapcache/wmts"
-- 
GitLab