-
Notifications
You must be signed in to change notification settings - Fork 541
Expand file tree
/
Copy pathdeployment.yaml
More file actions
117 lines (117 loc) · 4.79 KB
/
deployment.yaml
File metadata and controls
117 lines (117 loc) · 4.79 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{{- if .Values.gateway.enable }}
{{- $redisHost := default (printf "%s-redis-master" (include "aibrix.fullname" .)) .Values.gatewayPlugin.dependencies.redis.host }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "aibrix.fullname" . }}-gateway-plugins
labels:
{{- include "aibrix.labels" . | nindent 4 }}
app.kubernetes.io/component: aibrix-gateway-plugin
spec:
replicas: {{ .Values.gatewayPlugin.replicaCount }}
selector:
matchLabels:
{{- include "aibrix.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: aibrix-gateway-plugin
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
template:
metadata:
labels:
{{- include "aibrix.labels" . | nindent 8 }}
app.kubernetes.io/component: aibrix-gateway-plugin
spec:
{{- with .Values.gatewayPlugin.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- {{ include "aibrix.name" . }}
- key: app.kubernetes.io/component
operator: In
values:
- aibrix-gateway-plugin
topologyKey: "kubernetes.io/hostname"
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
preference:
matchExpressions:
- key: nvidia.com/gpu.present
operator: NotIn
values:
- "true"
{{- include "aibrix.imagePullSecrets" (dict "componentSecrets" .Values.gatewayPlugin.imagePullSecrets "globalSecrets" .Values.global.imagePullSecrets) | nindent 6 }}
initContainers:
- name: init-c
image: {{ .Values.gatewayPlugin.initContainer.image.repository }}:{{ .Values.gatewayPlugin.initContainer.image.tag }}
{{- if .Values.metadata.redis.enablePassword }}
env:
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "aibrix.fullname" . }}-redis
key: redis-password
command: ['sh', '-c', 'until printf ''AUTH %s\nping\n'' "$REDIS_PASSWORD" | nc {{ $redisHost }} {{ .Values.gatewayPlugin.dependencies.redis.port }} -w 1 | grep -c PONG; do echo waiting for redis; sleep 2; done']
{{- else }}
command: ['sh', '-c', 'until echo "ping" | nc {{ $redisHost }} {{ .Values.gatewayPlugin.dependencies.redis.port }} -w 1 | grep -c PONG; do echo waiting for redis; sleep 2; done']
{{- end }}
containers:
- name: gateway-plugin
image: {{ .Values.gatewayPlugin.container.image.repository }}:{{ .Values.gatewayPlugin.container.image.tag }}
imagePullPolicy: {{ .Values.gatewayPlugin.container.image.imagePullPolicy | default "IfNotPresent" }}
#args:
# - --enable-leader-election=false
# - --leader-election-id=gateway-plugin-lock
# - --leader-election-namespace=aibrix-system
ports:
- name: gateway
containerPort: 50052
- name: profiling
containerPort: 6060
- name: metrics
containerPort: 8080
env:
- name: REDIS_HOST
value: {{ $redisHost }}
- name: REDIS_PORT
value: "{{ .Values.gatewayPlugin.dependencies.redis.port }}"
{{- if .Values.metadata.redis.enablePassword }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "aibrix.fullname" . }}-redis
key: redis-password
{{- end }}
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- range $key, $val := .Values.gatewayPlugin.container.envs }}
- name: {{ $key }}
value: "{{ $val }}"
{{- end }}
resources: {{ toYaml .Values.gatewayPlugin.container.resources | nindent 12 }}
livenessProbe:
{{- toYaml .Values.gatewayPlugin.container.probes.liveness | nindent 12 }}
readinessProbe:
{{- toYaml .Values.gatewayPlugin.container.probes.readiness | nindent 12 }}
serviceAccountName: {{ include "aibrix.gatewayPlugin.serviceAccountName" . }}
{{- end }}