This is an automated email from the ASF dual-hosted git repository.

pingsutw 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 fc9bcae  SUBMARINE-945. Create helm chart for submarine operator
fc9bcae is described below

commit fc9bcaed71aa4db1d80b41aeeed2babab5b74d1b
Author: MortalHappiness <[email protected]>
AuthorDate: Sun Jul 18 21:44:07 2021 +0800

    SUBMARINE-945. Create helm chart for submarine operator
    
    ### What is this PR for?
    Create helm chart for submarine operator
    
    ### What type of PR is it?
    [Feature]
    
    ### Todos
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-945
    
    ### How should this be tested?
    
    ### Screenshots (if appropriate)
    
    ### 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: Kevin <[email protected]>
    
    Closes #684 from MortalHappiness/SUBMARINE-945 and squashes the following 
commits:
    
    249104bb [MortalHappiness] SUBMARINE-945. Add license
    d9da4bd6 [MortalHappiness] SUBMARINE-945. Create helm chart for submarine 
operator
---
 submarine-cloud-v2/Makefile                        |  2 +-
 submarine-cloud-v2/README.md                       | 28 +++++--------
 submarine-cloud-v2/artifacts/examples/README.md    | 34 ----------------
 submarine-cloud-v2/docs/developer-guide.md         | 21 ++++++++--
 .../submarine-operator/.helmignore}                | 46 +++++++++++-----------
 .../submarine-operator/Chart.yaml}                 | 29 +++-----------
 .../submarine-operator/crds}/crd.yaml              |  0
 .../submarine-operator/templates/rbac.yaml}        |  0
 .../templates}/submarine-operator.yaml             | 20 +++++-----
 .../submarine-operator/values.yaml}                | 26 ++----------
 10 files changed, 71 insertions(+), 135 deletions(-)

diff --git a/submarine-cloud-v2/Makefile b/submarine-cloud-v2/Makefile
index a729339..fd95beb 100644
--- a/submarine-cloud-v2/Makefile
+++ b/submarine-cloud-v2/Makefile
@@ -32,7 +32,7 @@ api:
 image: charts
        eval $(minikube docker-env)
        GOOS=linux go build -o submarine-operator
-       docker build -t submarine-operator -f dev.Dockerfile .
+       docker build -t "apache/submarine:operator-0.6.0-SNAPSHOT" -f 
dev.Dockerfile .
        go build -o submarine-operator
 
 .PHONY: test-unit
diff --git a/submarine-cloud-v2/README.md b/submarine-cloud-v2/README.md
index 750ac46..d91bcf4 100644
--- a/submarine-cloud-v2/README.md
+++ b/submarine-cloud-v2/README.md
@@ -38,7 +38,7 @@ make
 ./submarine-operator
 
 # Step2: Deploy a Submarine
-kubectl apply -f artifacts/examples/crd.yaml
+kubectl apply -f helm-charts/submarine-operator/crds/crd.yaml
 kubectl create ns submarine-user-test
 kubectl apply -n submarine-user-test -f 
artifacts/examples/example-submarine.yaml
 
@@ -68,36 +68,28 @@ kubectl delete submarine example-submarine -n 
submarine-user-test
 ## Run operator in-cluster
 
 ```bash
-# Step1: Build image "submarine-operator" to minikube's Docker
-eval $(minikube docker-env)
-make image
+# Step1: Deploye submarine-operator
+helm install submarine-operator ./helm-charts/submarine-operator/
 
-# Step2: Setup RBAC (ClusterRole, ClusterRoleBinding, and ServiceAccount)
-kubectl apply -f artifacts/examples/submarine-operator-service-account.yaml
-
-# Step3: Deploy a submarine-operator
-kubectl apply -f artifacts/examples/submarine-operator.yaml
-
-# Step4: Deploy a submarine
-kubectl apply -f artifacts/examples/crd.yaml
+# Step2: Deploy a submarine
 kubectl create ns submarine-user-test
 kubectl apply -n submarine-user-test -f 
artifacts/examples/example-submarine.yaml
 
-# Step5: Inspect the logs of submarine-operator
+# Step3: Inspect the logs of submarine-operator
 kubectl logs -f $(kubectl get pods --output=name | grep submarine-operator)
 
-# Step6: Exposing Service
+# Step4: Exposing Service
 # Method1 -- use minikube ip
 minikube ip  # you'll get the IP address of minikube, ex: 192.168.49.2
 
 # Method2 -- use port-forwarding
 kubectl port-forward --address 0.0.0.0 -n submarine-user-test service/traefik 
32080:80
 
-# Step7: View Workbench
+# Step5: View Workbench
 # http://{minikube ip}:32080 (from Method 1), ex: http://192.168.49.2:32080
 # or http://127.0.0.1:32080 (from Method 2).
 
-# Step8: Delete Submarine
+# Step6: Delete Submarine
 # By deleting the submarine custom resource, the operator will do the 
following things:
 #   (1) Remove all relevant Helm chart releases
 #   (2) Remove all resources in the namespace "submariner-user-test"
@@ -105,8 +97,8 @@ kubectl port-forward --address 0.0.0.0 -n 
submarine-user-test service/traefik 32
 #   (4) **Note:** The namespace "submarine-user-test" will not be deleted
 kubectl delete submarine example-submarine -n submarine-user-test
 
-# Step9: Delete the submarine-operator
-kubectl delete deployment submarine-operator-demo
+# Step7: Delete the submarine-operator
+helm delete submarine-operator
 ```
 
 # Development
diff --git a/submarine-cloud-v2/artifacts/examples/README.md 
b/submarine-cloud-v2/artifacts/examples/README.md
deleted file mode 100644
index ef33449..0000000
--- a/submarine-cloud-v2/artifacts/examples/README.md
+++ /dev/null
@@ -1,34 +0,0 @@
-<!---
-  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. See accompanying LICENSE file.
--->
-# Artifacts
-Before you start reading this document, you need to understand the following 
Kubernetes concepts:
-* Custom Resource Definition (CRD)
-* Custom Resource (CR)
-* Role-based access control (RBAC): Cluster Role, Cluster Role Binding, and 
Service Account
-
-`crd.yaml`
-
-This file defines the schema of our [custom 
resource](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/).
-
-`example-submarine.yaml`
-
-This file specifies the metadata of our custom resource, we can apply this 
file to deploy it.
-
-`submarine-operator-service-account.yaml`
-
-This file grants that submarine-operator has cluster-wide access, which allow 
it to operate on other resources.
-
-`submarine-operator.yaml`
-
-We can apply this file to deploy submarine-operator.
-
-
diff --git a/submarine-cloud-v2/docs/developer-guide.md 
b/submarine-cloud-v2/docs/developer-guide.md
index 1fb56d9..8b6830a 100644
--- a/submarine-cloud-v2/docs/developer-guide.md
+++ b/submarine-cloud-v2/docs/developer-guide.md
@@ -74,17 +74,30 @@ Example:
 ./hack/run_frontend_e2e.sh loginIT
 ```
 
-## Build Custom Images
+## Rebuild Operator Image
 
-Use the following helper script to build images and update the images used by 
running pods.
+When running operator in-cluster by Helm, we need to rebuild the operator 
image for changes to take effect.
 
+```bash
+eval $(minikube docker-env)
+make image
+eval $(minikube docker-env -u)
+
+# Update the operator pod
+helm upgrade submarine-operator ./helm-charts/sumbarine-operator
 ```
+
+## Rebuild Images for Other Components
+
+Use the following helper script to build images and update the images used by 
running pods.
+
+```bash
 ./hack/build_image.sh [all|server|database|jupyter|jupyter-gpu|mlflow]
 ```
 
 Examples:
 
-```
+```bash
 ./hack/build_image.sh all     # build all images
 ./hack/build_image.sh server  # only build the server image
 ```
@@ -118,4 +131,4 @@ helmActionConfig := helm.HelmInstall(
 //    helm uninstall helm-install-example-release
 helm.HelmUninstall("helm-install-example-release", helmActionConfig)
 
-```
\ No newline at end of file
+```
diff --git a/submarine-cloud-v2/Makefile 
b/submarine-cloud-v2/helm-charts/submarine-operator/.helmignore
similarity index 65%
copy from submarine-cloud-v2/Makefile
copy to submarine-cloud-v2/helm-charts/submarine-operator/.helmignore
index a729339..cab781a 100644
--- a/submarine-cloud-v2/Makefile
+++ b/submarine-cloud-v2/helm-charts/submarine-operator/.helmignore
@@ -15,26 +15,26 @@
 # limitations under the License.
 #
 
-all: # The default target
-
-charts:
-       cp -r ../helm-charts/submarine/charts  .
-
-.PHONY: all
-all: charts
-       go build -o submarine-operator
-
-.PHONY: api
-api:
-       ./hack/update-codegen.sh
-
-.PHONY: image
-image: charts
-       eval $(minikube docker-env)
-       GOOS=linux go build -o submarine-operator
-       docker build -t submarine-operator -f dev.Dockerfile .
-       go build -o submarine-operator
-
-.PHONY: test-unit
-test-unit:
-       go test
+# 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
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/submarine-cloud-v2/Makefile 
b/submarine-cloud-v2/helm-charts/submarine-operator/Chart.yaml
similarity index 65%
copy from submarine-cloud-v2/Makefile
copy to submarine-cloud-v2/helm-charts/submarine-operator/Chart.yaml
index a729339..704c0f2 100644
--- a/submarine-cloud-v2/Makefile
+++ b/submarine-cloud-v2/helm-charts/submarine-operator/Chart.yaml
@@ -15,26 +15,9 @@
 # limitations under the License.
 #
 
-all: # The default target
-
-charts:
-       cp -r ../helm-charts/submarine/charts  .
-
-.PHONY: all
-all: charts
-       go build -o submarine-operator
-
-.PHONY: api
-api:
-       ./hack/update-codegen.sh
-
-.PHONY: image
-image: charts
-       eval $(minikube docker-env)
-       GOOS=linux go build -o submarine-operator
-       docker build -t submarine-operator -f dev.Dockerfile .
-       go build -o submarine-operator
-
-.PHONY: test-unit
-test-unit:
-       go test
+apiVersion: v2
+name: submarine-operator
+description: A Helm chart for Submarine operator
+type: application
+version: 0.1.0
+appVersion: "0.6.0"
diff --git a/submarine-cloud-v2/artifacts/examples/crd.yaml 
b/submarine-cloud-v2/helm-charts/submarine-operator/crds/crd.yaml
similarity index 100%
rename from submarine-cloud-v2/artifacts/examples/crd.yaml
rename to submarine-cloud-v2/helm-charts/submarine-operator/crds/crd.yaml
diff --git 
a/submarine-cloud-v2/artifacts/examples/submarine-operator-service-account.yaml 
b/submarine-cloud-v2/helm-charts/submarine-operator/templates/rbac.yaml
similarity index 100%
rename from 
submarine-cloud-v2/artifacts/examples/submarine-operator-service-account.yaml
rename to submarine-cloud-v2/helm-charts/submarine-operator/templates/rbac.yaml
diff --git a/submarine-cloud-v2/artifacts/examples/submarine-operator.yaml 
b/submarine-cloud-v2/helm-charts/submarine-operator/templates/submarine-operator.yaml
similarity index 75%
rename from submarine-cloud-v2/artifacts/examples/submarine-operator.yaml
rename to 
submarine-cloud-v2/helm-charts/submarine-operator/templates/submarine-operator.yaml
index 11a6a25..957e6a4 100644
--- a/submarine-cloud-v2/artifacts/examples/submarine-operator.yaml
+++ 
b/submarine-cloud-v2/helm-charts/submarine-operator/templates/submarine-operator.yaml
@@ -20,24 +20,26 @@ kind: Deployment
 metadata:
   creationTimestamp: null
   labels:
-    app: submarine-operator-demo
-  name: submarine-operator-demo
+    app: "{{ .Values.name }}"
+  name: "{{ .Values.name }}"
 spec:
-  replicas: 1
+  replicas: {{ .Values.replicas }}
   selector:
     matchLabels:
-      app: submarine-operator-demo
+      app: "{{ .Values.name }}"
   strategy: {}
   template:
     metadata:
       creationTimestamp: null
       labels:
-        app: submarine-operator-demo
+        app: "{{ .Values.name }}"
+      annotations:
+        timestamp: {{ now | quote }}
     spec:
       containers:
-      - image: submarine-operator
-        name: submarine-operator
-        resources: {}
-        imagePullPolicy: Never
+        - image: "{{ .Values.image }}"
+          name: "{{ .Values.name }}"
+          resources: {}
+          imagePullPolicy: IfNotPresent
       serviceAccountName: submarine-operator
 status: {}
diff --git a/submarine-cloud-v2/Makefile 
b/submarine-cloud-v2/helm-charts/submarine-operator/values.yaml
similarity index 65%
copy from submarine-cloud-v2/Makefile
copy to submarine-cloud-v2/helm-charts/submarine-operator/values.yaml
index a729339..c7b28ab 100644
--- a/submarine-cloud-v2/Makefile
+++ b/submarine-cloud-v2/helm-charts/submarine-operator/values.yaml
@@ -15,26 +15,6 @@
 # limitations under the License.
 #
 
-all: # The default target
-
-charts:
-       cp -r ../helm-charts/submarine/charts  .
-
-.PHONY: all
-all: charts
-       go build -o submarine-operator
-
-.PHONY: api
-api:
-       ./hack/update-codegen.sh
-
-.PHONY: image
-image: charts
-       eval $(minikube docker-env)
-       GOOS=linux go build -o submarine-operator
-       docker build -t submarine-operator -f dev.Dockerfile .
-       go build -o submarine-operator
-
-.PHONY: test-unit
-test-unit:
-       go test
+name: submarine-operator-demo
+replicas: 1
+image: apache/submarine:operator-0.6.0-SNAPSHOT

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to