A bundle carries what a cluster would download — llmgw's release with its signed checksums, every llama.cpp build per architecture with GitHub's checksums, model files pinned and checked against Hugging Face's — into a directory or a tar whose manifest sha256 is carried apart. Import checks everything, the release against the signing key, before anything is put in the mirror. With offline.mirror set, nodes install llama.cpp from the mirror against checksums the control plane holds and sends over the agent stream; releases default to the mirror for node add, ctl upgrade and agent upgrades. server init and the setup form install from a bundle. The Helm chart runs one control plane with SQLite on a claim or an external PostgreSQL, Secrets for the agent certificate and admin token, Services, Ingress and ServiceMonitor; deploy/container/Dockerfile builds its image. GPU nodes stay outside Kubernetes, as docs/kubernetes.md explains. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
182 lines
6.3 KiB
YAML
182 lines
6.3 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ include "llmgw.fullname" . }}
|
|
labels:
|
|
{{- include "llmgw.labels" . | nindent 4 }}
|
|
spec:
|
|
# One control plane: Kubernetes replaces it within seconds when it goes,
|
|
# and the agents reconnect on their own. See replicas in values.yaml.
|
|
replicas: 1
|
|
serviceName: {{ include "llmgw.fullname" . }}-headless
|
|
selector:
|
|
matchLabels:
|
|
{{- include "llmgw.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "llmgw.selectorLabels" . | nindent 8 }}
|
|
{{- with .Values.podLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
annotations:
|
|
# server.yaml is read at start: a changed one restarts the pod.
|
|
checksum/config: {{ include "llmgw.serverConfig" . | sha256sum }}
|
|
{{- with .Values.podAnnotations }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
# Agents reconnect within seconds of a control plane going; a long
|
|
# grace period only delays the one that replaces it.
|
|
terminationGracePeriodSeconds: 30
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 65532
|
|
runAsGroup: 65532
|
|
fsGroup: 65532
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
containers:
|
|
- name: llmgw
|
|
image: {{ include "llmgw.image" . }}
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
args: ["server", "--config", "/etc/llmgw/server.yaml"]
|
|
env:
|
|
# For `kubectl exec ... -- llmgw ctl`, which reads the token
|
|
# from here; the server reads admin_token_file.
|
|
- name: LLMGW_ADMIN_TOKEN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "llmgw.adminSecret" . }}
|
|
key: {{ if .Values.adminToken.existingSecret }}{{ .Values.adminToken.secretKey }}{{ else }}admin-token{{ end }}
|
|
ports:
|
|
- name: api
|
|
containerPort: 8080
|
|
- name: agents
|
|
containerPort: 7443
|
|
- name: metrics
|
|
containerPort: 9091
|
|
# Up is /health. Ready is /leader: a control plane holds the
|
|
# agents' connections and places models only once it leads — on
|
|
# PostgreSQL, once the lease of the one it replaced has run out. A
|
|
# cluster with no node yet is still ready: /ready would wait for a
|
|
# replica, and nodes could then never connect.
|
|
startupProbe:
|
|
httpGet: {path: /health, port: api}
|
|
periodSeconds: 5
|
|
failureThreshold: 60
|
|
livenessProbe:
|
|
httpGet: {path: /health, port: api}
|
|
periodSeconds: 10
|
|
failureThreshold: 6
|
|
readinessProbe:
|
|
httpGet: {path: /leader, port: api}
|
|
periodSeconds: 5
|
|
failureThreshold: 2
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
readOnlyRootFilesystem: true
|
|
capabilities:
|
|
drop: ["ALL"]
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /etc/llmgw/server.yaml
|
|
subPath: server.yaml
|
|
readOnly: true
|
|
- name: agent-tls
|
|
mountPath: /etc/llmgw/tls
|
|
readOnly: true
|
|
- name: admin-token
|
|
mountPath: /etc/llmgw/admin
|
|
readOnly: true
|
|
{{- if eq .Values.store.type "postgres" }}
|
|
- name: store
|
|
mountPath: /etc/llmgw/store
|
|
readOnly: true
|
|
{{- end }}
|
|
{{- if .Values.offlineChecksums.configMap }}
|
|
- name: offline
|
|
mountPath: /etc/llmgw/offline
|
|
readOnly: true
|
|
{{- end }}
|
|
- name: data
|
|
mountPath: /var/lib/llmgw
|
|
- name: tmp
|
|
mountPath: /tmp
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: {{ include "llmgw.fullname" . }}
|
|
- name: agent-tls
|
|
secret:
|
|
secretName: {{ .Values.agentTLS.existingSecret }}
|
|
defaultMode: 0440
|
|
items:
|
|
- {key: ca.pem, path: ca.pem}
|
|
- {key: server.pem, path: server.pem}
|
|
- {key: server-key.pem, path: server-key.pem}
|
|
- name: admin-token
|
|
secret:
|
|
secretName: {{ include "llmgw.adminSecret" . }}
|
|
defaultMode: 0440
|
|
items:
|
|
- key: {{ if .Values.adminToken.existingSecret }}{{ .Values.adminToken.secretKey }}{{ else }}admin-token{{ end }}
|
|
path: admin-token
|
|
{{- if eq .Values.store.type "postgres" }}
|
|
- name: store
|
|
secret:
|
|
secretName: {{ .Values.store.postgres.existingSecret }}
|
|
defaultMode: 0440
|
|
items:
|
|
- key: {{ .Values.store.postgres.secretKey }}
|
|
path: dsn
|
|
{{- end }}
|
|
{{- if .Values.offlineChecksums.configMap }}
|
|
- name: offline
|
|
configMap:
|
|
name: {{ .Values.offlineChecksums.configMap }}
|
|
items:
|
|
- key: {{ .Values.offlineChecksums.key }}
|
|
path: offline.sha256
|
|
{{- end }}
|
|
- name: tmp
|
|
emptyDir: {}
|
|
{{- if eq .Values.store.type "postgres" }}
|
|
# The store is PostgreSQL; nothing here outlives the pod.
|
|
- name: data
|
|
emptyDir: {}
|
|
{{- end }}
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- if eq .Values.store.type "sqlite" }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
labels:
|
|
{{- include "llmgw.selectorLabels" . | nindent 10 }}
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
{{- with .Values.store.sqlite.storageClass }}
|
|
storageClassName: {{ . }}
|
|
{{- end }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.store.sqlite.size }}
|
|
{{- end }}
|