|
1 | 1 | {{- define "llm-d-epp.deployment" -}} |
2 | 2 | apiVersion: apps/v1 |
| 3 | +{{- if .Values.router.epp.enablePreferredBackends }} |
| 4 | +kind: StatefulSet |
| 5 | +{{- else }} |
3 | 6 | kind: Deployment |
| 7 | +{{- end }} |
4 | 8 | metadata: |
5 | 9 | name: {{ include "llm-d-router.name" . }} |
6 | 10 | namespace: {{ .Release.Namespace }} |
7 | 11 | labels: |
8 | 12 | {{- include "llm-d-router.labels" . | nindent 4 }} |
9 | 13 | {{- include "llm-d-router.modeLabels" . | nindent 4 }} |
10 | 14 | spec: |
11 | | - replicas: {{ .Values.router.epp.replicas | default 1 }} |
| 15 | + {{- if .Values.router.epp.enablePreferredBackends }} |
| 16 | + serviceName: {{ include "llm-d-router.name" . }} |
| 17 | + {{- end }} |
| 18 | + {{- $replicas := .Values.router.epp.replicas | default 1 }} |
| 19 | + {{- if .Values.router.epp.enablePreferredBackends }} |
| 20 | + {{- $preferredReplicas := .Values.router.epp.preferredReplicas | default 1 | int }} |
| 21 | + {{- $defaultReplicas := .Values.router.epp.defaultReplicas | default 1 | int }} |
| 22 | + {{- $replicas = add $preferredReplicas $defaultReplicas }} |
| 23 | + {{- end }} |
| 24 | + replicas: {{ $replicas }} |
| 25 | + {{- if not .Values.router.epp.enablePreferredBackends }} |
12 | 26 | strategy: |
13 | 27 | # The current recommended EPP deployment pattern is to have a single active replica. This ensures |
14 | 28 | # optimal performance of the stateful operations such prefix cache aware scorer. |
|
17 | 31 | # election, as the rolling update strategy would prevent the old leader being killed because |
18 | 32 | # otherwise the maxUnavailable would be 100%. |
19 | 33 | type: Recreate |
| 34 | + {{- end }} |
20 | 35 | selector: |
21 | 36 | matchLabels: |
22 | 37 | {{- include "llm-d-router.selectorLabels" . | nindent 6 }} |
@@ -129,7 +144,7 @@ spec: |
129 | 144 | - "json" |
130 | 145 | - --config-file |
131 | 146 | - "/config/{{ .Values.router.epp.pluginsConfigFile }}" |
132 | | - {{- if gt (.Values.router.epp.replicas | int) 1 }} |
| 147 | + {{- if and (gt (.Values.router.epp.replicas | int) 1) (not .Values.router.epp.enablePreferredBackends) }} |
133 | 148 | - --ha-enable-leader-election |
134 | 149 | {{- end }} |
135 | 150 | {{- $grpcHealthPort := .Values.router.epp.grpcHealthPort | default 9003 }} |
|
0 commit comments