feat: 添加cicd

Signed-off-by: devad <cossjie@foxmail.com>
This commit is contained in:
devad 2023-03-23 09:57:13 +08:00
parent a559a2fae7
commit b2760300f9
12 changed files with 249 additions and 23 deletions

View File

@ -1,9 +1,12 @@
AC-grpc:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-ac adaptor/PCM-HPC/PCM-AC/rpc/hpcac.go
pcm-ac:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-ac adaptor/PCM-HPC/PCM-AC/rpc/pcmac.go
PCM-core:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-core adaptor/PCM-CORE/api/slurmcore.go
pcm-kubeNative:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-kubenative adaptor/PCM-K8S/PCM-K8S-NATIVE/rpc/pcmkubenative.go
build: AC-grpc PCM-core
pcm-core:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-core adaptor/PCM-CORE/api/pcm.go
.PHONY: AC-grpc PCM-core build
build: pcm-ac pcm-kubeNative pcm-core
.PHONY: pcm-ac pcm-kubeNative pcm-core

View File

@ -0,0 +1,20 @@
FROM alpine:3.16.2
WORKDIR /home
# 修改alpine源为上海交通大学
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.sjtug.sjtu.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk upgrade && \
apk add --no-cache ca-certificates && update-ca-certificates && \
apk add --update tzdata && \
rm -rf /var/cache/apk/*
COPY pcm-core /home/
COPY etc/pcm.yaml /home/
ENV TZ=Asia/Shanghai
EXPOSE 8999
ENTRYPOINT ./pcm-core -f pcm.yaml

View File

@ -0,0 +1,20 @@
FROM alpine:3.16.2
WORKDIR /home
# 修改alpine源为上海交通大学
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.sjtug.sjtu.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk upgrade && \
apk add --no-cache ca-certificates && update-ca-certificates && \
apk add --update tzdata && \
rm -rf /var/cache/apk/*
COPY pcm-ac /home/
COPY etc/hpcac.yaml /home/
ENV TZ=Asia/Shanghai
EXPOSE 2008
ENTRYPOINT ./pcm-ac -f hpcac.yaml

View File

@ -1,17 +0,0 @@
Name: hpcac.rpc
ListenOn: 127.0.0.1:2008
Etcd:
Hosts:
- 10.101.15.170:31890
Key: hpcac.rpc
User: root
Pass: I9wLvrRufj
ClusterUrl: "https://api01.hpccube.com:65106/hpc/openapi/v2/cluster"
TokenUrl: "https://api01.hpccube.com:65102/ac/openapi/v2/tokens"
StateUrl: "https://api01.hpccube.com:65102/ac/openapi/v2/tokens/state"
User: "zhijiang"
Password: "111111a"
OrgId: "313ae32df03bc116255e6808949fcf57"
Layout: "2006-01-02 15:04:05"
EndPoint: https://api01.hpccube.com:65106

View File

@ -0,0 +1,20 @@
FROM alpine:3.16.2
WORKDIR /home
# 修改alpine源为上海交通大学
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.sjtug.sjtu.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk upgrade && \
apk add --no-cache ca-certificates && update-ca-certificates && \
apk add --update tzdata && \
rm -rf /var/cache/apk/*
COPY pcm-kubenative /home/
COPY etc/kubenative.yaml /home/
ENV TZ=Asia/Shanghai
EXPOSE 2005
ENTRYPOINT ./pcm-kubenative -f kubenative.yaml

View File

@ -0,0 +1,44 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: pcm-ac-deployment
namespace: jcce-system
labels:
k8s-app: pcm-ac
spec:
replicas: 1
selector:
matchLabels:
k8s-app: pcm-ac
template:
metadata:
name: pcm-ac
labels:
k8s-app: pcm-ac
spec:
imagePullSecrets:
- name: SECRET_NAME
containers:
- name: pcm-ac
image: hub.jcce.dev:18443/repository/docker-hub/jcce/pcm-ac
resources: {}
imagePullPolicy: Always
securityContext:
privileged: false
procMount: Default
ports:
- containerPort: 80
volumeMounts: []
volumes: []
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
namespace: jcce-system
name: pcm-ac-service
labels:
k8s-service: pcm-ac
spec:
selector:
k8s-app: pcm-ac
ports:
- name: web
protocol: TCP
port: 2008
targetPort: 2008
type: ClusterIP

View File

@ -0,0 +1,44 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: pcm-core-deployment
namespace: jcce-system
labels:
k8s-app: pcm-core
spec:
replicas: 1
selector:
matchLabels:
k8s-app: pcm-core
template:
metadata:
name: pcm-core
labels:
k8s-app: pcm-core
spec:
imagePullSecrets:
- name: SECRET_NAME
containers:
- name: pcm-core
image: hub.jcce.dev:18443/repository/docker-hub/jcce/pcm-core
resources: {}
imagePullPolicy: Always
securityContext:
privileged: false
procMount: Default
ports:
- containerPort: 80
volumeMounts: []
volumes: []
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
namespace: jcce-system
name: pcm-core-service
labels:
k8s-service: pcm-core
spec:
selector:
k8s-app: pcm-core
ports:
- name: web
protocol: TCP
port: 8999
targetPort: 8999
type: ClusterIP

View File

@ -0,0 +1,44 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: pcm-kubenative-deployment
namespace: jcce-system
labels:
k8s-app: pcm-kubenative
spec:
replicas: 1
selector:
matchLabels:
k8s-app: pcm-kubenative
template:
metadata:
name: pcm-kubenative
labels:
k8s-app: pcm-kubenative
spec:
imagePullSecrets:
- name: SECRET_NAME
containers:
- name: pcm-kubenative
image: hub.jcce.dev:18443/repository/docker-hub/jcce/pcm-kubenative
resources: {}
imagePullPolicy: Always
securityContext:
privileged: false
procMount: Default
ports:
- containerPort: 80
volumeMounts: []
volumes: []
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
namespace: jcce-system
name: pcm-kubenative-service
labels:
k8s-service: pcm-kubenative
spec:
selector:
k8s-app: pcm-kubenative
ports:
- name: web
protocol: TCP
port: 2005
targetPort: 2005
type: ClusterIP