Skip to content

Commit

Permalink
k8s配置优化
Browse files Browse the repository at this point in the history
  • Loading branch information
alber committed Feb 8, 2023
1 parent 0f7f724 commit c8a4cad
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion chart/templates/server/business.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
image: {{ .Values.server.business.image }}
imagePullPolicy: IfNotPresent # 在kind中需要指定,不然会强制到远程拉取镜像,导致部署失败
ports:
- containerPort: 8080
- containerPort: 8000
volumeMounts: # 映射文件为宿主机文件
- mountPath: /log/
name: log
Expand Down
20 changes: 10 additions & 10 deletions chart/templates/server/connect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ spec:
imagePullPolicy: IfNotPresent # 在kind中需要指定,不然会强制到远程拉取镜像,导致部署失败
ports:
- containerPort: 8000
- containerPort: 8080
- containerPort: 8081
- containerPort: 8001
- containerPort: 8002
volumeMounts: # 映射文件为宿主机文件
- mountPath: /log/
name: log
Expand All @@ -47,15 +47,15 @@ spec:
selector:
app: {{ .Values.server.connect.name }}
ports:
- name: tcp
protocol: TCP
port: 8080
targetPort: 8080
- name: websocket
protocol: TCP
port: 8081
targetPort: 8081
- name: rpc
protocol: TCP
port: 8000
targetPort: 8000
- name: tcp
protocol: TCP
port: 8001
targetPort: 8001
- name: websocket
protocol: TCP
port: 8002
targetPort: 8002
2 changes: 1 addition & 1 deletion chart/templates/server/logic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
image: {{ .Values.server.logic.image }}
imagePullPolicy: IfNotPresent # 在kind中需要指定,不然会强制到远程拉取镜像,导致部署失败
ports:
- containerPort: 8080
- containerPort: 8000
volumeMounts: # 映射文件为宿主机文件
- mountPath: /log/
name: log
Expand Down
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ type Configuration struct {
PushAllSubscribeNum int

ConnectLocalAddr string
ConnectWSListenAddr string
ConnectTCPListenAddr string
ConnectRPCListenAddr string
ConnectTCPListenAddr string
ConnectWSListenAddr string

LogicRPCListenAddr string
BusinessRPCListenAddr string
Expand Down
4 changes: 2 additions & 2 deletions config/default_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func (*defaultBuilder) Build() Configuration {

ConnectLocalAddr: "127.0.0.1:8000",
ConnectRPCListenAddr: ":8000",
ConnectWSListenAddr: ":8001",
ConnectTCPListenAddr: ":8002",
ConnectTCPListenAddr: ":8001",
ConnectWSListenAddr: ":8002",

LogicRPCListenAddr: ":8010",
BusinessRPCListenAddr: ":8020",
Expand Down
4 changes: 2 additions & 2 deletions config/k8s_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func (*k8sBuilder) Build() Configuration {

ConnectLocalAddr: os.Getenv("POD_IP") + RPCListenAddr,
ConnectRPCListenAddr: RPCListenAddr,
ConnectWSListenAddr: ":8001",
ConnectTCPListenAddr: ":8002",
ConnectTCPListenAddr: ":8001",
ConnectWSListenAddr: ":8002",

LogicRPCListenAddr: RPCListenAddr,
BusinessRPCListenAddr: RPCListenAddr,
Expand Down
2 changes: 1 addition & 1 deletion test/tcp_conn/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (c *TcpClient) Output(pt pb.PackageType, requestId int64, message proto.Mes
}

func (c *TcpClient) Start() {
connect, err := net.Dial("tcp", "127.0.0.1:8002")
connect, err := net.Dial("tcp", "127.0.0.1:8001")
if err != nil {
log.Println(err)
return
Expand Down
2 changes: 1 addition & 1 deletion test/ws_conn/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type WSClient struct {
}

func (c *WSClient) Start() {
conn, resp, err := websocket.DefaultDialer.Dial("ws://111.229.238.28:8081/ws", http.Header{})
conn, resp, err := websocket.DefaultDialer.Dial("ws://111.229.238.28:8002/ws", http.Header{})
if err != nil {
fmt.Println("dial error", err)
return
Expand Down

0 comments on commit c8a4cad

Please sign in to comment.