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

jimin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-seata-k8s.git


The following commit(s) were added to refs/heads/master by this push:
     new 7987131  docs: update README.md and add README.zh.md (#9)
7987131 is described below

commit 7987131bd59ea9ac009bcc5eedb8f37efee3232f
Author: Xiangkun Yin <[email protected]>
AuthorDate: Sun Jan 7 22:39:28 2024 +0800

    docs: update README.md and add README.zh.md (#9)
---
 README.md    | 151 ++++++++++++++++++++++++++++++++++++++++++++++-------------
 README.zh.md | 146 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 264 insertions(+), 33 deletions(-)

diff --git a/README.md b/README.md
old mode 100755
new mode 100644
index 117afc5..be897f0
--- a/README.md
+++ b/README.md
@@ -1,52 +1,137 @@
 # seata-k8s
 
-关联项目:
+[中文文档](README.zh.md) 
 
-https://github.com/seata/seata
+Associated Projects:
 
-https://github.com/seata/seata-samples/tree/docker/springboot-dubbo-fescar
+- [https://github.com/seata/seata](https://github.com/seata/seata)
+- 
[https://github.com/seata/seata-samples/tree/docker/springboot-dubbo-fescar](https://github.com/seata/seata-samples/tree/docker/springboot-dubbo-fescar)
+- 
[https://github.com/seata/seata-docker](https://github.com/seata/seata-docker)
 
-https://github.com/seata/seata-docker
+## Method 1: Using Operator
 
-## 方式一: 查看官网在WIN/MAC 快速体验
+### Usage
 
+We haven't officially released the Controller image yet. To experience 
deploying Seata Server using the Operator method, follow these steps:
 
-## 方式二: 使用帮助
-由于一些原因, seata docker 镜像使用暂不提供容器外部调用 ,那么需要案例相关项目也在容器内部 和 seata 镜像保持link模式
+1. Clone this repository:
+
+   ```shell
+   git clone https://github.com/apache/incubator-seata-k8s.git
+   ```
+
+2. Publish the controller image to a private registry:
+
+   ```shell
+   IMG=${IMAGE-TO-PUSH} make docker-build docker-push
+   ```
+
+   If you are using minikube for testing, you can skip the above publishing 
process with the following command:
+
+   ```shell
+   eval $(minikube docker-env)
+   make docker-build
+   ```
+
+3. Deploy Controller, CRD, RBAC, and other resources to the Kubernetes cluster:
+
+   ```shell
+   make deploy
+   kubectl get deployment -n seata-k8s-controller-manager  # check if exists
+   ```
+
+4. You can now deploy your CR to the cluster. An example can be found here 
[seata-server-cluster.yaml](deploy/seata-server-cluster.yaml):
+
+   ```yaml
+   apiVersion: operator.seata.io/v1alpha1
+   kind: SeataServer
+   metadata:
+     name: seata-server
+     namespace: default
+   spec:
+     serviceName: seata-server-cluster
+     replicas: 3
+     image: seataio/seata-server:latest
+     store:
+       resources:
+         requests:
+           storage: 5Gi
+   ```
+
+   For the example above, if everything is correct, the controller will deploy 
3 StatefulSet resources and a Headless Service to the cluster. You can access 
the Seata Server cluster in the cluster through 
`seata-server-0.seata-server-cluster.default.svc`.
+
+### Reference
+
+For CRD details, you can visit 
[operator.seata.io_seataservers.yaml](config/crd/bases/operator.seata.io_seataservers.yaml).
 Here are some important configurations:
+
+1. `serviceName`: Used to define the name of the Headless Service deployed by 
the controller. This will affect how you access the server cluster. In the 
example above, you can access the Seata Server cluster through 
`seata-server-0.seata-server-cluster.default.svc`.
+
+2. `replicas`: Defines the number of Seata Server replicas. Adjusting this 
field achieves scaling without the need for additional HTTP requests to change 
the Seata raft cluster list.
+
+3. `image`: Defines the Seata Server image name.
+
+4. `ports`: Three ports need to be set under the `ports` property: 
`consolePort`, `servicePort`, and `raftPort`, with default values of 7091, 
8091, and 9091, respectively.
+
+5. `resources`: Used to define container resource requirements.
+
+6. `store.resources`: Used to define mounted storage resource requirements.
+
+7. `env`: Environment variables passed to the container. You can use this 
field to define Seata Server configuration. For example:
+
+   ```yaml
+   apiVersion: operator.seata.io/v1alpha1
+   kind: SeataServer
+   metadata:
+     name: seata-server
+     namespace: default
+   spec:
+     image: seataio/seata-server:latest
+     store:
+       resources:
+         requests:
+           storage: 5Gi
+     env:
+       console.user.username: seata
+       console.user.username: seata
+   ```
+
+## Method 2: Example without Using Operator
+
+Due to certain reasons, Seata Docker images currently do not support external 
container calls. Therefore, the example projects should also be kept in link 
mode with the Seata image inside the container.
 
 ```sh
-## 启动 seata deployment (nacos,seata,mysql)
+# Start Seata deployment (nacos,seata,mysql)
 kubectl create -f deploy/seata-deploy.yaml
-## 启动 seata service (nacos,seata,mysql)
-kubectl create -f deploy/seata-service.yaml 
-## 上面会得到一个nodeport ip ( kubectl get service )
-### seata-service           NodePort    10.108.3.238   <none>        
8091:31236/TCP,3305:30992/TCP,8848:30093/TCP   12m
-## 把ip修改到examples/examples-deploy中 用于dns寻址
-## 连接到mysql 导入表结构
-## 启动 example deployment (samples-account,samples-storage)
+# Start Seata service (nacos,seata,mysql)
+kubectl create -f deploy/seata-service.yaml
+# Get a NodePort IP (kubectl get service)
+# Modify the IP in examples/examples-deploy for DNS addressing
+# Connect to MySQL and import table structure
+# Start example deployment (samples-account,samples-storage)
 kubectl create -f example/example-deploy.yaml
-## 启动 example service (samples-account,samples-storage)
+# Start example service (samples-account,samples-storage)
 kubectl create -f example/example-service.yaml
-## 启动 order deployment (samples-order)
+# Start order deployment (samples-order)
 kubectl create -f example/example-deploy.yaml
-## 启动 order service (samples-order)
+# Start order service (samples-order)
 kubectl create -f example/example-service.yaml
-## 启动 business deployment (samples-dubbo-business-call)
-kubectl create -f example/business-deploy.yaml 
-## 启动 business deployment (samples-dubbo-service-call)
-kubectl create -f example/business-service.yaml 
+# Start business deployment (samples-dubbo-business-call)
+kubectl create -f example/business-deploy.yaml
+# Start business deployment (samples-dubbo-service-call)
+kubectl create -f example/business-service.yaml
 ```
 
-### 浏览器 打开 nacos 控制台 http://localhost:8848/nacos/ 看看所有实例是否注册成功
-### 测试
+### Open the Nacos console in your browser [http://localhost:8848/nacos/] to 
check if all instances are registered successfully.
+
+### Testing
+
 ```sh
-# 账户服务  扣费
-curl  -H "Content-Type: application/json" -X POST --data 
"{\"id\":1,\"userId\":\"1\",\"amount\":100}"   
cluster-ip:8102/account/dec_account
-# 库存服务 扣库存
-curl  -H "Content-Type: application/json" -X POST --data 
"{\"commodityCode\":\"C201901140001\",\"count\":100}"   
cluster-ip:8100/storage/dec_storage
-# 订单服务 添加订单 扣费
-curl  -H "Content-Type: application/json" -X POST --data 
"{\"userId\":\"1\",\"commodityCode\":\"C201901140001\",\"orderCount\":10,\"orderAmount\":100}"
   cluster-ip:8101/order/create_order
-# 业务服务 客户端seata版本太低
-curl  -H "Content-Type: application/json" -X POST --data 
"{\"userId\":\"1\",\"commodityCode\":\"C201901140001\",\"count\":10,\"amount\":100}"
   cluster-ip:8104/business/dubbo/buy
+# Account service - Deduct amount
+curl -H "Content-Type: application/json" -X POST --data 
"{\"id\":1,\"userId\":\"1\",\"amount\":100}" cluster-ip:8102/account/dec_account
+# Storage service - Deduct stock
+curl -H "Content-Type: application/json" -X POST --data 
"{\"commodityCode\":\"C201901140001\",\"count\":100}" 
cluster-ip:8100/storage/dec_storage
+# Order service - Add order and deduct amount
+curl -H "Content-Type: application/json" -X POST --data 
"{\"userId\":\"1\",\"commodityCode\":\"C201901140001\",\"orderCount\":10,\"orderAmount\":100}"
 cluster-ip:8101/order/create_order
+# Business service - Client Seata version too low
+curl -H "Content-Type: application/json" -X POST --data 
"{\"userId\":\"1\",\"commodityCode\":\"C201901140001\",\"count\":10,\"amount\":100}"
 cluster-ip:8104/business/dubbo/buy
 ```
-
diff --git a/README.zh.md b/README.zh.md
new file mode 100755
index 0000000..929fd0a
--- /dev/null
+++ b/README.zh.md
@@ -0,0 +1,146 @@
+# seata-k8s
+
+关联项目:
+
+https://github.com/seata/seata
+
+https://github.com/seata/seata-samples/tree/docker/springboot-dubbo-fescar
+
+https://github.com/seata/seata-docker
+
+
+
+## 方式一: 使用 Operator
+
+
+
+### Usage
+
+我们暂未没发布官方的 Controller 镜像,想要体验 Operator 方式部署 Seata Server 可以参照以下方式进行:
+
+1. 克隆本仓库
+
+   ```shell
+   git clone https://github.com/apache/incubator-seata-k8s.git
+   ```
+
+2. 发布 controller 镜像到私有 Registry
+
+   ```shell
+   IMG=${IMAGE-TO-PUSH} make docker-build docker-push
+   ```
+
+   如果你正在使用 minikube 进行测试,可以通过以下命令免去上述的发布流程
+
+   ```shell
+   eval $(minikube docker-env)
+   make docker-build
+   ```
+
+3. 部署 Controller, CRD, RBAC 等资源到 Kubernetes 集群
+
+   ```shell
+   make deploy
+   kubectl get deployment -n seata-k8s-controller-manager  # check if exists
+   ```
+
+4. 此时即可发布你的 CR 到集群当中了,示例可以在这里找到 
[seata-server-cluster.yaml](deploy/seata-server-cluster.yaml)
+
+   ```yaml
+   apiVersion: operator.seata.io/v1alpha1
+   kind: SeataServer
+   metadata:
+     name: seata-server
+     namespace: default
+   spec:
+     serviceName: seata-server-cluster
+     replicas: 3
+     image: seataio/seata-server:latest
+     store:
+       resources:
+         requests:
+           storage: 5Gi
+   
+   ```
+
+   对于上面这个 CR 的例子而言,如果一切正常的话,controller 将会部署 3 个 StatefulSet 资源和一个 Headless 
Service 到集群中;在集群中你可以通过 seata-server-0.seata-server-cluster.default.svc 对 Seata 
Server 集群进行访问。
+
+### Reference
+
+关于 CRD 可以访问  
[operator.seata.io_seataservers.yaml](config/crd/bases/operator.seata.io_seataservers.yaml)
 以查看详细定义,这里列举出一些重要的配置并进行解读。
+
+1. `serviceName`: 用于定义 controller 部署的 Headless Service 的名称,这会影响你访问 server 
集群的方式,比如在之前的示例中,你可以通过 seata-server-0.seata-server-cluster.default.svc 进行访问。
+
+2. `replicas`: 用于定义 Seata Server 的副本数量,你只需要调整该字段即可实现扩缩容,而不需要额外的 HTTP 请求去更改 
Seata raft 集群列表
+
+3. `image`: 定义了 Seata Server 的镜像名称
+
+4. `ports`: 属性下会有三个端口需要设定,分别是 `consolePort`,`servicePort`,  `raftPort`,默认分别为 
7091, 8091, 9091
+
+5. `resources`: 用于定义容器的资源要求
+
+6. `store.resources`: 用于定义挂载的存储资源要求
+
+7. `env`: 传递给容器的环境变量,可以通过此字段去定义 Seata Server 的配置,比如:
+
+   ```yaml
+   apiVersion: operator.seata.io/v1alpha1
+   kind: SeataServer
+   metadata:
+     name: seata-server
+     namespace: default
+   spec:
+     image: seataio/seata-server:latest
+     store:
+       resources:
+         requests:
+           storage: 5Gi
+       env:
+               console.user.username: seata
+               console.user.username: seata
+   ```
+   
+   
+
+
+
+## 方式二: 不使用 Operator 的示例
+
+由于一些原因, seata docker 镜像使用暂不提供容器外部调用 ,那么需要案例相关项目也在容器内部 和 seata 镜像保持link模式
+
+```sh
+## 启动 seata deployment (nacos,seata,mysql)
+kubectl create -f deploy/seata-deploy.yaml
+## 启动 seata service (nacos,seata,mysql)
+kubectl create -f deploy/seata-service.yaml 
+## 上面会得到一个nodeport ip ( kubectl get service )
+### seata-service           NodePort    10.108.3.238   <none>        
8091:31236/TCP,3305:30992/TCP,8848:30093/TCP   12m
+## 把ip修改到examples/examples-deploy中 用于dns寻址
+## 连接到mysql 导入表结构
+## 启动 example deployment (samples-account,samples-storage)
+kubectl create -f example/example-deploy.yaml
+## 启动 example service (samples-account,samples-storage)
+kubectl create -f example/example-service.yaml
+## 启动 order deployment (samples-order)
+kubectl create -f example/example-deploy.yaml
+## 启动 order service (samples-order)
+kubectl create -f example/example-service.yaml
+## 启动 business deployment (samples-dubbo-business-call)
+kubectl create -f example/business-deploy.yaml 
+## 启动 business deployment (samples-dubbo-service-call)
+kubectl create -f example/business-service.yaml 
+```
+
+### 浏览器 打开 nacos 控制台 http://localhost:8848/nacos/ 看看所有实例是否注册成功
+### 测试
+```sh
+# 账户服务  扣费
+curl  -H "Content-Type: application/json" -X POST --data 
"{\"id\":1,\"userId\":\"1\",\"amount\":100}"   
cluster-ip:8102/account/dec_account
+# 库存服务 扣库存
+curl  -H "Content-Type: application/json" -X POST --data 
"{\"commodityCode\":\"C201901140001\",\"count\":100}"   
cluster-ip:8100/storage/dec_storage
+# 订单服务 添加订单 扣费
+curl  -H "Content-Type: application/json" -X POST --data 
"{\"userId\":\"1\",\"commodityCode\":\"C201901140001\",\"orderCount\":10,\"orderAmount\":100}"
   cluster-ip:8101/order/create_order
+# 业务服务 客户端seata版本太低
+curl  -H "Content-Type: application/json" -X POST --data 
"{\"userId\":\"1\",\"commodityCode\":\"C201901140001\",\"count\":10,\"amount\":100}"
   cluster-ip:8104/business/dubbo/buy
+```
+


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

Reply via email to