-
Notifications
You must be signed in to change notification settings - Fork 292
Expand file tree
/
Copy path_service.yaml
More file actions
68 lines (68 loc) · 2.34 KB
/
Copy path_service.yaml
File metadata and controls
68 lines (68 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{{- define "llm-d-epp.service" -}}
{{- $gkePB := include "llm-d-router.gkePreferredBackends" . | fromYaml | default dict -}}
{{- if $gkePB.enabled }}
{{- $preferredReplicas := $gkePB.preferredReplicas | default 1 | int }}
{{- $defaultReplicas := $gkePB.defaultReplicas | default 1 | int }}
{{- $totalReplicas := add $preferredReplicas $defaultReplicas }}
{{- range $i := untilStep 0 (int $totalReplicas) 1 }}
{{- $serviceName := printf "%s-preferred-%d" (include "llm-d-router.name" $) (int $i) }}
{{- if eq (int $i) 0 }}
{{- $serviceName = include "llm-d-router.name" $ }}
{{- else if ge (int $i) (int $preferredReplicas) }}
{{- if eq (int $i) (int $preferredReplicas) }}
{{- $serviceName = printf "%s-backup" (include "llm-d-router.name" $) }}
{{- else }}
{{- $serviceName = printf "%s-backup-%d" (include "llm-d-router.name" $) (sub (int $i) (int $preferredReplicas)) }}
{{- end }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: {{ $serviceName }}
namespace: {{ $.Release.Namespace }}
labels:
{{- include "llm-d-router.labels" $ | nindent 4 }}
annotations:
cloud.google.com/neg: '{"exposed_ports":{"{{ $.Values.router.epp.extProcPort | default 9002 }}":{}}}'
spec:
selector:
statefulset.kubernetes.io/pod-name: {{ printf "%s-%d" (include "llm-d-router.name" $) (int $i) }}
ports:
- name: grpc-ext-proc
protocol: TCP
port: {{ $.Values.router.epp.extProcPort | default 9002 }}
appProtocol: kubernetes.io/h2c
- name: http-metrics
protocol: TCP
port: {{ $.Values.router.metricsPort | default 9090 }}
{{- with $.Values.router.extraServicePorts }}
{{- . | toYaml | nindent 4 }}
{{- end }}
type: ClusterIP
---
{{- end }}
{{- else }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "llm-d-router.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "llm-d-router.labels" . | nindent 4 }}
spec:
selector:
{{- include "llm-d-router.selectorLabels" . | nindent 4 }}
ports:
- name: grpc-ext-proc
protocol: TCP
port: {{ .Values.router.epp.extProcPort | default 9002 }}
appProtocol: kubernetes.io/h2c
- name: http-metrics
protocol: TCP
port: {{ .Values.router.metricsPort | default 9090 }}
{{- with .Values.router.extraServicePorts }}
{{- . | toYaml | nindent 4 }}
{{- end }}
type: ClusterIP
{{- end }}
{{- end }}