otto
2 years ago
14 changed files with 254 additions and 280 deletions
@ -1,44 +1,20 @@
|
||||
apiVersion: apps/v1 |
||||
kind: Deployment |
||||
apiVersion: batch/v1beta1 |
||||
kind: CronJob |
||||
metadata: |
||||
name: feedback-deployment |
||||
name: room-hot-compute-job |
||||
namespace: dev |
||||
labels: |
||||
app: feedback |
||||
spec: |
||||
replicas: 2 # 节点资源 |
||||
selector: |
||||
matchLabels: |
||||
app: feedback |
||||
schedule: "*/1 * * * *" |
||||
jobTemplate: |
||||
spec: |
||||
template: |
||||
metadata: # 资源的元数据/属性 |
||||
labels: # 设定资源的标签 |
||||
app: feedback |
||||
spec: |
||||
containers: |
||||
- image: registry.internal.jumaiyx.cn/jm/feedback:1 # 自动化版本往后配置 |
||||
name: feedback |
||||
imagePullPolicy: Always |
||||
ports: |
||||
- name: grpc |
||||
containerPort: 9000 |
||||
protocol: TCP |
||||
- name: room-hot-compute-job |
||||
image: registry.internal.jumaiyx.cn/job/room-server-clear:1 |
||||
imagePullPolicy: IfNotPresent |
||||
command: |
||||
- ./server |
||||
restartPolicy: OnFailure |
||||
imagePullSecrets: |
||||
- name: registry-harbor |
||||
--- |
||||
apiVersion: v1 |
||||
kind: Service |
||||
metadata: |
||||
name: feedback-service # 改名字对应服务发现serviceName |
||||
namespace: dev |
||||
labels: |
||||
name: feedback |
||||
spec: |
||||
type: ClusterIP |
||||
ports: |
||||
- name: grpc |
||||
port: 9000 |
||||
targetPort: grpc |
||||
protocol: TCP |
||||
selector: |
||||
app: feedback |
@ -1,8 +0,0 @@
|
||||
package pkg |
||||
|
||||
import ( |
||||
"git.gz.internal.jumaiyx.cn/job/room-server-clear/pkg/room" |
||||
"github.com/google/wire" |
||||
) |
||||
|
||||
var ProviderPkgSet = wire.NewSet(room.NewRoomService) |
@ -1,42 +0,0 @@
|
||||
package room |
||||
|
||||
import ( |
||||
"context" |
||||
v1 "git.gz.internal.jumaiyx.cn/jm/jmproto/room/v1" |
||||
k8s_client "git.gz.internal.jumaiyx.cn/pkg/k8s-client" |
||||
"git.gz.internal.jumaiyx.cn/pkg/kubediscovery" |
||||
"git.gz.internal.jumaiyx.cn/pkg/log" |
||||
) |
||||
|
||||
type RoomService struct { |
||||
client v1.RoomClient |
||||
log log.Logger |
||||
} |
||||
|
||||
func NewRoomService(log log.Logger) (*RoomService, error) { |
||||
discovery, err := kubediscovery.Discovery(context.TODO(), log, "room-service", kubediscovery.Namespace(k8s_client.DevNamespace)) |
||||
if err != nil { |
||||
log.Errorf("Connect room service failed:%v", err) |
||||
return nil, err |
||||
} |
||||
client := v1.NewRoomClient(discovery) |
||||
return &RoomService{client: client, log: log}, nil |
||||
} |
||||
|
||||
func (ser *RoomService) GetList(ctx context.Context, req *v1.ListRoomRequest) (*v1.ListRoomReply, error) { |
||||
room, err := ser.client.ListRoom(ctx, req) |
||||
if err != nil { |
||||
ser.log.Errorf("Get room list failed:%v", err) |
||||
return nil, err |
||||
} |
||||
return room, nil |
||||
} |
||||
|
||||
func (ser *RoomService) GetRoom(ctx context.Context, req *v1.GetRoomRequest) (*v1.GetRoomReply, error) { |
||||
room, err := ser.client.GetRoom(ctx, req) |
||||
if err != nil { |
||||
ser.log.Errorf("Get room list failed:%v", err) |
||||
return nil, err |
||||
} |
||||
return room, nil |
||||
} |
Loading…
Reference in new issue