From a1b47b7366734220b9b3830dd31d0472d294ea7b Mon Sep 17 00:00:00 2001 From: Kris De Volder Date: Tue, 9 Jul 2019 15:25:19 -0700 Subject: [PATCH] Add a script that does everything needed to ... - create a k8s cluster using 'kind' - build theia-spring-boot - build docker image with theia-spring-boot - deploy it to the cluster - expose the deployed theia app on localhost port --- .../k8s-app/build-all-and-deploy-to-k8s.sh | 31 +++++++++++++++++++ theia-extensions/k8s-app/deploy.yml | 4 +-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100755 theia-extensions/k8s-app/build-all-and-deploy-to-k8s.sh diff --git a/theia-extensions/k8s-app/build-all-and-deploy-to-k8s.sh b/theia-extensions/k8s-app/build-all-and-deploy-to-k8s.sh new file mode 100755 index 000000000..ad10e575c --- /dev/null +++ b/theia-extensions/k8s-app/build-all-and-deploy-to-k8s.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e + +# Create k8s cluster using 'kind' +kind create cluster +export KUBECONFIG="$(kind get kubeconfig-path --name="kind")" +kubectl cluster-info + +cd docker-boot-dev + +# Build the 'theia-spring-boot' package +./create-theia-boot-pkg.sh + +# Then build it into a docker image +docker build -t theia-spring-boot . + +# If using a 'kind' cluster, we must upload the image to the k8s cluster +kind load docker-image theia-spring-boot + +cd .. + +# Deploy to the cluster +./deploy_theia_k8s.sh + +# Expose the app on localhost +echo "Exposing theia-spring-boot deployment on http://localhost:3000" +until kubectl port-forward deployment/theia-spring-boot 3000:3000; do + echo "Problem forwarding port, still waiting for container to start?" + sleep 10 + echo "Retrying" +done \ No newline at end of file diff --git a/theia-extensions/k8s-app/deploy.yml b/theia-extensions/k8s-app/deploy.yml index 8845d6949..dda7fcc99 100644 --- a/theia-extensions/k8s-app/deploy.yml +++ b/theia-extensions/k8s-app/deploy.yml @@ -32,8 +32,8 @@ spec: fsGroup: 3000 containers: - name: theia-spring-boot - # image: theia-spring-boot - image: theia-spring-boot:java_ls_started + image: theia-spring-boot + # image: theia-spring-boot:java_ls_started # Image pull policy `Never` is needed to pull from local Docker Daemon imagePullPolicy: Never ports: