mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-06 15:11:47 +09:00
The GPU admission webhooks need a Service, a serving certificate and webhook configurations, and the binder's metrics need a port a scrape can reach. All of it renders only with GPU enabled, which the platform sets where KubeVirt serves GPUs, so clusters without KubeVirt change nothing. The webhooks fail closed. The two mutating ones select only VMIs and virt-launcher pods carrying the device-reference label, the pod webhook also requiring the virt-launcher label, so of VMIs and pods a controller outage blocks only the start of VMs with device references; the GPUDevice webhook blocks new orders as well. The controller then runs two replicas behind a PDB, since a single fail-closed replica would block those starts on every rollout. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
88 lines
2.7 KiB
YAML
88 lines
2.7 KiB
YAML
{{- $gpu := .Values.cozystackController.gpu | default dict }}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: cozystack-controller
|
|
labels:
|
|
app: cozystack-controller
|
|
spec:
|
|
{{- if $gpu.enabled }}
|
|
replicas: {{ max 2 .Values.cozystackController.replicas }}
|
|
{{- else }}
|
|
replicas: {{ .Values.cozystackController.replicas }}
|
|
{{- end }}
|
|
selector:
|
|
matchLabels:
|
|
app: cozystack-controller
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: cozystack-controller
|
|
spec:
|
|
serviceAccountName: cozystack-controller
|
|
{{- if $gpu.enabled }}
|
|
# The webhooks fail closed; replicas on one node would go down with it.
|
|
affinity:
|
|
podAntiAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 100
|
|
podAffinityTerm:
|
|
topologyKey: kubernetes.io/hostname
|
|
labelSelector:
|
|
matchLabels:
|
|
app: cozystack-controller
|
|
{{- end }}
|
|
containers:
|
|
- name: cozystack-controller
|
|
image: "{{ .Values.cozystackController.image }}"
|
|
args:
|
|
- --leader-elect
|
|
{{- if .Values.cozystackController.debug }}
|
|
- --zap-log-level=debug
|
|
{{- else }}
|
|
- --zap-log-level=info
|
|
{{- end }}
|
|
{{- if .Values.cozystackController.disableTelemetry }}
|
|
- --disable-telemetry
|
|
{{- end }}
|
|
{{- with .Values.cozystackController.seaweedfsMetricsEndpoint }}
|
|
- --seaweedfs-metrics-endpoint={{ . }}
|
|
{{- end }}
|
|
{{- if $gpu.enabled }}
|
|
- --enable-gpu
|
|
{{- with $gpu.resourceNames }}
|
|
- --gpu-resource-names={{ join "," . }}
|
|
{{- end }}
|
|
- --gpu-raw-resource-names={{ $gpu.rawResourceNames | default "allowed" }}
|
|
- --metrics-bind-address=:8443
|
|
ports:
|
|
- name: webhook
|
|
containerPort: 9443
|
|
- name: metrics
|
|
containerPort: 8443
|
|
- name: health
|
|
containerPort: 8081
|
|
# readyz waits for the GPU, Node, ConfigMap and Namespace caches the
|
|
# webhooks read; the VMI and KubeVirt caches start once KubeVirt
|
|
# serves its kinds, which readiness does not wait for.
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /readyz
|
|
port: health
|
|
volumeMounts:
|
|
- name: webhook-certs
|
|
mountPath: /tmp/k8s-webhook-server/serving-certs
|
|
readOnly: true
|
|
{{- end }}
|
|
{{- with .Values.cozystackController.resources }}
|
|
resources:
|
|
{{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
{{- if $gpu.enabled }}
|
|
volumes:
|
|
- name: webhook-certs
|
|
secret:
|
|
secretName: cozystack-controller-webhook-cert
|
|
defaultMode: 0400
|
|
{{- end }}
|