Commit 151c5a8b by 李辉02

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

parent e477e404
{{- $storage := (index .Values.global .Chart.Name "storage") }} {{- $storage := (index .Values.global .Chart.Name "storage") }}
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: StatefulSet
metadata: metadata:
name: {{ .Chart.Name }} name: {{ .Chart.Name }}
namespace: {{ .Values.global.app.namespace }} namespace: {{ .Values.global.app.namespace }}
labels: labels:
app: {{ .Chart.Name }} app: {{ .Chart.Name }}
spec: spec:
serviceName: {{ .Chart.Name }}
replicas: {{ .Values.global.app.replicas }} replicas: {{ .Values.global.app.replicas }}
strategy: updateStrategy:
type: Recreate type: RollingUpdate
selector: selector:
matchLabels: matchLabels:
app: {{ .Chart.Name }} app: {{ .Chart.Name }}
...@@ -19,6 +20,20 @@ spec: ...@@ -19,6 +20,20 @@ spec:
app: {{ .Chart.Name }} app: {{ .Chart.Name }}
spec: spec:
{{- include "app.imagePullSecrets" . | nindent 6 }} {{- 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: containers:
- image: {{ .Values.global.app.imageUrl }}{{ .Chart.Name }}:{{ index .Values.global .Chart.Name "imageVersion" }} - image: {{ .Values.global.app.imageUrl }}{{ .Chart.Name }}:{{ index .Values.global .Chart.Name "imageVersion" }}
name: {{ .Chart.Name }} name: {{ .Chart.Name }}
...@@ -32,14 +47,14 @@ spec: ...@@ -32,14 +47,14 @@ spec:
resources: resources:
{{- include "app.resources" . | nindent 12 }} {{- include "app.resources" . | nindent 12 }}
volumeMounts: volumeMounts:
{{- range $storage.volumes }} - name: app-files
- name: {{ .name }} mountPath: "/app/files"
mountPath: {{ .mountPath }} volumeClaimTemplates:
{{- end }} - metadata:
volumes: name: app-files
{{- range $storage.volumes }} spec:
- name: {{ .name }} accessModes: [ "ReadWriteOnce" ]
hostPath: storageClassName: {{ .Values.global.storageClass.storageClassName | quote }}
path: {{ .hostPath }} resources:
type: DirectoryOrCreate requests:
{{- end }} storage: {{ .Values.global.storageClass.size | quote }}
...@@ -13,7 +13,14 @@ global: ...@@ -13,7 +13,14 @@ global:
namespace: commander-standard-dev namespace: commander-standard-dev
replicas: 1 replicas: 1
imageUrl: k8s-t0.tencentcloudcr.com/commander/ imageUrl: k8s-t0.tencentcloudcr.com/commander/
busybox:
image:
repository: "k8s-t0.tencentcloudcr.com/k8s/busybox"
tag: latest
profiles_active: "prod" profiles_active: "prod"
storageClass:
storageClassName: "cbs"
size: "10Gi"
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
commander-ifs-service: commander-ifs-service:
imageVersion: "2.1.2" imageVersion: "2.1.2"
...@@ -26,12 +33,10 @@ global: ...@@ -26,12 +33,10 @@ global:
charset: "utf8" charset: "utf8"
sslmode: "none" sslmode: "none"
allowUserVariables: "true" allowUserVariables: "true"
# 存储配置 - 直接挂载宿主机目录 # 存储配置
storage: storage:
volumes: mountPath: "/app/files"
- name: rev-video # 需要初始化创建的子目录列表
mountPath: "/app/files/RevVideo" initDirs:
hostPath: "/data/commander-ifs/RevVideo" - RevVideo
- name: rev-images - RevImages
mountPath: "/app/files/RevImages" \ No newline at end of file
hostPath: "/data/commander-ifs/RevImages"
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