Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #205 from sofastack/fix_quick_start
Browse files Browse the repository at this point in the history
fix make dev and ci
  • Loading branch information
lylingzhen authored Oct 24, 2023
2 parents e574a94 + 1d173c9 commit cadff23
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ jobs:
kubectl apply -f config/rbac/role.yaml
kubectl apply -f config/rbac/role_binding.yaml
kubectl apply -f config/rbac/service_account.yaml
kubectl apply -f config/samples/dynamic-stock-deployment.yaml
kubectl apply -f config/samples/module-deployment-controller.yaml
kubectl apply -f config/samples/dynamic-stock-service.yaml
kubectl apply -f config/samples/ci/dynamic-stock-deployment.yaml
kubectl apply -f config/samples/ci/module-deployment-controller.yaml
kubectl apply -f config/samples/ci/dynamic-stock-service.yaml
- run: sleep 60

Expand Down
2 changes: 1 addition & 1 deletion docs/content/zh-cn/docs/quick-start/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ weight: 200
## 步骤 3:秒级发布模块
执行以下命令:
```bash
kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment.yaml
kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment_provider.yaml
```
即可秒级发布上线模块应用。请等待本地 Module CR 资源 Status 字段值变更为 Available**(约 1 秒,表示模块发布完毕)**,再刷新步骤 2 自动打开的网页,即可看到一个简单的卖书页面,这个卖书逻辑就是在模块里实现的:<br />![image.png](https://intranetproxy.alipay.com/skylark/lark/0/2023/png/671/1694161452232-15aec134-3b2a-491f-9295-0c5f8f7341af.png#clientId=ue383ca9b-aa63-4&from=paste&height=443&id=ub3eb7eb8&originHeight=1318&originWidth=1626&originalType=binary&ratio=2&rotation=0&showTitle=false&size=168110&status=done&style=none&taskId=u07f60163-67e4-42fa-bc41-76e43a09c1f&title=&width=546)

Expand Down
7 changes: 7 additions & 0 deletions module-controller/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ CONTAINER_TOOL ?= docker
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec

MODULE_DEPLOYMENT_YAML_FILE := config/samples/module-deployment-controller.yaml
MODULE_DEPLOYMENT_IMAGE := $(shell awk '/image:/{print $$2}' $(MODULE_DEPLOYMENT_YAML_FILE))
DYNAMIC_STOCK_YAML_FILE := config/samples/dynamic-stock-deployment.yaml
DYNAMIC_STOCK_IMAGE := $(shell awk '/image:/{print $$2}' $(DYNAMIC_STOCK_YAML_FILE))

.PHONY: all
all: build

Expand Down Expand Up @@ -127,6 +132,8 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi

.PHONY: dev
dev: ## create all resource
minikube image load $(MODULE_DEPLOYMENT_IMAGE)
minikube image load $(DYNAMIC_STOCK_IMAGE)
@cat config/dev/dev.txt | xargs -I {} $(KUBECTL) apply -f {}
sleep 5
minikube service dynamic-stock-service
Expand Down
25 changes: 25 additions & 0 deletions module-controller/config/samples/ci/dynamic-stock-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: dynamic-stock-deployment
spec:
replicas: 1
selector:
matchLabels:
app: dynamic-stock
template:
metadata:
labels:
app: dynamic-stock
maxModuleCount: "10"
spec:
containers:
- name: dynamic-stock-container
image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/dynamic-stock-mng:v0.6
ports:
- containerPort: 8080
- containerPort: 1238
resources:
limits:
cpu: "500m"
memory: "1Gi"
14 changes: 14 additions & 0 deletions module-controller/config/samples/ci/dynamic-stock-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: dynamic-stock-service
spec:
selector:
app: dynamic-stock
type: NodePort
ports:
- name: http-port
protocol: TCP
port: 8080
targetPort: 8080
nodePort: 30080
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: module-controller
labels:
app: module-controller
spec:
replicas: 1
selector:
matchLabels:
app: module-controller
template:
metadata:
labels:
app: module-controller
spec:
serviceAccountName: controller-manager
containers:
- name: module-controller
image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/module-controller:ci-test-master-latest
resources:
limits:
cpu: "500m"
memory: "1Gi"
2 changes: 0 additions & 2 deletions module-controller/config/samples/clean.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: dynamic-stock-container
image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/dynamic-stock-mng:v0.6
image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/dynamic-stock-mng:v1.0
ports:
- containerPort: 8080
- containerPort: 1238
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
serviceAccountName: controller-manager
containers:
- name: module-controller
image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/module-controller:ci-test-master-latest
image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/module-controller:v0.6
resources:
limits:
cpu: "500m"
Expand Down

0 comments on commit cadff23

Please sign in to comment.