-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathnlp.yaml
209 lines (206 loc) · 6.88 KB
/
nlp.yaml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nlp
labels:
app: nlp
component: enrichment-pipeline
spec:
replicas: 1
selector:
matchLabels:
app: nlp
strategy: {}
template:
metadata:
labels:
app: nlp
component: enrichment-pipeline
spec:
initContainers:
- name: init-nlp-rabbitmq
image: busybox:1.36.1
env:
- name: RABBITMQ_USER
valueFrom:
secretKeyRef:
name: {{ .Values.rabbitmq.existingSecret }}
key: rabbitmq-admin-user
- name: RABBITMQ_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.rabbitmq.existingSecret }}
key: rabbitmq-admin-password
command: ['sh', '-c', 'until wget "http://$RABBITMQ_USER:$RABBITMQ_PASSWORD@nemesis-rabbitmq-svc.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local:15672/rabbitmq/api/aliveness-test/%2F"; do echo waiting for rabbitmq; sleep 2; done;']
containers:
- env:
- name: ENVIRONMENT
valueFrom:
configMapKeyRef:
name: operation-config
key: environment
- name: LOG_LEVEL
valueFrom:
configMapKeyRef:
name: operation-config
key: log-level
- name: PROMETHEUS_PORT
value: "8000"
- name: PROMETHEUS_DISABLE_CREATED_SERIES
value: "True"
- name: ASSESSMENT_ID
valueFrom:
configMapKeyRef:
name: operation-config
key: assessment-id
- name: AWS_BUCKET
valueFrom:
configMapKeyRef:
name: aws-config
key: aws-bucket
- name: AWS_DEFAULT_REGION
valueFrom:
configMapKeyRef:
name: aws-config
key: aws-default-region
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ .Values.aws.existingSecret }}
key: aws-access-key-id
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.aws.existingSecret }}
key: aws-secret-key
- name: AWS_KMS_KEY_ALIAS
valueFrom:
configMapKeyRef:
name: aws-config
key: aws-kms-key-alias
- name: DATA_DOWNLOAD_DIR
value: "/tmp"
- name: STORAGE_PROVIDER
valueFrom:
configMapKeyRef:
name: operation-config
key: storage_provider
- name: MINIO_ROOT_USER
valueFrom:
secretKeyRef:
name: {{ .Values.minio.existingSecret }}
key: root-user
- name: MINIO_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.minio.existingSecret }}
key: root-password
- name: RABBITMQ_CONNECTION_URI
valueFrom:
secretKeyRef:
name: {{ .Values.rabbitmq.existingSecret }}
key: rabbitmq-connectionuri
- name: ELASTIC_INDEX_NAME
value: "text_embeddings"
- name: EMBEDDING_MODEL
# value: "TaylorAI/bge-micro-v2" # ranked lowest but fastest
value: "TaylorAI/gte-tiny" # ranked higher but slower
# value: "thenlper/gte-small" # ranked highest but slowest
- name: TEXT_CHUNK_SIZE
value: "510"
- name: PLAINTEXT_SIZE_LIMIT
value: "50000000" # max number of bytes for a plaintext doc to prevent indexing of embeddings
# by default NORMALIZE_EMBEDDINGS should normally be false since we're using Cosine similarity
# that only considers vector direction and not magnitude, so we shouldn't
# worry about normalizing the vectors
- name: NORMALIZE_EMBEDDINGS
value: "False"
- name: ELASTICSEARCH_URL
value: http://nemesis-es-internal-http:9200/
- name: ELASTICSEARCH_USER
valueFrom:
secretKeyRef:
name: {{ .Values.elasticsearch.existingSecret }}
key: username
- name: ELASTICSEARCH_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.elasticsearch.existingSecret }}
key: password
- name: ELASTIC_CONNECTION_URI
value: "http://$(ELASTICSEARCH_USER):$(ELASTICSEARCH_PASSWORD)@nemesis-es-internal-http:9200"
image: {{ .Values.nlp.image.repository }}:{{ .Values.nlp.image.tag }}
imagePullPolicy: {{ .Values.nlp.image.pullPolicy }}
name: nemesis-nlp
ports:
- containerPort: 9803
name: nlp-http
# - containerPort: 9801
# name: dotnet-prom
resources: {{ toYaml .Values.nlp.resources | nindent 12 }}
readinessProbe:
httpGet:
path: /ready
port: nlp-http
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 5
failureThreshold: 10
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: nlp
labels:
app: nlp
component: enrichment-pipeline
spec:
type: {{ .Values.nlp.service.type }}
selector:
app: nlp
ports:
- name: http
port: {{ .Values.nlp.service.nlp.port }}
targetPort: 9803
{{- if .Values.nlp.service.nlp.nodePort }}
nodePort: {{ .Values.nlp.service.nlp.nodePort }}
{{- end }}
- name: prometheus
port: {{ .Values.nlp.service.prometheus.port }}
targetPort: 8000
{{- if .Values.nlp.service.prometheus.nodePort }}
nodePort: {{ .Values.nlp.service.prometheus.nodePort }}
{{- end }}
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: nlp-stripprefix
spec:
stripPrefix:
prefixes:
- /nlp
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nlp-ingress
annotations:
traefik.ingress.kubernetes.io/router.middlewares: "{{ .Release.Namespace }}-nlp-stripprefix@kubernetescrd, {{ .Release.Namespace }}-{{ .Values.basicAuth.middlewareName }}@kubernetescrd"
{{- if .Values.nlp.ingress.annotations }}
{{- .Values.nlp.ingress.annotations | toYaml | nindent 4 }}
{{- end }}
spec:
ingressClassName: traefik
rules:
- http:
paths:
- path: /nlp
pathType: Prefix
backend:
service:
name: nlp
port:
number: 9803