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 58fa457 SUBMARINE-759. Update submarine-operator.md
58fa457 is described below
commit 58fa4576ce520ac74d4dc1c9a45e0b0af870e27b
Author: Kai-Hsun Chen <[email protected]>
AuthorDate: Tue Mar 9 20:39:51 2021 +0800
SUBMARINE-759. Update submarine-operator.md
### What is this PR for?
The document of submarine-operator is outdated, and thus we cannot launch
the submarine operator with this document.
For example,
(1) (submarine-operator.md) Kind v0.6.0 deprecates `kind get
kubeconfig-path`
(2) (manifests/submarine-operator/deployment.yaml) `selector` field is
necessary.
(3) (manifests/submarine-operator/deployment.yaml) Now, deployment is
`apiVersion: apps/v1` rather than `extensions/v1beta1`.
(4) The .yaml files in `manifests/` are very different with the files in
`helm-charts/`. Therefore, some errors will occur. For instance, there is no
`configMap` in `helm-charts/submarine/templates/submarine-server.yaml`, but a
`configMap` is defined in `manifests/submarine-cluster/submarine-server.yaml`.
Hence, we need to update this document, and we should refactor this
component next.
### What type of PR is it?
[Documentation]
### Todos
* Refactor submarine-operator
### What is the Jira issue?
https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-759?filter=allopenissues
### How should this be tested?
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Author: Kai-Hsun Chen <[email protected]>
Signed-off-by: Kevin <[email protected]>
Closes #530 from kevin85421/SUBMARINE-759 and squashes the following
commits:
1c54639e [Kai-Hsun Chen] SUBMARINE-759. Update submarine-operator.md
---
submarine-cloud/README.md | 28 ++++
.../manifests/submarine-operator/deployment.yaml | 5 +-
submarine-cloud/submarine-operator.md | 170 ---------------------
3 files changed, 32 insertions(+), 171 deletions(-)
diff --git a/submarine-cloud/README.md b/submarine-cloud/README.md
new file mode 100644
index 0000000..05c7f3b
--- /dev/null
+++ b/submarine-cloud/README.md
@@ -0,0 +1,28 @@
+# Submarine Operator
+## Run (Method 1)
+```
+# Build Submarine Operator Binary
+cd submarine/submarine-cloud
+make build
+
+# Create CRD (SubmarineCluster)
+kubectl apply -f manifests/crd.yaml
+
+# Create a kind cluster
+./hack/kind-cluster-build.sh --name "submarine"
+
+# Launch Submarine Operator (Method 1)
+# ([Kind v0.6.0 deprecates `kind get
kubeconfig-path`](https://github.com/kubernetes-sigs/cluster-api/issues/1796))
+KUBECONFIG=$(kind get kubeconfig-path --name submarine)
+./submarine-operator --kubeconfig=${KUBECONFIG} --alsologtostderr --v=7
+
+# Launch Submarine Operator (Method 2)
+kind get kubeconfig --name submarine > kind_kubeconfig
+KUBECONFIG=$(path of kind_kubeconfig)
+./bin/submarine-operator --kubeconfig=${KUBECONFIG} --alsologtostderr --v=7
+```
+
+## Run (Method 2)
+```
+kubectl apply -f submarine-operator
+```
\ No newline at end of file
diff --git a/submarine-cloud/manifests/submarine-operator/deployment.yaml
b/submarine-cloud/manifests/submarine-operator/deployment.yaml
index bca6776..b909525 100644
--- a/submarine-cloud/manifests/submarine-operator/deployment.yaml
+++ b/submarine-cloud/manifests/submarine-operator/deployment.yaml
@@ -14,13 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-apiVersion: extensions/v1beta1
+apiVersion: apps/v1
kind: Deployment
metadata:
name: submarine-operator
namespace: default
spec:
replicas: 1
+ selector:
+ matchLabels:
+ app: "submarine-operator"
strategy:
type: Recreate
template:
diff --git a/submarine-cloud/submarine-operator.md
b/submarine-cloud/submarine-operator.md
deleted file mode 100644
index df0971f..0000000
--- a/submarine-cloud/submarine-operator.md
+++ /dev/null
@@ -1,170 +0,0 @@
-# Submarine Operator Instructions
-
-## Build submarine operator
-
-### Prerequisite
-
-1 Golang environment is required.
-
-2 Submarine project should be in the path of ${GOPATH}/src/github.com/apache/.
-Alternatively, we can create a soft link named submarine, pointing to submarine
-repo, under the path of ${GOPATH}/src/github.com/apache/.
-
-### Build submarine operator binary
-```
-cd ${GOPATH}/src/github.com/apache/submarine/submarine-cloud
-make build
-```
-
-## Run submarine operator locally
-
-Start a kind cluster
-
-```
-cd ${GOPATH}/src/github.com/apache/submarine/submarine-cloud/hack
-./kind-cluster-build.sh --name "submarine"
-```
-
-Run submarine operator
-```
-# create submarine crd
-kubectl apply -f ../manifests/crd.yaml
-KUBECONFIG=$(kind get kubeconfig-path --name submarine)
-./submarine-operator --kubeconfig=${KUBECONFIG} --alsologtostderr --v=7
-OR
-./submarine-operator --kubeconfig=$(kind get kubeconfig-path --name submarine)
--alsologtostderr --v=7
-```
-
-## Submarine operator implementation steps
-
-### Preparation before automatic code generation
-
-1 Create a new directory under the samplecontroller directory and add the
following files
-
-```
-[root@localhost studentcontroller]# tree pkg
-pkg
-├── apis
-│ └── stable
-│ ├── register.go
-│ └── v1
-│ ├── doc.go
-│ ├── register.go
-│ ├── types.go
-Mainly prepare the declaration and registration interface of the resource
object for the code generation tool
-```
-
-2 Download dependencies
-```
-go get -u k8s.io/apimachinery/pkg/apis/meta/v1
-go get -u k8s.io/code-generator/...
-go get -u k8s.io/apiextensions-apiserver/...
-```
-
-### Automatically generate Client, Informer, WorkQueue related code
-```
-[root@localhost launcher-k8s]# export GOPATH=/root/mygolang
-[root@localhost launcher-k8s]# ./hack/update-codegen.sh
-Generating deepcopy funcs
-Generating clientset for stable:v1 at
github.com/gfandada/samplecontroller/pkg/client/clientset
-Generating listers for stable:v1 at
github.com/gfandada/samplecontroller/pkg/client/listers
-Generating informers for stable:v1 at
github.com/gfandada/samplecontroller/pkg/client/informers
-[root@localhost samplecontroller]# tree pkg
-pkg
-├── apis
-│ └── stable
-│ ├── register.go
-│ └── v1
-│ ├── doc.go
-│ ├── register.go
-│ ├── types.go
-│ └── zz_generated.deepcopy.go
-├── client
-│ ├── clientset
-│ │ └── versioned
-│ │ ├── clientset.go
-│ │ ├── doc.go
-│ │ ├── fake
-│ │ │ ├── clientset_generated.go
-│ │ │ ├── doc.go
-│ │ │ └── register.go
-│ │ ├── scheme
-│ │ │ ├── doc.go
-│ │ │ └── register.go
-│ │ └── typed
-│ │ └── stable
-│ │ └── v1
-│ │ ├── doc.go
-│ │ ├── fake
-│ │ │ ├── doc.go
-│ │ │ ├── fake_stable_client.go
-│ │ │ └── fake_student.go
-│ │ ├── generated_expansion.go
-│ │ ├── stable_client.go
-│ │ └── student.go
-│ ├── informers
-│ │ └── externalversions
-│ │ ├── factory.go
-│ │ ├── generic.go
-│ │ ├── internalinterfaces
-│ │ │ └── factory_interfaces.go
-│ │ └── stable
-│ │ ├── interface.go
-│ │ └── v1
-│ │ ├── interface.go
-│ │ └── student.go
-│ └── listers
-│ └── stable
-│ └── v1
-│ ├── expansion_generated.go
-│ └── student.go
-```
-
-### Write controller business logic
-
-Refer to the sample-controller project, it is relatively simple to write
-
-### Startup controller
-```
-[root@localhost samplecontroller]# ./samplecontroller
-// This is a simple custom k8s controller,
-// used to demonstrate the idea of k8s final state operation and maintenance,
-// https://github.com/gfandada/samplecontroller,
-
-Usage:
- samplecontroller [command]
-
-Available Commands:
- help Help about any command
- run run config=[kubeConfig's path]
-
-Flags:
- --config string config file (default is $HOME/.samplecontroller.yaml)
- -h, --help help for samplecontroller
- -t, --toggle Help message for toggle
-
-Use "samplecontroller [command] --help" for more information about a command.
-[root@localhost samplecontroller]# ./samplecontroller run
config=/root/.kube/config
-ERROR: logging before flag.Parse: I0415 15:02:28.619121 109337
samplecontroller.go:59] Create event broadcaster
-ERROR: logging before flag.Parse: I0415 15:02:28.619246 109337
samplecontroller.go:76] Listen for student's add / update / delete events
-ERROR: logging before flag.Parse: I0415 15:02:28.619264 109337
samplecontroller.go:102] Start the controller business and start a cache data
synchronization
-ERROR: logging before flag.Parse: I0415 15:02:28.719511 109337
samplecontroller.go:107] Start 10 workers
-ERROR: logging before flag.Parse: I0415 15:02:28.719547 109337
samplecontroller.go:112] all workers have been started
-......
-
-```
-
-### Modify the crd instance file to observe the controller
-```
-........
-kubectl apply -f test1.yaml
-kubectl describe std test1
-```
-
-### Kind
-
-```
-kind load docker-image --name=submarine busybox:1.28.4
-kind load docker-image --name=submarine
apache/submarine:server-<REPLACE_VERSION>
-kind load docker-image --name=submarine
apache/submarine:database-<REPLACE_VERSION>
-```
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]