| 1 | apiVersion: apps/v1 |
| 2 | kind: Deployment |
| 3 | metadata: |
| 4 | name: {{ include "chart.deployment-name" . | quote }} |
| 5 | namespace: {{ .Release.Namespace }} |
| 6 | labels: |
| 7 | {{- include "chart.labels" . | nindent 4 }} |
| 8 | spec: |
| 9 | replicas: {{ .Values.replicaCount }} |
| 10 | {{- include "chart.strategy" . | nindent 2 }} |
| 11 | selector: |
| 12 | matchLabels: |
| 13 | {{- include "chart.labels" . | nindent 6 }} |
| 14 | progressDeadlineSeconds: 1200 |
| 15 | template: |
| 16 | metadata: |
| 17 | labels: |
| 18 | {{- include "chart.labels" . | nindent 8 }} |
| 19 | spec: |
| 20 | containers: |
| 21 | - name: "vllm" |
| 22 | image: "{{ required "Required value 'image.repository' must be defined !" .Values.image.repository }}:{{ required "Required value 'image.tag' must be defined !" .Values.image.tag }}" |
| 23 | {{- if .Values.image.command }} |
| 24 | command : |
| 25 | {{- with .Values.image.command }} |
| 26 | {{- toYaml . | nindent 10 }} |
| 27 | {{- end }} |
| 28 | {{- end }} |
| 29 | securityContext: |
| 30 | {{- if .Values.image.securityContext }} |
| 31 | {{- with .Values.image.securityContext }} |
| 32 | {{- toYaml . | nindent 12 }} |
| 33 | {{- end }} |
| 34 | {{- else }} |
| 35 | runAsNonRoot: false |
| 36 | {{- include "chart.user" . | indent 12 }} |
| 37 | {{- end }} |
| 38 | imagePullPolicy: IfNotPresent |
| 39 | {{- if .Values.image.env }} |
| 40 | env : |
| 41 | {{- with .Values.image.env }} |
| 42 | {{- toYaml . | nindent 10 }} |
| 43 | {{- end }} |
| 44 | {{- else }} |
| 45 | env: [] |
| 46 | {{- end }} |
| 47 | {{- if or .Values.externalConfigs .Values.configs .Values.secrets }} |
| 48 | envFrom: |
| 49 | {{- if .Values.configs }} |
| 50 | - configMapRef: |
| 51 | name: "{{ .Release.Name }}-configs" |
| 52 | {{- end }} |
| 53 | {{- if .Values.secrets}} |
| 54 | - secretRef: |
| 55 | name: "{{ .Release.Name }}-secrets" |
| 56 | {{- end }} |
| 57 | {{- include "chart.externalConfigs" . | nindent 12 }} |
| 58 | {{- end }} |
| 59 | ports: |
| 60 | - name: {{ include "chart.container-port-name" . }} |
| 61 | containerPort: {{ include "chart.container-port" . }} |
| 62 | {{- include "chart.extraPorts" . | nindent 12 }} |
| 63 | {{- include "chart.probes" . | indent 10 }} |
| 64 | resources: {{- include "chart.resources" . | nindent 12 }} |
| 65 | volumeMounts: |
| 66 | - name: {{ .Release.Name }}-storage |
| 67 | mountPath: /data |
| 68 | |
| 69 | {{- with .Values.extraContainers }} |
| 70 | {{ toYaml . | nindent 8 }} |
| 71 | {{- end }} |
| 72 | |
| 73 | {{- if and .Values.extraInit (or .Values.extraInit.modelDownload.enabled .Values.extraInit.initContainers) }} |
| 74 | initContainers: |
| 75 | {{- if .Values.extraInit.modelDownload.enabled }} |
| 76 | - name: wait-download-model |
| 77 | image: {{ .Values.extraInit.modelDownload.image.repository }}:{{ .Values.extraInit.modelDownload.image.tag }} |
| 78 | imagePullPolicy: {{ .Values.extraInit.modelDownload.image.pullPolicy }} |
| 79 | command: {{ .Values.extraInit.modelDownload.waitContainer.command | toJson }} |
| 80 | args: |
| 81 | {{- toYaml .Values.extraInit.modelDownload.waitContainer.args | nindent 10 }} |
| 82 | env: |
| 83 | {{- if .Values.extraInit.modelDownload.waitContainer.env }} |
| 84 | {{- toYaml .Values.extraInit.modelDownload.waitContainer.env | nindent 10 }} |
| 85 | {{- else }} |
| 86 | {{- include "chart.extraInitEnv" . | nindent 10 }} |
| 87 | {{- end }} |
| 88 | resources: |
| 89 | requests: |
| 90 | cpu: 200m |
| 91 | memory: 1Gi |
| 92 | limits: |
| 93 | cpu: 500m |
| 94 | memory: 2Gi |
| 95 | volumeMounts: |
| 96 | - name: {{ .Release.Name }}-storage |
| 97 | mountPath: /data |
| 98 | {{- end }} |
| 99 | {{- with .Values.extraInit.initContainers }} |
| 100 | {{- toYaml . | nindent 6 }} |
| 101 | {{- end }} |
| 102 | {{- end }} |
| 103 | volumes: |
| 104 | - name: {{ .Release.Name }}-storage |
| 105 | persistentVolumeClaim: |
| 106 | claimName: {{ .Release.Name }}-storage-claim |
| 107 | |
| 108 | {{- with .Values.nodeSelector }} |
| 109 | nodeSelector: |
| 110 | {{- toYaml . | nindent 8 }} |
| 111 | {{- end }} |
| 112 | {{- with .Values.tolerations }} |
| 113 | tolerations: |
| 114 | {{- toYaml . | nindent 8 }} |
| 115 | {{- end }} |
| 116 | {{- if and (gt (int (index .Values.resources.requests "nvidia.com/gpu")) 0) (gt (int (index .Values.resources.limits "nvidia.com/gpu")) 0) }} |
| 117 | runtimeClassName: nvidia |
| 118 | affinity: |
| 119 | nodeAffinity: |
| 120 | requiredDuringSchedulingIgnoredDuringExecution: |
| 121 | nodeSelectorTerms: |
| 122 | - matchExpressions: |
| 123 | - key: nvidia.com/gpu.product |
| 124 | operator: In |
| 125 | {{- with .Values.gpuModels }} |
| 126 | values: |
| 127 | {{- toYaml . | nindent 20 }} |
| 128 | {{- end }} |
| 129 | {{- end }} |