|
1 | | -{{- define "llm-d-epp.deployment" -}} |
2 | | -apiVersion: apps/v1 |
3 | | -kind: Deployment |
4 | | -metadata: |
5 | | - name: {{ include "llm-d-router.name" . }} |
6 | | - namespace: {{ .Release.Namespace }} |
7 | | - labels: |
8 | | - {{- include "llm-d-router.labels" . | nindent 4 }} |
9 | | - {{- include "llm-d-router.modeLabels" . | nindent 4 }} |
10 | | -spec: |
11 | | - replicas: {{ .Values.router.epp.replicas | default 1 }} |
12 | | - strategy: |
13 | | - # The current recommended EPP deployment pattern is to have a single active replica. This ensures |
14 | | - # optimal performance of the stateful operations such prefix cache aware scorer. |
15 | | - # The Recreate strategy the old replica is killed immediately, and allow the new replica(s) to |
16 | | - # quickly take over. This is particularly important in the high availability set up with leader |
17 | | - # election, as the rolling update strategy would prevent the old leader being killed because |
18 | | - # otherwise the maxUnavailable would be 100%. |
19 | | - type: Recreate |
20 | | - selector: |
21 | | - matchLabels: |
22 | | - {{- include "llm-d-router.selectorLabels" . | nindent 6 }} |
23 | | - template: |
24 | | - metadata: |
25 | | - labels: |
26 | | - {{- include "llm-d-router.selectorLabels" . | nindent 8 }} |
27 | | - {{- include "llm-d-router.modeLabels" . | nindent 8 }} |
28 | | - spec: |
| 1 | +{{- define "llm-d-epp.deployment-pod-spec" -}} |
29 | 2 | {{- $proxy := include "llm-d-router.proxy" . | fromYaml | default dict }} |
30 | 3 | {{- $proxyType := include "llm-d-router.proxyType" . | trim }} |
31 | 4 | {{- $proxyMode := include "llm-d-router.proxyMode" . | trim }} |
@@ -129,7 +102,7 @@ spec: |
129 | 102 | - "json" |
130 | 103 | - --config-file |
131 | 104 | - "/config/{{ .Values.router.epp.pluginsConfigFile }}" |
132 | | - {{- if gt (.Values.router.epp.replicas | int) 1 }} |
| 105 | + {{- if and (gt (.Values.router.epp.replicas | int) 1) (not .Values.router.epp.gkePreferredBackends.enabled) }} |
133 | 106 | - --ha-enable-leader-election |
134 | 107 | {{- end }} |
135 | 108 | {{- $grpcHealthPort := .Values.router.epp.grpcHealthPort | default 9003 }} |
@@ -305,5 +278,67 @@ spec: |
305 | 278 | tolerations: |
306 | 279 | {{- toYaml .Values.router.epp.tolerations | nindent 8 }} |
307 | 280 | {{- end }} |
| 281 | +{{- end }} |
| 282 | + |
| 283 | +{{- define "llm-d-epp.deployment" -}} |
| 284 | +apiVersion: apps/v1 |
| 285 | +kind: Deployment |
| 286 | +metadata: |
| 287 | + name: {{ include "llm-d-router.name" . }} |
| 288 | + namespace: {{ .Release.Namespace }} |
| 289 | + labels: |
| 290 | + {{- include "llm-d-router.labels" . | nindent 4 }} |
| 291 | + {{- include "llm-d-router.modeLabels" . | nindent 4 }} |
| 292 | +spec: |
| 293 | + {{- $replicas := .Values.router.epp.replicas | default 1 }} |
| 294 | + {{- if .Values.router.epp.gkePreferredBackends.enabled }} |
| 295 | + {{- $replicas = .Values.router.epp.gkePreferredBackends.preferredReplicas | default 1 }} |
| 296 | + {{- end }} |
| 297 | + replicas: {{ $replicas }} |
| 298 | + strategy: |
| 299 | + type: Recreate |
| 300 | + selector: |
| 301 | + matchLabels: |
| 302 | + {{- if .Values.router.epp.gkePreferredBackends.enabled }} |
| 303 | + llm-d-router-gateway: {{ include "llm-d-router.name" . }} |
| 304 | + {{- else }} |
| 305 | + {{- include "llm-d-router.selectorLabels" . | nindent 6 }} |
| 306 | + {{- end }} |
| 307 | + template: |
| 308 | + metadata: |
| 309 | + labels: |
| 310 | + {{- if .Values.router.epp.gkePreferredBackends.enabled }} |
| 311 | + llm-d-router-gateway: {{ include "llm-d-router.name" . }} |
| 312 | + {{- else }} |
| 313 | + {{- include "llm-d-router.selectorLabels" . | nindent 8 }} |
| 314 | + {{- end }} |
| 315 | + {{- include "llm-d-router.modeLabels" . | nindent 8 }} |
| 316 | + spec: |
| 317 | +{{ include "llm-d-epp.deployment-pod-spec" . }} |
| 318 | +{{- if .Values.router.epp.gkePreferredBackends.enabled }} |
| 319 | +--- |
| 320 | +apiVersion: apps/v1 |
| 321 | +kind: Deployment |
| 322 | +metadata: |
| 323 | + name: {{ printf "%s-backup" (include "llm-d-router.name" .) }} |
| 324 | + namespace: {{ .Release.Namespace }} |
| 325 | + labels: |
| 326 | + {{- include "llm-d-router.labels" . | nindent 4 }} |
| 327 | + {{- include "llm-d-router.modeLabels" . | nindent 4 }} |
| 328 | +spec: |
| 329 | + replicas: {{ .Values.router.epp.gkePreferredBackends.defaultReplicas | default 1 }} |
| 330 | + strategy: |
| 331 | + type: Recreate |
| 332 | + selector: |
| 333 | + matchLabels: |
| 334 | + llm-d-router-gateway: {{ printf "%s-backup" (include "llm-d-router.name" .) }} |
| 335 | + template: |
| 336 | + metadata: |
| 337 | + labels: |
| 338 | + llm-d-router-gateway: {{ printf "%s-backup" (include "llm-d-router.name" .) }} |
| 339 | + {{- include "llm-d-router.modeLabels" . | nindent 8 }} |
| 340 | + spec: |
| 341 | +{{ include "llm-d-epp.deployment-pod-spec" . }} |
| 342 | +{{- end }} |
308 | 343 | --- |
309 | 344 | {{- end }} |
0 commit comments