This is an automated email from the ASF dual-hosted git repository.
kaihsun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git
The following commit(s) were added to refs/heads/master by this push:
new 941eedb SUBMARINE-821. Use custom image in submarine operator for
developer
941eedb is described below
commit 941eedbc16da95a77b2ef8dd2ddfc1a08401ee10
Author: MortalHappiness <[email protected]>
AuthorDate: Tue May 11 00:53:58 2021 +0800
SUBMARINE-821. Use custom image in submarine operator for developer
### What is this PR for?
Create a helper script for developers to build local submarine images and
update the images used by submarine operator.
### What type of PR is it?
[Feature]
### Todos
### What is the Jira issue?
https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-821
### How should this be tested?
https://travis-ci.org/github/MortalHappiness/submarine/builds/770525948
### Screenshots (if appropriate)
https://user-images.githubusercontent.com/47914085/117708202-16f89280-b202-11eb-9f15-e1c42c73773a.mp4
### Questions:
* Do the license files need updating? No
* Are there breaking changes for older versions? No
* Does this need new documentation? No
Author: MortalHappiness <[email protected]>
Signed-off-by: Kai-Hsun Chen <[email protected]>
Closes #585 from MortalHappiness/SUBMARINE-821 and squashes the following
commits:
c04c3334 [MortalHappiness] SUBMARINE-821. Add build_image.sh and update
README.md
---
submarine-cloud-v2/README.md | 25 +++++++-
submarine-cloud-v2/hack/build_image.sh | 114 +++++++++++++++++++++++++++++++++
2 files changed, 138 insertions(+), 1 deletion(-)
diff --git a/submarine-cloud-v2/README.md b/submarine-cloud-v2/README.md
index c3f95d6..ace7f70 100644
--- a/submarine-cloud-v2/README.md
+++ b/submarine-cloud-v2/README.md
@@ -72,6 +72,14 @@ kubectl apply -n submarine-operator-test -f
artifacts/examples/example-submarine
kubectl logs ${submarine-operator POD}
```
+# Create a Submarine in specific namespace and see workbench
+
+```bash
+kubectl create ns submarine-operator-test
+kubectl apply -n submarine-operator-test -f
artifacts/examples/example-submarine.yaml
+kubectl port-forward --address 0.0.0.0 -n submarine-operator-test
service/traefik 32080:80
+```
+
# Helm Golang API
* Function `HelmInstall` is defined in pkg/helm/helm.go.
* Example: (You can see this example in controller.go:123.)
@@ -94,11 +102,11 @@ helmActionConfig := helm.HelmInstall(
"set":
"ports[0].protocol=TCP,ports[0].port=80,ports[0].targetPort=9376",
},
)
-
// Example: HelmUninstall
// This is equal to:
// helm uninstall helm-install-example-release
helm.HelmUninstall("helm-install-example-release", helmActionConfig)
+
```
* Troubleshooting:
* If the release name exists, Helm will report the error "cannot re-use a
name that is still in use".
@@ -106,3 +114,18 @@ helm.HelmUninstall("helm-install-example-release",
helmActionConfig)
helm ls
helm uninstall helm-install-example-release
```
+
+# Build custom images when development
+
+Use the following helper script to build images and update the images used by
running pods.
+
+```
+./hack/build_image.sh [all|server|database|jupyter|jupyter-gpu|mlflow]
+```
+
+Examples:
+
+```
+./hack/build_image.sh all # build all images
+./hack/build_image.sh server # only build the server image
+```
diff --git a/submarine-cloud-v2/hack/build_image.sh
b/submarine-cloud-v2/hack/build_image.sh
new file mode 100755
index 0000000..e427e95
--- /dev/null
+++ b/submarine-cloud-v2/hack/build_image.sh
@@ -0,0 +1,114 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+
+set -e
+NAMESPACE="submarine-operator-test"
+
+# ========================================
+
+help_message() {
+ cat <<< "\
+Usage: $0 [image]
+
+image:
+ all build all images
+ server build submarine server
+ database build submarine database
+ jupyter build submarine jupyter-notebook
+ jupyter-gpu build submarine jupyter-notebook-gpu
+ mlflow build submarine mlflow"
+}
+
+build_server() {
+ [[ ! -f mvnw ]] && mvn -N io.takari:maven:0.7.7:wrapper -Dmaven=3.6.1
+ eval $(minikube docker-env -u)
+ ./mvnw clean package -DskipTests
+ eval $(minikube docker-env)
+ ./dev-support/docker-images/submarine/build.sh
+ # Delete the deployment and the operator will create a new one using new
image
+ kubectl delete -n "$NAMESPACE" deployments submarine-server
+ eval $(minikube docker-env -u)
+}
+
+build_database() {
+ eval $(minikube docker-env)
+ ./dev-support/docker-images/database/build.sh
+ # Delete the deployment and the operator will create a new one using new
image
+ kubectl delete -n "$NAMESPACE" deployments submarine-database
+ eval $(minikube docker-env -u)
+}
+
+build_jupyter() {
+ eval $(minikube docker-env)
+ ./dev-support/docker-images/jupyter/build.sh
+ eval $(minikube docker-env -u)
+}
+
+build_jupyter_gpu() {
+ eval $(minikube docker-env)
+ ./dev-support/docker-images/jupyter-gpu/build.sh
+ eval $(minikube docker-env -u)
+}
+
+build_mlflow() {
+ eval $(minikube docker-env)
+ ./dev-support/docker-images/mlflow/build.sh
+ # Delete the deployment and the operator will create a new one using new
image
+ kubectl delete -n "$NAMESPACE" deployments submarine-mlflow
+ eval $(minikube docker-env -u)
+}
+
+# ========================================
+
+if [[ "$#" -ne 1 ]]; then
+ help_message >&2
+ exit 1
+fi
+
+SUBMARINE_HOME=`git rev-parse --show-toplevel`
+cd "$SUBMARINE_HOME"
+
+case "$1" in
+ "all")
+ build_server
+ build_database
+ build_jupyter
+ build_jupyter_gpu
+ build_mlflow
+ ;;
+ "server")
+ build_server
+ ;;
+ "database")
+ build_database
+ ;;
+ "jupyter")
+ build_jupyter
+ ;;
+ "jupyter-gpu")
+ build_jupyter_gpu
+ ;;
+ "mlflow")
+ build_mlflow
+ ;;
+ *)
+ help_message >&2
+ exit 1
+ ;;
+esac
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]