mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
deploy: helm charts templates for single-node (#587)
This commit is contained in:
1 parent
e88220c424
commit
98a15069eb
14 files changed
+343
-1
No files matched your search
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: backend-config-map
|
||||
labels:
|
||||
app: backend
|
||||
namespace: hydro-namespace
|
||||
data:
|
||||
addon.json: |-
|
||||
{{.Values.Backend.AddonJson | nindent 4}}
|
||||
|
||||
config.json: |-
|
||||
{{.Values.Backend.ConfigJson | nindent 4}}
|
||||
@@ -0,0 +1,63 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: backend
|
||||
name: backend-deployment
|
||||
namespace: hydro-namespace
|
||||
spec:
|
||||
replicas: {{.Values.Backend.Replicas}}
|
||||
revisionHistoryLimit: 1
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: backend
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: backend
|
||||
spec:
|
||||
containers:
|
||||
- name: oj-backend
|
||||
image: {{.Values.Backend.Image}}
|
||||
imagePullPolicy: IfNotPresent
|
||||
volumeMounts:
|
||||
- mountPath: /data/file
|
||||
name: file-volume
|
||||
- mountPath: /root/.hydro
|
||||
name: backend-volume
|
||||
- mountPath: /root/.hydro-config-map
|
||||
name: config-json-volume
|
||||
ports:
|
||||
- name: server-port
|
||||
containerPort: 80
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- |
|
||||
cp /root/.hydro-config-map/addon.json /root/.hydro/ &&
|
||||
cp /root/.hydro-config-map/config.json /root/.hydro/ &&
|
||||
hydrooj
|
||||
|
||||
initContainers:
|
||||
- name: init-mydb
|
||||
image: busybox
|
||||
command:
|
||||
[
|
||||
"sh",
|
||||
"-c",
|
||||
"until nslookup {{.Values.Global.Mongo.SvcDomain}}; do echo waiting for {{.Values.Global.Mongo.SvcDomain}}; sleep 2; done;",
|
||||
]
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: file-volume
|
||||
hostPath:
|
||||
path: {{.Values.Backend.FileVolume}}
|
||||
type: DirectoryOrCreate
|
||||
- name: backend-volume
|
||||
hostPath:
|
||||
path: {{.Values.Backend.BackendVolume}}
|
||||
type: DirectoryOrCreate
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: backend-config-map
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: backend
|
||||
name: backend-service
|
||||
namespace: hydro-namespace
|
||||
spec:
|
||||
ports:
|
||||
- port: {{.Values.Backend.ClusterPort}}
|
||||
name: backend-cluster-endpoint
|
||||
protocol: TCP
|
||||
targetPort: 80
|
||||
selector:
|
||||
app: backend
|
||||
type: ClusterIP
|
||||
@@ -0,0 +1,20 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: hydro-ingress
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
ingress.kubernetes.io/ssl-redirect: "false"
|
||||
namespace: hydro-namespace
|
||||
spec:
|
||||
rules:
|
||||
- host: "backend.boo.foo" # 如果不需要当然也可以去掉HostName
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: backend-service-service
|
||||
port:
|
||||
name: backend-cluster-endpoint
|
||||
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: judge-config-map
|
||||
labels:
|
||||
app: judge
|
||||
namespace: hydro-namespace
|
||||
data:
|
||||
judge.yaml: |-
|
||||
{{.Values.Judge.JudgeYaml | nindent 4}}
|
||||
@@ -0,0 +1,49 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: judge
|
||||
name: judge-deployment
|
||||
namespace: hydro-namespace
|
||||
spec:
|
||||
replicas: {{.Values.Judge.Replicas}}
|
||||
revisionHistoryLimit: 1
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: judge
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: judge
|
||||
spec:
|
||||
containers:
|
||||
- name: oj-judge
|
||||
image: {{.Values.Judge.Image}}
|
||||
imagePullPolicy: IfNotPresent
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- mountPath: /root/.config/hydro
|
||||
name: judge-volume
|
||||
- mountPath: /root/.judge-config-map
|
||||
name: config-json-volume
|
||||
ports:
|
||||
- name: server-port
|
||||
containerPort: 80
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- |
|
||||
cp /root/.judge-config-map/judge.yaml /root/ &&
|
||||
pm2 start sandbox &&
|
||||
pm2-runtime start hydrojudge
|
||||
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: judge-volume
|
||||
hostPath:
|
||||
path: {{.Values.Judge.ConfigVolume}}
|
||||
type: DirectoryOrCreate
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: judge-config-map
|
||||
@@ -0,0 +1,40 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: mongo
|
||||
name: mongo-deployment
|
||||
namespace: hydro-namespace
|
||||
spec:
|
||||
replicas: 1
|
||||
revisionHistoryLimit: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mongo
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mongo
|
||||
spec:
|
||||
containers:
|
||||
- name: oj-mongo
|
||||
image: mongo:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
volumeMounts:
|
||||
- mountPath: /data/db
|
||||
name: localvolume
|
||||
env:
|
||||
- name: MONGO_INITDB_ROOT_USERNAME
|
||||
value: {{.Values.Mongo.Username}}
|
||||
- name: MONGO_INITDB_ROOT_PASSWORD
|
||||
value: {{.Values.Mongo.Password}}
|
||||
ports:
|
||||
- name: db-port
|
||||
containerPort: 27017
|
||||
volumes:
|
||||
- name: localvolume
|
||||
hostPath:
|
||||
path: {{.Values.Mongo.Volume}}
|
||||
type: DirectoryOrCreate
|
||||
@@ -0,0 +1,33 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: mongo
|
||||
name: mongo-service
|
||||
namespace: hydro-namespace
|
||||
spec:
|
||||
ports:
|
||||
- port: {{.Values.Mongo.ClusterPort}}
|
||||
name: mongo-cluster-endpoint
|
||||
protocol: TCP
|
||||
targetPort: 27017
|
||||
selector:
|
||||
app: mongo
|
||||
type: ClusterIP
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: mongo
|
||||
name: mongo-loadbalance-service
|
||||
namespace: hydro-namespace
|
||||
spec:
|
||||
ports:
|
||||
- port: {{.Values.Mongo.LoadBalancerPort}}
|
||||
name: mongo-endpoint
|
||||
protocol: TCP
|
||||
targetPort: 27017
|
||||
selector:
|
||||
app: mongo
|
||||
type: LoadBalancer
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hydro-namespace
|
||||
labels:
|
||||
name: hydro-namespace-label
|
||||
Reference in new issue
Block a user