File size: 5,203 Bytes
287a0bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
210
211
212
213
214
215
216
217
218
219
220
221
222
# These kubernetes manifests are UNDER ACTIVE  DEVELOPMENT and are not yet ready for production use.
# They will be used for the upcoming distributed version of chroma. They are not even ready
# for testing yet. Please do not use them unless you are working on the distributed version of chroma.

apiVersion: v1
kind: Namespace
metadata:
  name: chroma

---

apiVersion: v1
kind: Service
metadata:
  name: pulsar
  namespace: chroma
spec:
  ports:
    - name: pulsar-port
      port: 6650
      targetPort: 6650
    - name: admin-port
      port: 8080
      targetPort: 8080
  selector:
    app: pulsar
  type: ClusterIP

---

# TODO: Should be stateful set locally or managed via terraform into streamnative for cloud deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pulsar
  namespace: chroma
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pulsar
  template:
    metadata:
      labels:
        app: pulsar
    spec:
      containers:
        - name: pulsar
          image: apachepulsar/pulsar
          command: [ "/pulsar/bin/pulsar", "standalone" ]
          env:
          # This is needed by github actions. We force this to be lower everywehre for now.
          # Since real deployments will configure/use pulsar this way.
            - name: PULSAR_MEM
              value: "-Xms128m -Xmx512m"
          ports:
            - containerPort: 6650
            - containerPort: 8080
          volumeMounts:
            - name: pulsardata
              mountPath: /pulsar/data
          # readinessProbe:
          #   httpGet:
          #     path: /admin/v2/brokers/health
          #     port: 8080
          #   initialDelaySeconds: 10
          #   periodSeconds: 5
          # livenessProbe:
          #   httpGet:
          #     path: /admin/v2/brokers/health
          #     port: 8080
          #   initialDelaySeconds: 20
          #   periodSeconds: 10
      volumes:
        - name: pulsardata
          emptyDir: {}

---

apiVersion: v1
kind: Service
metadata:
  name: server
  namespace: chroma
spec:
  ports:
    - name: server
      port: 8000
      targetPort: 8000
  selector:
    app: server
  type: LoadBalancer

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: server
  namespace: chroma
spec:
  replicas: 1
  selector:
    matchLabels:
      app: server
  template:
    metadata:
      labels:
        app: server
    spec:
      containers:
        - name: server
          image: server
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8000
          volumeMounts:
            - name: chroma
              mountPath: /test
          env:
            - name: IS_PERSISTENT
              value: "TRUE"
            - name: CHROMA_PRODUCER_IMPL
              value: "chromadb.ingest.impl.pulsar.PulsarProducer"
            - name: CHROMA_CONSUMER_IMPL
              value: "chromadb.ingest.impl.pulsar.PulsarConsumer"
            - name: CHROMA_SEGMENT_MANAGER_IMPL
              value: "chromadb.segment.impl.manager.distributed.DistributedSegmentManager"
            - name: PULSAR_BROKER_URL
              value: "pulsar.chroma"
            - name: PULSAR_BROKER_PORT
              value: "6650"
            - name: PULSAR_ADMIN_PORT
              value: "8080"
            - name: ALLOW_RESET
              value: "TRUE"
            - name: CHROMA_SYSDB_IMPL
              value: "chromadb.db.impl.grpc.client.GrpcSysDB"
            - name: CHROMA_SERVER_GRPC_PORT
              value: "50051"
            - name: CHROMA_COORDINATOR_HOST
              value: "coordinator.chroma"
          readinessProbe:
            httpGet:
              path: /api/v1/heartbeat
              port: 8000
            initialDelaySeconds: 10
            periodSeconds: 5
          # livenessProbe:
          #   httpGet:
          #     path: /healthz
          #     port: 8000
          #   initialDelaySeconds: 20
          #   periodSeconds: 10
      # Ephemeral for now
      volumes:
        - name: chroma
          emptyDir: {}

---

# apiVersion: v1
# kind: PersistentVolumeClaim
# metadata:
#   name: index-data
#   namespace: chroma
# spec:
#   accessModes:
#     - ReadWriteOnce
#   resources:
#     requests:
#       storage: 1Gi

apiVersion: apps/v1
kind: Deployment
metadata:
  name: coordinator
  namespace: chroma
spec:
  replicas: 1
  selector:
    matchLabels:
      app: coordinator
  template:
    metadata:
      labels:
        app: coordinator
    spec:
      containers:
        - command:
            - "chroma"
            - "coordinator"
            - "--pulsar-admin-url=http://pulsar.chroma:8080"
            - "--pulsar-url=pulsar://pulsar.chroma:6650"
            - "--notifier-provider=pulsar"
          image: chroma-coordinator
          imagePullPolicy: IfNotPresent
          name: coordinator
          ports:
            - containerPort: 50051
              name: grpc
          resources:
            limits:
              cpu: 100m
              memory: 128Mi

---

apiVersion: v1
kind: Service
metadata:
  name: coordinator
  namespace: chroma
spec:
  ports:
    - name: grpc
      port: 50051
      targetPort: grpc
  selector:
    app: coordinator
  type: ClusterIP