- 添加global.imageRegistry作为统一镜像仓库地址配置项 - 创建通用image模板函数处理镜像地址拼接逻辑 - 更新所有chart使用新的镜像配置结构 - 在README中添加镜像地址约定说明 - 修改CI命令示例以包含必要的镜像配置参数 - 将硬编码的镜像地址改为通过values动态配置
89 lines
2.6 KiB
YAML
89 lines
2.6 KiB
YAML
{{- range .Values.sharedDatastores }}
|
|
{{- $root := $ }}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ .name }}-statefulset
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/component: {{ .name }}
|
|
spec:
|
|
serviceName: {{ .name }}-service
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/component: {{ .name }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
annotations:
|
|
helm.sh/resource-policy: keep
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: {{ include "mixingx-infra.storageClassName" $root }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .storage }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: {{ .name }}
|
|
spec:
|
|
{{ include "mixingx-infra.tierAffinity" (dict "role" "sharedDatastores" "root" $root) | nindent 6 }}
|
|
containers:
|
|
- name: {{ .name }}
|
|
{{ $image := index $root.Values.images .image }}
|
|
image: {{ include "mixingx-infra.image" (dict "registry" $root.Values.global.imageRegistry "image" $image) | quote }}
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- name: tcp
|
|
containerPort: {{ .port }}
|
|
protocol: TCP
|
|
{{- if eq .name "redis" }}
|
|
command: ["/bin/sh"]
|
|
args:
|
|
- "-c"
|
|
- "redis-server --requirepass {{ $root.Values.sharedInfra.redis.password }} --save 60 1"
|
|
{{- end }}
|
|
{{- if eq .name "mongo" }}
|
|
env:
|
|
- name: MONGO_INITDB_ROOT_USERNAME
|
|
value: "{{ $root.Values.sharedInfra.mongo.username }}"
|
|
- name: MONGO_INITDB_ROOT_PASSWORD
|
|
value: "{{ $root.Values.sharedInfra.mongo.password }}"
|
|
{{- end }}
|
|
{{- if eq .name "messaging" }}
|
|
env:
|
|
- name: RABBITMQ_DEFAULT_USER
|
|
value: "{{ $root.Values.sharedInfra.rabbitmq.username }}"
|
|
- name: RABBITMQ_DEFAULT_PASS
|
|
value: "{{ $root.Values.sharedInfra.rabbitmq.password }}"
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: {{ .mountPath }}
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ .name }}-service
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/component: {{ .name }}
|
|
spec:
|
|
selector:
|
|
app.kubernetes.io/component: {{ .name }}
|
|
ports:
|
|
- name: tcp
|
|
port: {{ .port }}
|
|
targetPort: tcp
|
|
protocol: TCP
|
|
{{- if eq .name "messaging" }}
|
|
- name: management
|
|
port: 15672
|
|
targetPort: 15672
|
|
protocol: TCP
|
|
{{- end }}
|
|
{{- end }}
|