feat(chart): add split release charts
This commit is contained in:
1 parent
042a72ec0f
commit
05d7a39a4c
23 files changed
+1366
No files matched your search
@@ -1,5 +1,17 @@
|
||||
# MixingX.Hub.Chart
|
||||
|
||||
> Legacy note: repository root is the historical all-in-one chart. Keep it for compatibility while new GitOps releases migrate to the split charts under `release-charts/`.
|
||||
|
||||
## Recommended Split Charts
|
||||
|
||||
Use these charts for new Argo CD Applications:
|
||||
|
||||
- `release-charts/mixingx-platform` - central platform services.
|
||||
- `release-charts/mixingx-edge-unit` - one edge unit per Helm release.
|
||||
- `release-charts/mixingx-agent-unit` - one agent unit per Helm release.
|
||||
|
||||
The root chart remains available for old CI/manual Helm flows, but new deployments should prefer the split release boundary so platform upgrades do not prune customer-added edge/agent units.
|
||||
|
||||
MixingX 全栈部署 Helm Chart(替代 Aspire publish 生成器)。
|
||||
|
||||
- **name**: `mixingx`
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# MixingX Split Charts
|
||||
|
||||
This directory contains the new release-oriented charts:
|
||||
|
||||
- `mixingx-platform`: central services and shared infrastructure.
|
||||
- `mixingx-edge-unit`: one edge site release.
|
||||
- `mixingx-agent-unit`: one agent site release.
|
||||
|
||||
The chart at the repository root is kept as a legacy all-in-one chart during migration.
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: mixingx-agent-unit
|
||||
description: "One MixingX agent unit release: agent backend, agent web, and agent PostgreSQL."
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.1"
|
||||
@@ -0,0 +1,18 @@
|
||||
# MixingX Agent Unit Chart
|
||||
|
||||
Deploys one agent site as one Helm release:
|
||||
|
||||
- `agent-<site>` backend
|
||||
- `agent-web-<site>` frontend
|
||||
- `agent-<site>-postgres` StatefulSet and retained PVC
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
helm upgrade --install mixingx-agent-workshop-a ./charts/mixingx-agent-unit \
|
||||
--namespace mixingx --create-namespace \
|
||||
--set site=workshop-a \
|
||||
--set nodeName=agent-node-01 \
|
||||
--set storage.className=longhorn \
|
||||
--set tag=2026.07.02-abc1234
|
||||
```
|
||||
@@ -0,0 +1,51 @@
|
||||
{{- define "mixingx-unit.name" -}}
|
||||
{{- printf "%s-%s" .Values.role (.Values.site | toString) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.webName" -}}
|
||||
{{- printf "%s-web-%s" .Values.role (.Values.site | toString) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.database" -}}
|
||||
{{- .Values.database | default (printf "%s-db-%s" .Values.role (.Values.site | toString)) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.serviceId" -}}
|
||||
{{- .Values.serviceId | default (include "mixingx-unit.name" .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.basePath" -}}
|
||||
{{- printf "/%s-%s" .Values.role (.Values.site | toString) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.storageClassName" -}}
|
||||
{{- .Values.storage.className | default "local-path" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.backendScheduling" -}}
|
||||
{{- if .Values.nodeName }}
|
||||
nodeName: {{ .Values.nodeName }}
|
||||
{{- else if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.nodeSelector | indent 2 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.followerScheduling" -}}
|
||||
{{- $name := include "mixingx-unit.name" . -}}
|
||||
{{- if .Values.nodeName }}
|
||||
nodeName: {{ .Values.nodeName }}
|
||||
{{- else }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.nodeSelector | indent 2 }}
|
||||
{{- end }}
|
||||
affinity:
|
||||
podAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
topologyKey: kubernetes.io/hostname
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,236 @@
|
||||
{{- $name := include "mixingx-unit.name" . -}}
|
||||
{{- $webName := include "mixingx-unit.webName" . -}}
|
||||
{{- $database := include "mixingx-unit.database" . -}}
|
||||
{{- $serviceId := include "mixingx-unit.serviceId" . -}}
|
||||
{{- $basePath := include "mixingx-unit.basePath" . -}}
|
||||
{{- $pgHost := printf "%s-postgres-service" $name -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ $name }}-deployment
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
spec:
|
||||
{{ include "mixingx-unit.backendScheduling" . | nindent 6 }}
|
||||
containers:
|
||||
- name: {{ $name }}
|
||||
image: {{ .Values.registry }}/{{ .Values.images.backend }}:{{ .Values.tag | default "latest" }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.ports.backend }}
|
||||
protocol: TCP
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ $name }}-config
|
||||
- secretRef:
|
||||
name: {{ $name }}-secrets
|
||||
env:
|
||||
- name: TZ
|
||||
value: "{{ .Values.timezone | default "Asia/Shanghai" }}"
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
initialDelaySeconds: 120
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 15
|
||||
failureThreshold: 12
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /alive
|
||||
port: http
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
failureThreshold: 8
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $name }}-service
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
mixingx.io/role: {{ .Values.role }}
|
||||
mixingx.io/node-id: {{ $name }}
|
||||
annotations:
|
||||
mixingx.io/description: {{ .Values.description | quote }}
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.ports.backend }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ $name }}-config
|
||||
data:
|
||||
HTTP_PORTS: "{{ .Values.ports.backend }}"
|
||||
REDIS_HOST: "{{ .Values.sharedInfra.redis.host }}"
|
||||
REDIS_PORT: "{{ .Values.sharedInfra.redis.port }}"
|
||||
POSTGRESQL_HOST: "{{ $pgHost }}"
|
||||
POSTGRESQL_PORT: "{{ .Values.sharedInfra.postgres.port }}"
|
||||
POSTGRESQL_USERNAME: "{{ .Values.sharedInfra.postgres.username }}"
|
||||
MESSAGING_HOST: "{{ .Values.sharedInfra.rabbitmq.host }}"
|
||||
MESSAGING_PORT: "{{ .Values.sharedInfra.rabbitmq.port }}"
|
||||
MESSAGING_USERNAME: "{{ .Values.sharedInfra.rabbitmq.username }}"
|
||||
services__gateway__http__0: "http://gateway-service:8080"
|
||||
AGENT_SERVICE_ID: "{{ $serviceId }}"
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: "{{ .Values.sharedInfra.otlp.endpoint }}"
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL: "{{ .Values.sharedInfra.otlp.protocol }}"
|
||||
OTEL_SERVICE_NAME: "{{ $name }}"
|
||||
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ $name }}-secrets
|
||||
type: Opaque
|
||||
stringData:
|
||||
ConnectionStrings__redis: "{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }},password={{ .Values.sharedInfra.redis.password }}"
|
||||
REDIS_PASSWORD: "{{ .Values.sharedInfra.redis.password }}"
|
||||
REDIS_URI: "redis://:{{ .Values.sharedInfra.redis.password }}@{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }}"
|
||||
ConnectionStrings__PostgreSQL: "Host={{ $pgHost }};Port={{ .Values.sharedInfra.postgres.port }};Username={{ .Values.sharedInfra.postgres.username }};Password={{ .Values.sharedInfra.postgres.password }};Database={{ $database }}"
|
||||
POSTGRESQL_PASSWORD: "{{ .Values.sharedInfra.postgres.password }}"
|
||||
POSTGRESQL_URI: "postgresql://{{ .Values.sharedInfra.postgres.username }}:{{ .Values.sharedInfra.postgres.password }}@{{ $pgHost }}:{{ .Values.sharedInfra.postgres.port }}/{{ $database }}"
|
||||
POSTGRESQL_DATABASENAME: "{{ $database }}"
|
||||
ConnectionStrings__messaging: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"
|
||||
MESSAGING_PASSWORD: "{{ .Values.sharedInfra.rabbitmq.password }}"
|
||||
MESSAGING_URI: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ $webName }}-deployment
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/component: {{ $webName }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ $webName }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ $webName }}
|
||||
spec:
|
||||
{{ include "mixingx-unit.followerScheduling" . | nindent 6 }}
|
||||
containers:
|
||||
- name: {{ $webName }}
|
||||
image: {{ .Values.registry }}/{{ .Values.images.frontend }}:{{ .Values.tag | default "latest" }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.ports.frontend }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: TZ
|
||||
value: "{{ .Values.timezone | default "Asia/Shanghai" }}"
|
||||
- name: VITE_BASE_PATH
|
||||
value: "{{ $basePath }}"
|
||||
- name: PORT
|
||||
value: "{{ .Values.ports.frontend }}"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $webName }}-service
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ $webName }}
|
||||
mixingx.io/role: web
|
||||
mixingx.io/node-id: {{ $webName }}
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/component: {{ $webName }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.ports.frontend }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ $name }}-postgres
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ $name }}-postgres
|
||||
spec:
|
||||
serviceName: {{ $name }}-postgres-service
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ $name }}-postgres
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
{{- if .Values.storage.keep }}
|
||||
annotations:
|
||||
helm.sh/resource-policy: keep
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
storageClassName: {{ include "mixingx-unit.storageClassName" . }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.storage.size }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ $name }}-postgres
|
||||
spec:
|
||||
{{ include "mixingx-unit.followerScheduling" . | nindent 6 }}
|
||||
containers:
|
||||
- name: postgres
|
||||
image: {{ .Values.images.postgres }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: POSTGRES_PASSWORD
|
||||
value: "{{ .Values.sharedInfra.postgres.password }}"
|
||||
- name: POSTGRES_DB
|
||||
value: "{{ $database }}"
|
||||
- name: POSTGRES_USER
|
||||
value: "{{ .Values.sharedInfra.postgres.username }}"
|
||||
ports:
|
||||
- name: tcp
|
||||
containerPort: {{ .Values.ports.postgres }}
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $name }}-postgres-service
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ $name }}-postgres
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/component: {{ $name }}-postgres
|
||||
ports:
|
||||
- name: tcp
|
||||
port: {{ .Values.ports.postgres }}
|
||||
targetPort: tcp
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,45 @@
|
||||
registry: 192.168.1.105:8888/mixingx
|
||||
tag: latest
|
||||
timezone: Asia/Shanghai
|
||||
|
||||
role: agent
|
||||
site: "0"
|
||||
description: "Agent 实例 0"
|
||||
serviceId: ""
|
||||
database: ""
|
||||
|
||||
images:
|
||||
backend: agent
|
||||
frontend: agent-web
|
||||
postgres: docker.io/library/postgres:17
|
||||
|
||||
ports:
|
||||
backend: 8080
|
||||
frontend: 80
|
||||
postgres: 5432
|
||||
|
||||
storage:
|
||||
className: local-path
|
||||
size: 5Gi
|
||||
keep: true
|
||||
|
||||
nodeName: ""
|
||||
nodeSelector: {}
|
||||
|
||||
sharedInfra:
|
||||
postgres:
|
||||
username: postgres
|
||||
password: "Admin12345"
|
||||
port: 5432
|
||||
redis:
|
||||
host: redis-service
|
||||
port: 6379
|
||||
password: "Admin12345"
|
||||
rabbitmq:
|
||||
host: messaging-service
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
otlp:
|
||||
endpoint: http://k8s-dashboard-service:18889
|
||||
protocol: grpc
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: mixingx-edge-unit
|
||||
description: "One MixingX edge unit release: edge backend, edge web, and edge PostgreSQL."
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.1"
|
||||
@@ -0,0 +1,18 @@
|
||||
# MixingX Edge Unit Chart
|
||||
|
||||
Deploys one edge site as one Helm release:
|
||||
|
||||
- `edge-<site>` backend
|
||||
- `edge-web-<site>` frontend
|
||||
- `edge-<site>-postgres` StatefulSet and retained PVC
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
helm upgrade --install mixingx-edge-workshop-a ./charts/mixingx-edge-unit \
|
||||
--namespace mixingx --create-namespace \
|
||||
--set site=workshop-a \
|
||||
--set nodeName=edge-node-01 \
|
||||
--set storage.className=longhorn \
|
||||
--set tag=2026.07.02-abc1234
|
||||
```
|
||||
@@ -0,0 +1,51 @@
|
||||
{{- define "mixingx-unit.name" -}}
|
||||
{{- printf "%s-%s" .Values.role (.Values.site | toString) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.webName" -}}
|
||||
{{- printf "%s-web-%s" .Values.role (.Values.site | toString) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.database" -}}
|
||||
{{- .Values.database | default (printf "%s-db-%s" .Values.role (.Values.site | toString)) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.serviceId" -}}
|
||||
{{- .Values.serviceId | default (include "mixingx-unit.name" .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.basePath" -}}
|
||||
{{- printf "/%s-%s" .Values.role (.Values.site | toString) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.storageClassName" -}}
|
||||
{{- .Values.storage.className | default "local-path" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.backendScheduling" -}}
|
||||
{{- if .Values.nodeName }}
|
||||
nodeName: {{ .Values.nodeName }}
|
||||
{{- else if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.nodeSelector | indent 2 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-unit.followerScheduling" -}}
|
||||
{{- $name := include "mixingx-unit.name" . -}}
|
||||
{{- if .Values.nodeName }}
|
||||
nodeName: {{ .Values.nodeName }}
|
||||
{{- else }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.nodeSelector | indent 2 }}
|
||||
{{- end }}
|
||||
affinity:
|
||||
podAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
topologyKey: kubernetes.io/hostname
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,236 @@
|
||||
{{- $name := include "mixingx-unit.name" . -}}
|
||||
{{- $webName := include "mixingx-unit.webName" . -}}
|
||||
{{- $database := include "mixingx-unit.database" . -}}
|
||||
{{- $serviceId := include "mixingx-unit.serviceId" . -}}
|
||||
{{- $basePath := include "mixingx-unit.basePath" . -}}
|
||||
{{- $pgHost := printf "%s-postgres-service" $name -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ $name }}-deployment
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
spec:
|
||||
{{ include "mixingx-unit.backendScheduling" . | nindent 6 }}
|
||||
containers:
|
||||
- name: {{ $name }}
|
||||
image: {{ .Values.registry }}/{{ .Values.images.backend }}:{{ .Values.tag | default "latest" }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.ports.backend }}
|
||||
protocol: TCP
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ $name }}-config
|
||||
- secretRef:
|
||||
name: {{ $name }}-secrets
|
||||
env:
|
||||
- name: TZ
|
||||
value: "{{ .Values.timezone | default "Asia/Shanghai" }}"
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
initialDelaySeconds: 120
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 15
|
||||
failureThreshold: 12
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /alive
|
||||
port: http
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
failureThreshold: 8
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $name }}-service
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
mixingx.io/role: {{ .Values.role }}
|
||||
mixingx.io/node-id: {{ $name }}
|
||||
annotations:
|
||||
mixingx.io/description: {{ .Values.description | quote }}
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/component: {{ $name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.ports.backend }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ $name }}-config
|
||||
data:
|
||||
HTTP_PORTS: "{{ .Values.ports.backend }}"
|
||||
REDIS_HOST: "{{ .Values.sharedInfra.redis.host }}"
|
||||
REDIS_PORT: "{{ .Values.sharedInfra.redis.port }}"
|
||||
POSTGRESQL_HOST: "{{ $pgHost }}"
|
||||
POSTGRESQL_PORT: "{{ .Values.sharedInfra.postgres.port }}"
|
||||
POSTGRESQL_USERNAME: "{{ .Values.sharedInfra.postgres.username }}"
|
||||
MESSAGING_HOST: "{{ .Values.sharedInfra.rabbitmq.host }}"
|
||||
MESSAGING_PORT: "{{ .Values.sharedInfra.rabbitmq.port }}"
|
||||
MESSAGING_USERNAME: "{{ .Values.sharedInfra.rabbitmq.username }}"
|
||||
services__gateway__http__0: "http://gateway-service:8080"
|
||||
EDGE_SERVICE_ID: "{{ $serviceId }}"
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: "{{ .Values.sharedInfra.otlp.endpoint }}"
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL: "{{ .Values.sharedInfra.otlp.protocol }}"
|
||||
OTEL_SERVICE_NAME: "{{ $name }}"
|
||||
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ $name }}-secrets
|
||||
type: Opaque
|
||||
stringData:
|
||||
ConnectionStrings__redis: "{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }},password={{ .Values.sharedInfra.redis.password }}"
|
||||
REDIS_PASSWORD: "{{ .Values.sharedInfra.redis.password }}"
|
||||
REDIS_URI: "redis://:{{ .Values.sharedInfra.redis.password }}@{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }}"
|
||||
ConnectionStrings__PostgreSQL: "Host={{ $pgHost }};Port={{ .Values.sharedInfra.postgres.port }};Username={{ .Values.sharedInfra.postgres.username }};Password={{ .Values.sharedInfra.postgres.password }};Database={{ $database }}"
|
||||
POSTGRESQL_PASSWORD: "{{ .Values.sharedInfra.postgres.password }}"
|
||||
POSTGRESQL_URI: "postgresql://{{ .Values.sharedInfra.postgres.username }}:{{ .Values.sharedInfra.postgres.password }}@{{ $pgHost }}:{{ .Values.sharedInfra.postgres.port }}/{{ $database }}"
|
||||
POSTGRESQL_DATABASENAME: "{{ $database }}"
|
||||
ConnectionStrings__messaging: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"
|
||||
MESSAGING_PASSWORD: "{{ .Values.sharedInfra.rabbitmq.password }}"
|
||||
MESSAGING_URI: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ $webName }}-deployment
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/component: {{ $webName }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ $webName }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ $webName }}
|
||||
spec:
|
||||
{{ include "mixingx-unit.followerScheduling" . | nindent 6 }}
|
||||
containers:
|
||||
- name: {{ $webName }}
|
||||
image: {{ .Values.registry }}/{{ .Values.images.frontend }}:{{ .Values.tag | default "latest" }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.ports.frontend }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: TZ
|
||||
value: "{{ .Values.timezone | default "Asia/Shanghai" }}"
|
||||
- name: VITE_BASE_PATH
|
||||
value: "{{ $basePath }}"
|
||||
- name: PORT
|
||||
value: "{{ .Values.ports.frontend }}"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $webName }}-service
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ $webName }}
|
||||
mixingx.io/role: web
|
||||
mixingx.io/node-id: {{ $webName }}
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/component: {{ $webName }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.ports.frontend }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ $name }}-postgres
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ $name }}-postgres
|
||||
spec:
|
||||
serviceName: {{ $name }}-postgres-service
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ $name }}-postgres
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
{{- if .Values.storage.keep }}
|
||||
annotations:
|
||||
helm.sh/resource-policy: keep
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
storageClassName: {{ include "mixingx-unit.storageClassName" . }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.storage.size }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ $name }}-postgres
|
||||
spec:
|
||||
{{ include "mixingx-unit.followerScheduling" . | nindent 6 }}
|
||||
containers:
|
||||
- name: postgres
|
||||
image: {{ .Values.images.postgres }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: POSTGRES_PASSWORD
|
||||
value: "{{ .Values.sharedInfra.postgres.password }}"
|
||||
- name: POSTGRES_DB
|
||||
value: "{{ $database }}"
|
||||
- name: POSTGRES_USER
|
||||
value: "{{ .Values.sharedInfra.postgres.username }}"
|
||||
ports:
|
||||
- name: tcp
|
||||
containerPort: {{ .Values.ports.postgres }}
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $name }}-postgres-service
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ $name }}-postgres
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/component: {{ $name }}-postgres
|
||||
ports:
|
||||
- name: tcp
|
||||
port: {{ .Values.ports.postgres }}
|
||||
targetPort: tcp
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,45 @@
|
||||
registry: 192.168.1.105:8888/mixingx
|
||||
tag: latest
|
||||
timezone: Asia/Shanghai
|
||||
|
||||
role: edge
|
||||
site: "0"
|
||||
description: "Edge 实例 0"
|
||||
serviceId: ""
|
||||
database: ""
|
||||
|
||||
images:
|
||||
backend: edge
|
||||
frontend: edge-web
|
||||
postgres: docker.io/library/postgres:17
|
||||
|
||||
ports:
|
||||
backend: 8080
|
||||
frontend: 80
|
||||
postgres: 5432
|
||||
|
||||
storage:
|
||||
className: local-path
|
||||
size: 5Gi
|
||||
keep: true
|
||||
|
||||
nodeName: ""
|
||||
nodeSelector: {}
|
||||
|
||||
sharedInfra:
|
||||
postgres:
|
||||
username: postgres
|
||||
password: "Admin12345"
|
||||
port: 5432
|
||||
redis:
|
||||
host: redis-service
|
||||
port: 6379
|
||||
password: "Admin12345"
|
||||
rabbitmq:
|
||||
host: messaging-service
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
otlp:
|
||||
endpoint: http://k8s-dashboard-service:18889
|
||||
protocol: grpc
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: mixingx-platform
|
||||
description: MixingX central platform services without customer edge/agent instances.
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.1"
|
||||
@@ -0,0 +1,14 @@
|
||||
# MixingX Platform Chart
|
||||
|
||||
This chart owns central MixingX services only:
|
||||
|
||||
- `gateway`
|
||||
- `sso` and `sso-web`
|
||||
- `ultra` and `ultra-web`
|
||||
- `audit`
|
||||
- shared `redis`, `mongo`, and `rabbitmq`
|
||||
- platform ingress and Gateway RBAC
|
||||
|
||||
It intentionally does not render `edge` or `agent` instances. Customer or site-specific instances should be deployed with `mixingx-edge-unit` and `mixingx-agent-unit` as separate Helm releases or Argo CD Applications.
|
||||
|
||||
Use this boundary so platform upgrades cannot prune customer-added edge/agent instances.
|
||||
@@ -0,0 +1,37 @@
|
||||
{{- define "mixingx-platform.storageClassName" -}}
|
||||
{{- .Values.storage.className | default "local-path" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-platform.tierAffinity" -}}
|
||||
{{- $root := .root -}}
|
||||
{{- $role := .role -}}
|
||||
{{- if and $root.Values.tier $root.Values.tier.enabled -}}
|
||||
{{- $service := index $root.Values.tier.services $role -}}
|
||||
{{- if $service }}
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
{{- if eq ($service.mode | default "preferred") "required" }}
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: {{ $root.Values.tier.nodeLabel }}
|
||||
operator: In
|
||||
values:
|
||||
{{- range $service.tiers }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
preference:
|
||||
matchExpressions:
|
||||
- key: {{ $root.Values.tier.nodeLabel }}
|
||||
operator: In
|
||||
values:
|
||||
{{- range $service.tiers }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,261 @@
|
||||
{{- define "mixingx-platform.backend" -}}
|
||||
{{- $root := .root -}}
|
||||
{{- $port := .port | default 8080 -}}
|
||||
{{- $pgHost := printf "%s-postgres-service" .name -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .name }}-deployment
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||
app.kubernetes.io/component: {{ .name }}
|
||||
spec:
|
||||
replicas: {{ .replicas | default 1 }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ .name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ .name }}
|
||||
spec:
|
||||
{{- if .rbac }}
|
||||
serviceAccountName: gateway-sa
|
||||
{{- end }}
|
||||
{{ include "mixingx-platform.tierAffinity" (dict "role" .role "root" $root) | nindent 6 }}
|
||||
containers:
|
||||
- name: {{ .name }}
|
||||
image: {{ $root.Values.registry }}/{{ .image }}:{{ $root.Values.tag | default "latest" }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ $port }}
|
||||
protocol: TCP
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ .name }}-config
|
||||
- secretRef:
|
||||
name: {{ .name }}-secrets
|
||||
env:
|
||||
- name: TZ
|
||||
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
||||
{{- if .rbac }}
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
initialDelaySeconds: 120
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 15
|
||||
failureThreshold: 12
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /alive
|
||||
port: http
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
failureThreshold: 8
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .name }}-service
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ .name }}
|
||||
{{- if and .role (ne .role "gateway") }}
|
||||
mixingx.io/role: {{ .role }}
|
||||
mixingx.io/node-id: {{ .name }}
|
||||
{{- end }}
|
||||
{{- if and .role (ne .role "gateway") .description }}
|
||||
annotations:
|
||||
mixingx.io/description: {{ .description | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/component: {{ .name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ $port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .name }}-config
|
||||
data:
|
||||
HTTP_PORTS: "{{ $port }}"
|
||||
REDIS_HOST: "{{ $root.Values.sharedInfra.redis.host }}"
|
||||
REDIS_PORT: "{{ $root.Values.sharedInfra.redis.port }}"
|
||||
POSTGRESQL_HOST: "{{ $pgHost }}"
|
||||
POSTGRESQL_PORT: "{{ $root.Values.sharedInfra.postgres.port }}"
|
||||
POSTGRESQL_USERNAME: "{{ $root.Values.sharedInfra.postgres.username }}"
|
||||
MESSAGING_HOST: "{{ $root.Values.sharedInfra.rabbitmq.host }}"
|
||||
MESSAGING_PORT: "{{ $root.Values.sharedInfra.rabbitmq.port }}"
|
||||
MESSAGING_USERNAME: "{{ $root.Values.sharedInfra.rabbitmq.username }}"
|
||||
{{- if not .rbac }}
|
||||
services__gateway__http__0: "http://gateway-service:8080"
|
||||
{{- end }}
|
||||
{{- if .serviceId }}
|
||||
{{ upper .role }}_SERVICE_ID: "{{ .serviceId }}"
|
||||
{{- end }}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: "{{ $root.Values.sharedInfra.otlp.endpoint }}"
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL: "{{ $root.Values.sharedInfra.otlp.protocol }}"
|
||||
OTEL_SERVICE_NAME: "{{ .name }}"
|
||||
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ .name }}-secrets
|
||||
type: Opaque
|
||||
stringData:
|
||||
ConnectionStrings__redis: "{{ $root.Values.sharedInfra.redis.host }}:{{ $root.Values.sharedInfra.redis.port }},password={{ $root.Values.sharedInfra.redis.password }}"
|
||||
REDIS_PASSWORD: "{{ $root.Values.sharedInfra.redis.password }}"
|
||||
REDIS_URI: "redis://:{{ $root.Values.sharedInfra.redis.password }}@{{ $root.Values.sharedInfra.redis.host }}:{{ $root.Values.sharedInfra.redis.port }}"
|
||||
{{- if .database }}
|
||||
ConnectionStrings__PostgreSQL: "Host={{ $pgHost }};Port={{ $root.Values.sharedInfra.postgres.port }};Username={{ $root.Values.sharedInfra.postgres.username }};Password={{ $root.Values.sharedInfra.postgres.password }};Database={{ .database }}"
|
||||
POSTGRESQL_PASSWORD: "{{ $root.Values.sharedInfra.postgres.password }}"
|
||||
POSTGRESQL_URI: "postgresql://{{ $root.Values.sharedInfra.postgres.username }}:{{ $root.Values.sharedInfra.postgres.password }}@{{ $pgHost }}:{{ $root.Values.sharedInfra.postgres.port }}/{{ .database }}"
|
||||
POSTGRESQL_DATABASENAME: "{{ .database }}"
|
||||
{{- end }}
|
||||
ConnectionStrings__messaging: "amqp://{{ $root.Values.sharedInfra.rabbitmq.username }}:{{ $root.Values.sharedInfra.rabbitmq.password }}@{{ $root.Values.sharedInfra.rabbitmq.host }}:{{ $root.Values.sharedInfra.rabbitmq.port }}"
|
||||
MESSAGING_PASSWORD: "{{ $root.Values.sharedInfra.rabbitmq.password }}"
|
||||
MESSAGING_URI: "amqp://{{ $root.Values.sharedInfra.rabbitmq.username }}:{{ $root.Values.sharedInfra.rabbitmq.password }}@{{ $root.Values.sharedInfra.rabbitmq.host }}:{{ $root.Values.sharedInfra.rabbitmq.port }}"
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-platform.frontend" -}}
|
||||
{{- $root := .root -}}
|
||||
{{- $port := .port | default 80 -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .name }}-deployment
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||
app.kubernetes.io/component: {{ .name }}
|
||||
spec:
|
||||
replicas: {{ .replicas | default 1 }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ .name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ .name }}
|
||||
spec:
|
||||
{{ include "mixingx-platform.tierAffinity" (dict "role" .tierRole "root" $root) | nindent 6 }}
|
||||
containers:
|
||||
- name: {{ .name }}
|
||||
image: {{ $root.Values.registry }}/{{ .image }}:{{ $root.Values.tag | default "latest" }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ $port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: TZ
|
||||
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
||||
- name: VITE_BASE_PATH
|
||||
value: "{{ .basePath }}"
|
||||
- name: PORT
|
||||
value: "{{ $port }}"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .name }}-service
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ .name }}
|
||||
mixingx.io/role: web
|
||||
mixingx.io/node-id: {{ .name }}
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/component: {{ .name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ $port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mixingx-platform.postgres" -}}
|
||||
{{- $root := .root -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ .name }}-postgres
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ .name }}-postgres
|
||||
spec:
|
||||
serviceName: {{ .name }}-postgres-service
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ .name }}-postgres
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
annotations:
|
||||
helm.sh/resource-policy: keep
|
||||
spec:
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
storageClassName: {{ include "mixingx-platform.storageClassName" $root }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .pgStorage | default "5Gi" }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ .name }}-postgres
|
||||
spec:
|
||||
{{ include "mixingx-platform.tierAffinity" (dict "role" .tierRole "root" $root) | nindent 6 }}
|
||||
containers:
|
||||
- name: postgres
|
||||
image: docker.io/library/postgres:17
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: POSTGRES_PASSWORD
|
||||
value: "{{ $root.Values.sharedInfra.postgres.password }}"
|
||||
- name: POSTGRES_DB
|
||||
value: "{{ .database }}"
|
||||
- name: POSTGRES_USER
|
||||
value: "{{ $root.Values.sharedInfra.postgres.username }}"
|
||||
ports:
|
||||
- name: tcp
|
||||
containerPort: {{ $root.Values.sharedInfra.postgres.port }}
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .name }}-postgres-service
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: {{ .name }}-postgres
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/component: {{ .name }}-postgres
|
||||
ports:
|
||||
- name: tcp
|
||||
port: {{ $root.Values.sharedInfra.postgres.port }}
|
||||
targetPort: tcp
|
||||
protocol: TCP
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,65 @@
|
||||
{{- if .Values.audit.enabled }}
|
||||
{{- $root := $ }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: audit-deployment
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: audit
|
||||
spec:
|
||||
replicas: {{ .Values.audit.replicas | default 1 }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: audit
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: audit
|
||||
spec:
|
||||
{{ include "mixingx-platform.tierAffinity" (dict "role" "audit" "root" $root) | nindent 6 }}
|
||||
containers:
|
||||
- name: audit
|
||||
image: "{{ .Values.registry }}/{{ .Values.audit.image }}:{{ .Values.tag | default "latest" }}"
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.audit.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: TZ
|
||||
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
||||
- name: MONGODB_URI
|
||||
value: "mongodb://{{ .Values.sharedInfra.mongo.username }}:{{ .Values.sharedInfra.mongo.password }}@{{ .Values.sharedInfra.mongo.host }}:{{ .Values.sharedInfra.mongo.port }}"
|
||||
- name: MONGODB_DATABASE
|
||||
value: "{{ .Values.sharedInfra.mongo.database }}"
|
||||
- name: RABBITMQ_URI
|
||||
value: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"
|
||||
- name: PORT
|
||||
value: "{{ .Values.audit.port }}"
|
||||
- name: HOST
|
||||
value: "0.0.0.0"
|
||||
- name: OTEL_EXPORTER_OTLP_ENDPOINT
|
||||
value: "{{ .Values.sharedInfra.otlp.endpoint }}"
|
||||
- name: OTEL_SERVICE_NAME
|
||||
value: "audit"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: audit-service
|
||||
labels:
|
||||
app.kubernetes.io/name: mixingx
|
||||
app.kubernetes.io/component: audit
|
||||
mixingx.io/role: audit
|
||||
mixingx.io/node-id: audit
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/component: audit
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.audit.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
@@ -0,0 +1,34 @@
|
||||
{{- if .Values.gateway.rbac }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: gateway-sa
|
||||
labels:
|
||||
app.kubernetes.io/component: gateway
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: gateway-service-reader
|
||||
labels:
|
||||
app.kubernetes.io/component: gateway
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["services"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: gateway-service-reader-binding
|
||||
labels:
|
||||
app.kubernetes.io/component: gateway
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: gateway-service-reader
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: gateway-sa
|
||||
{{- end }}
|
||||
@@ -0,0 +1 @@
|
||||
{{ include "mixingx-platform.backend" (dict "name" "gateway" "image" .Values.gateway.image "port" .Values.gateway.port "role" "gateway" "replicas" .Values.gateway.replicas "rbac" .Values.gateway.rbac "root" $) }}
|
||||
@@ -0,0 +1,22 @@
|
||||
{{- if .Values.ingress.enabled }}
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: app-ingress
|
||||
annotations:
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: web
|
||||
spec:
|
||||
ingressClassName: traefik
|
||||
rules:
|
||||
- host: {{ .Values.ingress.domain }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ .Values.ingress.gatewayService }}
|
||||
port:
|
||||
number: {{ .Values.ingress.gatewayPort }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,87 @@
|
||||
{{- 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-platform.storageClassName" $root }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .storage }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ .name }}
|
||||
spec:
|
||||
{{ include "mixingx-platform.tierAffinity" (dict "role" "sharedDatastores" "root" $root) | nindent 6 }}
|
||||
containers:
|
||||
- name: {{ .name }}
|
||||
image: {{ .image }}
|
||||
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 }}
|
||||
@@ -0,0 +1,6 @@
|
||||
{{- range $inst := .Values.standalones }}
|
||||
{{- $root := $ }}
|
||||
{{ include "mixingx-platform.backend" (dict "name" $inst.name "image" $inst.image "role" $inst.role "replicas" $inst.replicas "serviceId" $inst.serviceId "database" $inst.database "description" $inst.description "root" $root) }}
|
||||
{{ include "mixingx-platform.frontend" (dict "name" $inst.webName "image" $inst.webImage "basePath" $inst.webBasePath "tierRole" $inst.role "root" $root) }}
|
||||
{{ include "mixingx-platform.postgres" (dict "name" $inst.name "database" $inst.database "pgStorage" $inst.pgStorage "tierRole" $inst.role "root" $root) }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,100 @@
|
||||
registry: 192.168.1.105:8888/mixingx
|
||||
tag: latest
|
||||
timezone: Asia/Shanghai
|
||||
|
||||
storage:
|
||||
className: local-path
|
||||
|
||||
sharedInfra:
|
||||
postgres:
|
||||
username: postgres
|
||||
password: "Admin12345"
|
||||
port: 5432
|
||||
redis:
|
||||
host: redis-service
|
||||
port: 6379
|
||||
password: "Admin12345"
|
||||
rabbitmq:
|
||||
host: messaging-service
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
mongo:
|
||||
host: mongo-service
|
||||
port: 27017
|
||||
username: admin
|
||||
password: "Admin12345"
|
||||
database: mixingx_audit
|
||||
otlp:
|
||||
endpoint: http://k8s-dashboard-service:18889
|
||||
protocol: grpc
|
||||
|
||||
tier:
|
||||
enabled: false
|
||||
nodeLabel: mixingx.io/tier
|
||||
services:
|
||||
gateway: { mode: required, tiers: [infra] }
|
||||
sso: { mode: required, tiers: [infra] }
|
||||
ultra: { mode: required, tiers: [infra] }
|
||||
audit: { mode: required, tiers: [infra] }
|
||||
sharedDatastores: { mode: required, tiers: [infra] }
|
||||
|
||||
standalones:
|
||||
- name: sso
|
||||
image: sso
|
||||
role: sso
|
||||
webName: sso-web
|
||||
webImage: sso-web
|
||||
webBasePath: /sso/
|
||||
serviceId: sso
|
||||
database: sso-db
|
||||
pgStorage: 10Gi
|
||||
description: "统一登录"
|
||||
replicas: 2
|
||||
|
||||
- name: ultra
|
||||
image: ultra
|
||||
role: ultra
|
||||
webName: ultra-web
|
||||
webImage: ultra-web
|
||||
webBasePath: /ultra/
|
||||
serviceId: ultra
|
||||
database: ultra-db
|
||||
pgStorage: 10Gi
|
||||
description: "Ultra 看板"
|
||||
replicas: 2
|
||||
|
||||
gateway:
|
||||
image: gateway
|
||||
port: 8080
|
||||
replicas: 2
|
||||
rbac: true
|
||||
|
||||
audit:
|
||||
enabled: true
|
||||
image: audit
|
||||
port: 5600
|
||||
replicas: 2
|
||||
|
||||
sharedDatastores:
|
||||
- name: redis
|
||||
image: docker.io/library/redis:8.6
|
||||
port: 6379
|
||||
storage: 2Gi
|
||||
mountPath: /data
|
||||
- name: mongo
|
||||
image: docker.io/library/mongo:8.3
|
||||
port: 27017
|
||||
storage: 5Gi
|
||||
mountPath: /data/db
|
||||
- name: messaging
|
||||
image: docker.io/library/rabbitmq:4.3-management
|
||||
port: 5672
|
||||
storage: 2Gi
|
||||
mountPath: /var/lib/rabbitmq
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
domain: app.mixingx.local
|
||||
gatewayService: gateway-service
|
||||
gatewayPort: 8080
|
||||
Reference in new issue
Block a user