|
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,59 @@ 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 | +{{- if .Values.router.epp.gkePreferredBackends.enabled }} |
| 285 | +{{- $preferredReplicas := .Values.router.epp.gkePreferredBackends.preferredReplicas | default 1 | int }} |
| 286 | +{{- $defaultReplicas := .Values.router.epp.gkePreferredBackends.defaultReplicas | default 1 | int }} |
| 287 | +{{- $totalReplicas := add $preferredReplicas $defaultReplicas }} |
| 288 | +apiVersion: apps/v1 |
| 289 | +kind: StatefulSet |
| 290 | +metadata: |
| 291 | + name: {{ include "llm-d-router.name" . }} |
| 292 | + namespace: {{ .Release.Namespace }} |
| 293 | + labels: |
| 294 | + {{- include "llm-d-router.labels" . | nindent 4 }} |
| 295 | + {{- include "llm-d-router.modeLabels" . | nindent 4 }} |
| 296 | +spec: |
| 297 | + replicas: {{ $totalReplicas }} |
| 298 | + serviceName: {{ include "llm-d-router.name" . }} |
| 299 | + podManagementPolicy: Parallel |
| 300 | + selector: |
| 301 | + matchLabels: |
| 302 | + {{- include "llm-d-router.selectorLabels" . | nindent 6 }} |
| 303 | + template: |
| 304 | + metadata: |
| 305 | + labels: |
| 306 | + {{- include "llm-d-router.selectorLabels" . | nindent 8 }} |
| 307 | + {{- include "llm-d-router.modeLabels" . | nindent 8 }} |
| 308 | + spec: |
| 309 | +{{ include "llm-d-epp.deployment-pod-spec" . }} |
| 310 | +--- |
| 311 | +{{- else }} |
| 312 | +apiVersion: apps/v1 |
| 313 | +kind: Deployment |
| 314 | +metadata: |
| 315 | + name: {{ include "llm-d-router.name" . }} |
| 316 | + namespace: {{ .Release.Namespace }} |
| 317 | + labels: |
| 318 | + {{- include "llm-d-router.labels" . | nindent 4 }} |
| 319 | + {{- include "llm-d-router.modeLabels" . | nindent 4 }} |
| 320 | +spec: |
| 321 | + replicas: {{ .Values.router.epp.replicas | default 1 }} |
| 322 | + strategy: |
| 323 | + type: Recreate |
| 324 | + selector: |
| 325 | + matchLabels: |
| 326 | + {{- include "llm-d-router.selectorLabels" . | nindent 6 }} |
| 327 | + template: |
| 328 | + metadata: |
| 329 | + labels: |
| 330 | + {{- include "llm-d-router.selectorLabels" . | nindent 8 }} |
| 331 | + {{- include "llm-d-router.modeLabels" . | nindent 8 }} |
| 332 | + spec: |
| 333 | +{{ include "llm-d-epp.deployment-pod-spec" . }} |
308 | 334 | --- |
309 | 335 | {{- end }} |
| 336 | +{{- end }} |
0 commit comments