Skip to content

Commit

Permalink
[CLN] Clean up k8s, rename services and values (chroma-core#1881)
Browse files Browse the repository at this point in the history
## Description of changes

*Summarize the changes made by this PR.*
 - Improvements & Bug fixes
	 - Standardize k8s on the naming scheme we agreed on.

## Test plan
*How are these changes tested?*

- [ ] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Documentation Changes
*Are all docstrings for user-facing APIs updated if required? Do we need
to make documentation changes in the [docs
repository](https://github.com/chroma-core/docs)?*
  • Loading branch information
beggers authored Mar 16, 2024
1 parent 41ad7ba commit ea954bf
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 116 deletions.
56 changes: 28 additions & 28 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
update_settings(max_parallel_updates=6)

docker_build(
'local:migration',
'local:sysdb-migration',
context='.',
dockerfile='./go/Dockerfile.migration'
)

docker_build(
'local:coordinator',
'local:sysdb',
context='.',
dockerfile='./go/Dockerfile'
)

docker_build(
'local:frontend-server',
'local:frontend-service',
context='.',
dockerfile='./Dockerfile',
)

docker_build(
'local:worker',
'local:query-service',
context='.',
dockerfile='./rust/worker/Dockerfile'
)
Expand All @@ -40,13 +40,13 @@ k8s_yaml([

# Extra stuff to make debugging and testing easier
k8s_yaml([
'k8s/test/coordinator_service.yaml',
'k8s/test/jaeger_service.yaml',
'k8s/test/logservice_service.yaml',
'k8s/test/sysdb-service.yaml',
'k8s/test/jaeger-service.yaml',
'k8s/test/pulsar-service.yaml',
'k8s/test/logservice-service.yaml',
'k8s/test/minio.yaml',
'k8s/test/pulsar_service.yaml',
'k8s/test/worker_service.yaml',
'k8s/test/test_memberlist_cr.yaml',
'k8s/test/query-service-service.yaml',
'k8s/test/test-memberlist-cr.yaml',
])

# Lots of things assume the cluster is in a basic state. Get it into a basic
Expand All @@ -60,19 +60,19 @@ k8s_resource(
objects=[
'pod-watcher:Role',
'memberlists.chroma.cluster:CustomResourceDefinition',
'worker-memberlist:MemberList',
'query-service-memberlist:MemberList',

'coordinator-serviceaccount:serviceaccount',
'coordinator-serviceaccount-rolebinding:RoleBinding',
'coordinator-worker-memberlist-binding:clusterrolebinding',
'sysdb-serviceaccount:serviceaccount',
'sysdb-serviceaccount-rolebinding:RoleBinding',
'sysdb-query-service-memberlist-binding:clusterrolebinding',

'logservice-serviceaccount:serviceaccount',

'worker-serviceaccount:serviceaccount',
'worker-serviceaccount-rolebinding:RoleBinding',
'worker-memberlist-readerwriter:ClusterRole',
'worker-worker-memberlist-binding:clusterrolebinding',
'worker-memberlist-readerwriter-binding:clusterrolebinding',
'query-service-serviceaccount:serviceaccount',
'query-service-serviceaccount-rolebinding:RoleBinding',
'query-service-memberlist-readerwriter:ClusterRole',
'query-service-query-service-memberlist-binding:clusterrolebinding',
'query-service-memberlist-readerwriter-binding:clusterrolebinding',

'test-memberlist:MemberList',
'test-memberlist-reader:ClusterRole',
Expand All @@ -84,17 +84,17 @@ k8s_resource(
)

# Production Chroma
k8s_resource('postgres', resource_deps=['k8s_setup'], labels=["infrastructure"])
k8s_resource('pulsar', resource_deps=['k8s_setup'], labels=["infrastructure"], port_forwards=['6650:6650', '8080:8080'])
k8s_resource('migration', resource_deps=['postgres'], labels=["infrastructure"])
k8s_resource('logservice', resource_deps=['migration'], labels=["chroma"], port_forwards='50052:50051')
k8s_resource('coordinator', resource_deps=['pulsar', 'migration'], labels=["chroma"], port_forwards='50051:50051')
k8s_resource('frontend-server', resource_deps=['pulsar', 'coordinator', 'logservice'],labels=["chroma"], port_forwards='8000:8000')
k8s_resource('worker', resource_deps=['coordinator', 'pulsar'], labels=["chroma"])
k8s_resource('postgres', resource_deps=['k8s_setup', 'namespace'], labels=["infrastructure"])
k8s_resource('pulsar', resource_deps=['k8s_setup', 'namespace'], labels=["infrastructure"], port_forwards=['6650:6650', '8080:8080'])
k8s_resource('sysdb-migration', resource_deps=['postgres', 'namespace'], labels=["infrastructure"])
k8s_resource('logservice', resource_deps=['sysdb-migration'], labels=["chroma"], port_forwards='50052:50051')
k8s_resource('sysdb', resource_deps=['pulsar', 'sysdb-migration'], labels=["chroma"], port_forwards='50051:50051')
k8s_resource('frontend-service', resource_deps=['pulsar', 'sysdb', 'logservice'],labels=["chroma"], port_forwards='8000:8000')
k8s_resource('query-service', resource_deps=['sysdb', 'pulsar'], labels=["chroma"])

# I have no idea why these need their own lines but the others don't.
k8s_resource(objects=['worker:service'], new_name='worker_service', resource_deps=['worker'], labels=["chroma"])
k8s_resource(objects=['jaeger-lb:Service'], new_name='jaeger_service', resource_deps=['k8s_setup'], labels=["debug"])
k8s_resource(objects=['query-service:service'], new_name='query-service-service', resource_deps=['query-service'], labels=["chroma"])
k8s_resource(objects=['jaeger-lb:Service'], new_name='jaeger-service', resource_deps=['k8s_setup'], labels=["debug"])

# Local S3
k8s_resource('minio-deployment', resource_deps=['k8s_setup'], labels=["debug"], port_forwards='9000:9000')
4 changes: 2 additions & 2 deletions bin/cluster-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ echo "Chroma Server is running at port $CHROMA_SERVER_HOST"
echo "Pulsar Broker is running at port $PULSAR_BROKER_URL"
echo "Chroma Coordinator is running at port $CHROMA_COORDINATOR_HOST"

kubectl -n chroma port-forward svc/coordinator-lb 50051:50051 &
kubectl -n chroma port-forward svc/sysdb-lb 50051:50051 &
kubectl -n chroma port-forward svc/logservice-lb 50052:50051 &
kubectl -n chroma port-forward svc/pulsar-lb 6650:6650 &
kubectl -n chroma port-forward svc/pulsar-lb 8080:8080 &
kubectl -n chroma port-forward svc/frontend-server 8000:8000 &
kubectl -n chroma port-forward svc/frontend-service 8000:8000 &

"$@"
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend-server
name: frontend-service
namespace: {{ .Values.namespace }}
spec:
replicas: 2
selector:
matchLabels:
app: frontend-server
app: frontend-service
template:
metadata:
labels:
app: frontend-server
app: frontend-service
spec:
containers:
- name: frontend-server
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}"
- name: frontend-service
image: "{{ .Values.frontendService.image.repository }}:{{ .Values.frontendService.image.tag }}"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8000
Expand All @@ -24,42 +24,42 @@ spec:
mountPath: /test
env:
- name: IS_PERSISTENT
{{ .Values.frontend.isPersistent }}
{{ .Values.frontendService.isPersistent }}
- name: CHROMA_PRODUCER_IMPL
{{ .Values.frontend.producerImpl }}
{{ .Values.frontendService.producerImpl }}
- name: CHROMA_CONSUMER_IMPL
{{ .Values.frontend.consumerImpl }}
{{ .Values.frontendService.consumerImpl }}
- name: CHROMA_SEGMENT_MANAGER_IMPL
{{ .Values.frontend.segmentManagerImpl }}
{{ .Values.frontendService.segmentManagerImpl }}
- name: PULSAR_BROKER_URL
{{ .Values.frontend.pulsarBrokerUrl }}
{{ .Values.frontendService.pulsarBrokerUrl }}
- name: PULSAR_BROKER_PORT
{{ .Values.frontend.pulsarBrokerPort }}
{{ .Values.frontendService.pulsarBrokerPort }}
- name: PULSAR_ADMIN_PORT
{{ .Values.frontend.pulsarAdminPort }}
{{ .Values.frontendService.pulsarAdminPort }}
- name: ALLOW_RESET
{{ .Values.frontend.allowReset }}
{{ .Values.frontendService.allowReset }}
- name: CHROMA_SYSDB_IMPL
{{ .Values.frontend.sysdbImpl }}
{{ .Values.frontendService.sysdbImpl }}
- name: CHROMA_SERVER_GRPC_PORT
{{ .Values.frontend.serverGrpcPort }}
{{ .Values.frontendService.serverGrpcPort }}
- name: CHROMA_COORDINATOR_HOST
{{ .Values.frontend.coordinatorHost }}
{{ .Values.frontendService.coordinatorHost }}
- name: CHROMA_SERVER_AUTH_PROVIDER
{{ .Values.frontend.authProvider }}
{{ .Values.frontendService.authProvider }}
- name: CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER
{{ .Values.frontend.authCredentialsProvider }}
{{ .Values.frontendService.authCredentialsProvider }}
- name: CHROMA_SERVER_AUTHZ_PROVIDER
{{ .Values.frontend.authzProvider }}
{{ .Values.frontendService.authzProvider }}
- name: CHROMA_SERVER_AUTHZ_CONFIG_PROVIDER
{{ .Values.frontend.authzConfigProvider }}
{{ .Values.frontendService.authzConfigProvider }}
- name: CHROMA_MEMBERLIST_PROVIDER_IMPL
{{ .Values.frontend.memberlistProviderImpl }}
{{ .Values.frontendService.memberlistProviderImpl }}
- name: CHROMA_LOGSERVICE_HOST
{{ .Values.frontend.logServiceHost }}
{{ .Values.frontendService.logServiceHost }}
- name: CHROMA_LOGSERVICE_PORT
{{ .Values.frontend.logServicePort }}
{{ .Values.frontend.otherEnvConfig | nindent 12 }}
{{ .Values.frontendService.logServicePort }}
{{ .Values.frontendService.otherEnvConfig | nindent 12 }}
volumes:
- name: chroma
emptyDir: {}
Expand All @@ -69,13 +69,13 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: frontend-server
name: frontend-service
namespace: {{ .Values.namespace }}
spec:
ports:
- name: server-port
port: 8000
targetPort: 8000
selector:
app: frontend-server
app: frontend-service
type: ClusterIP
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,39 @@
apiVersion: v1
kind: Service
metadata:
name: worker
name: query-service
namespace: {{ .Values.namespace }}
spec:
ports:
- name: worker-server-port
- name: query-service-server-port
port: 50051
targetPort: 50051
selector:
app: worker-server
app: query-service-server
type: ClusterIP

---


apiVersion: apps/v1
kind: Deployment
metadata:
name: worker
name: query-service
namespace: {{ .Values.namespace }}
spec:
replicas: 2
selector:
matchLabels:
app: worker
app: query-service
template:
metadata:
labels:
app: worker
member-type: worker
app: query-service
member-type: query-service
spec:
serviceAccountName: worker-serviceaccount
serviceAccountName: query-service-serviceaccount
containers:
- name: worker
image: "{{ .Values.worker.image.repository }}:{{ .Values.worker.image.tag }}"
- name: query-service
image: "{{ .Values.queryService.image.repository }}:{{ .Values.queryService.image.tag }}"
imagePullPolicy: IfNotPresent
command: ["cargo", "run"]
ports:
Expand All @@ -45,9 +44,9 @@ spec:
- name: chroma
mountPath: /index_data
env:
- name: CHROMA_WORKER__PULSAR_URL
- name: CHROMA_query-service__PULSAR_URL
value: pulsar://pulsar.chroma:6650
- name: CHROMA_WORKER__MY_IP
- name: CHROMA_query-service__MY_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
Expand All @@ -57,7 +56,7 @@ spec:
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
member-type: worker
member-type: query-service
volumes:
- name: chroma
emptyDir: {}
Expand All @@ -67,23 +66,23 @@ spec:
apiVersion: v1
kind: ServiceAccount
metadata:
name: worker-serviceaccount
name: query-service-serviceaccount
namespace: {{ .Values.namespace }}

---

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: worker-serviceaccount-rolebinding
name: query-service-serviceaccount-rolebinding
namespace: {{ .Values.namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: pod-watcher
subjects:
- kind: ServiceAccount
name: worker-serviceaccount
name: query-service-serviceaccount
namespace: {{ .Values.namespace }}

---
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: batch/v1
kind: Job
metadata:
name: migration
name: sysdb-migration
namespace: {{ .Values.namespace }}
spec:
template:
metadata:
labels:
app: migration
app: sysdb-migration
spec:
restartPolicy: OnFailure
containers:
Expand All @@ -19,4 +19,5 @@ spec:
image: "{{ .Values.sysdbMigration.image.repository }}:{{ .Values.sysdbMigration.image.tag }}"
imagePullPolicy: IfNotPresent
name: migration

---
Loading

0 comments on commit ea954bf

Please sign in to comment.