Commit 151c5a8b by 李辉02

feat(改成StatefulSet部署,解决存储问题): 修改ifs

parent e477e404
{{- $storage := (index .Values.global .Chart.Name "storage") }}
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: {{ .Chart.Name }}
namespace: {{ .Values.global.app.namespace }}
labels:
app: {{ .Chart.Name }}
spec:
serviceName: {{ .Chart.Name }}
replicas: {{ .Values.global.app.replicas }}
strategy:
type: Recreate
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
app: {{ .Chart.Name }}
......@@ -19,6 +20,20 @@ spec:
app: {{ .Chart.Name }}
spec:
{{- include "app.imagePullSecrets" . | nindent 6 }}
initContainers:
- name: init-dirs
image: "{{ .Values.global.busybox.image.repository }}:{{ .Values.global.busybox.image.tag }}"
command:
- sh
- -c
- |
{{- range $storage.initDirs }}
mkdir -p {{ $storage.mountPath }}/{{ . }}
{{- end }}
chmod -R 777 {{ $storage.mountPath }}
volumeMounts:
- name: app-files
mountPath: {{ $storage.mountPath }}
containers:
- image: {{ .Values.global.app.imageUrl }}{{ .Chart.Name }}:{{ index .Values.global .Chart.Name "imageVersion" }}
name: {{ .Chart.Name }}
......@@ -32,14 +47,14 @@ spec:
resources:
{{- include "app.resources" . | nindent 12 }}
volumeMounts:
{{- range $storage.volumes }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
{{- end }}
volumes:
{{- range $storage.volumes }}
- name: {{ .name }}
hostPath:
path: {{ .hostPath }}
type: DirectoryOrCreate
{{- end }}
- name: app-files
mountPath: "/app/files"
volumeClaimTemplates:
- metadata:
name: app-files
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.global.storageClass.storageClassName | quote }}
resources:
requests:
storage: {{ .Values.global.storageClass.size | quote }}
......@@ -13,7 +13,14 @@ global:
namespace: commander-standard-dev
replicas: 1
imageUrl: k8s-t0.tencentcloudcr.com/commander/
busybox:
image:
repository: "k8s-t0.tencentcloudcr.com/k8s/busybox"
tag: latest
profiles_active: "prod"
storageClass:
storageClassName: "cbs"
size: "10Gi"
# ------------------------------------------------------------------------------
commander-ifs-service:
imageVersion: "2.1.2"
......@@ -26,12 +33,10 @@ global:
charset: "utf8"
sslmode: "none"
allowUserVariables: "true"
# 存储配置 - 直接挂载宿主机目录
# 存储配置
storage:
volumes:
- name: rev-video
mountPath: "/app/files/RevVideo"
hostPath: "/data/commander-ifs/RevVideo"
- name: rev-images
mountPath: "/app/files/RevImages"
hostPath: "/data/commander-ifs/RevImages"
mountPath: "/app/files"
# 需要初始化创建的子目录列表
initDirs:
- RevVideo
- RevImages
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment