Files

143 lines
4.3 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "lxdex.fullname" . }}
labels:
{{- include "lxdex.labels" . | nindent 4 }}
spec:
serviceName: {{ include "lxdex.fullname" . }}-headless
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "lxdex.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "lxdex.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "lxdex.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/bin/luxd"]
args:
- "--node-id=$(POD_NAME)"
- "--engine-type={{ .Values.lxdex.engine.type }}"
{{- if .Values.lxdex.engine.enableMLX }}
- "--enable-mlx"
{{- end }}
{{- if .Values.lxdex.engine.enableGPU }}
- "--enable-gpu"
{{- end }}
{{- if .Values.lxdex.consensus.enabled }}
- "--enable-consensus"
- "--consensus-k={{ .Values.lxdex.consensus.k }}"
- "--block-time={{ .Values.lxdex.consensus.blockTime }}"
{{- end }}
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: metadata.name
{{- if .Values.postgresql.enabled }}
- name: POSTGRES_HOST
value: {{ include "lxdex.fullname" . }}-postgresql
- name: POSTGRES_DB
value: {{ .Values.postgresql.auth.database }}
- name: POSTGRES_USER
value: {{ .Values.postgresql.auth.username }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "lxdex.fullname" . }}-postgresql
key: postgres-password
{{- end }}
{{- if .Values.redis.enabled }}
- name: REDIS_HOST
value: {{ include "lxdex.fullname" . }}-redis-master
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "lxdex.fullname" . }}-redis
key: redis-password
{{- end }}
ports:
- name: http
containerPort: 8080
protocol: TCP
- name: websocket
containerPort: 8081
protocol: TCP
- name: grpc
containerPort: 50051
protocol: TCP
- name: qzmq-pub
containerPort: 5555
protocol: TCP
- name: qzmq-sub
containerPort: 5556
protocol: TCP
- name: metrics
containerPort: 9090
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: http
initialDelaySeconds: 10
periodSeconds: 5
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /data
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "{{ .Values.persistence.accessMode }}" ]
storageClassName: {{ .Values.persistence.storageClass }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- end }}