Skip to content

Commit

Permalink
chore: Minor improvements and version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
tazarov committed Dec 27, 2024
1 parent ca8679a commit 763c434
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ body:
- 1.28.x
- 1.29.x
- 1.30.x
- 1.31.x
- 1.32.x
validations:
required: true
- type: textarea
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ jobs:
matrix:
chroma-version:
[
0.4.7, #auth introduced
0.4.8, #auth introduced
0.4.10, #pre-flight checks introduced
0.4.9,
0.4.24,
0.5.0,
0.5.5,
0.5.23,
]
runs-on: ubuntu-latest
steps:
Expand Down
5 changes: 2 additions & 3 deletions charts/chromadb-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ keywords:
- ai/ml
type: application

version: 0.1.20
# chromadb version
appVersion: "0.5.5"
version: 0.1.21
appVersion: "0.5.23"
98 changes: 72 additions & 26 deletions charts/chromadb-chart/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,76 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
Congratulations you have successfully installed Chroma version {{.Values.chromadb.apiVersion }}, Chart version {{ .Chart.Version }}!

Visit the official Chroma documentation for more information: https://docs.trychroma.com/.
For tips and recipes, check out the Chroma cookbook: https://cookbook.chromadb.dev/.

You can access your Chroma instance by forwarding the port to your local machine:

```bash
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "chart.fullname" . }} {{ .Values.chromadb.serverHttpPort }}:{{ .Values.chromadb.serverHttpPort }}
```

{{- if .Values.chromadb.auth.enabled }}

{{ .Values.chromadb.auth.type }} Authentication is enabled.

{{- if and .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "token") }}
It uses {{ .Values.chromadb.auth.token.headerType }} header for token.
To get your token run:



Python:

{{- if eq .Values.chromadb.auth.type "token" }}

Get the token from the secret:

```bash
export CHROMA_TOKEN=$(kubectl --namespace default get secret chromadb-auth -o jsonpath="{.data.token}" | base64 --decode)
```

```python
import os
import chromadb
from chromadb.config import Settings

client = chromadb.HttpClient(
settings=Settings(
chroma_client_auth_provider="chromadb.auth.token_authn.TokenAuthClientProvider",
chroma_client_auth_credentials=os.environ.get("CHROMA_TOKEN")
)
)

# if everything is correctly configured the below should list all collections
client.list_collections()
```
{{- end }}
{{- if eq .Values.chromadb.auth.type "basic" }}

Get the username and password from the secret:

```bash
export CHROMA_USERNAME=$(kubectl --namespace {{ .Release.Namespace }} get secret chromadb-auth -o json | jq -r '(.data.username | @base64d)')
export CHROMA_PASSWORD=$(kubectl --namespace {{ .Release.Namespace }} get secret chromadb-auth -o json | jq -r '(.data.password | @base64d)')
```

```python
import chromadb
from chromadb.config import Settings

client = chromadb.HttpClient(
settings=Settings(
chroma_client_auth_provider="chromadb.auth.basic_authn.BasicAuthClientProvider",
chroma_client_auth_credentials="<username>:<password>")
)

# if everything is correctly configured the below should list all collections
client.list_collections()
```
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "chart.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "chart.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT

> Note: Visit https://cookbook.chromadb.dev/security/auth/ for more information on authentication.

{{- end }}
2. To get auth credentials run:

{{- if and .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "token") }}
kubectl --namespace {{ .Release.Namespace }} get secret chromadb-auth -o jsonpath="{.data.token}" | base64 --decode
{{- end }}
{{- if and .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "basic") }}
kubectl --namespace {{ .Release.Namespace }} get secret chromadb-auth -o json | jq -r '(.data.username | @base64d) + ":" + (.data.password | @base64d)'
{{- end }}
11 changes: 11 additions & 0 deletions charts/chromadb-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,14 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Get the chroma api version
*/}}
{{- define "chromadb.apiVersion" -}}
{{- if .Values.chromadb.apiVersion }}
{{- .Values.chromadb.apiVersion }}
{{- else }}
{{- .Chart.AppVersion }}
{{- end }}
{{- end }}
10 changes: 5 additions & 5 deletions charts/chromadb-chart/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ data:
{{- end }}
{{- end }}
---
{{- if and (semverCompare ">= 0.4.7" .Values.chromadb.apiVersion) .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "basic") (eq .Values.chromadb.auth.existingSecret "") }}
{{- if and (semverCompare ">= 0.4.7" (include "chromadb.apiVersion" .)) .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "basic") (eq .Values.chromadb.auth.existingSecret "") }}
apiVersion: v1
kind: Secret
metadata:
Expand Down Expand Up @@ -71,11 +71,11 @@ metadata:
data:
{{- $existingConfigMap := (lookup "v1" "ConfigMap" .Release.Namespace (include "chart.fullname" . | printf "%s-basic-auth-config")) }}
{{- $newData := dict }}
{{- if and (semverCompare ">= 0.4.7" .Values.chromadb.apiVersion) (semverCompare "< 0.5.0" .Values.chromadb.apiVersion) }}
{{- if and (semverCompare ">= 0.4.7" (include "chromadb.apiVersion" .)) (semverCompare "< 0.5.0" (include "chromadb.apiVersion" .)) }}
{{- $_ := set $newData "CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER" "chromadb.auth.providers.HtpasswdFileServerAuthCredentialsProvider" }}
{{- $_ := set $newData "CHROMA_SERVER_AUTH_PROVIDER" "chromadb.auth.basic.BasicAuthServerProvider" }}
{{- $_ := set $newData "CHROMA_SERVER_AUTH_CREDENTIALS_FILE" "/chroma/auth/server.htpasswd" }}
{{- else if (semverCompare ">= 0.5.0" .Values.chromadb.apiVersion) }}
{{- else if (semverCompare ">= 0.5.0" (include "chromadb.apiVersion" .)) }}
{{- $_ := set $newData "CHROMA_SERVER_AUTHN_CREDENTIALS_FILE" "/chroma/auth/server.htpasswd" }}
{{- $_ := set $newData "CHROMA_SERVER_AUTHN_PROVIDER" "chromadb.auth.basic_authn.BasicAuthenticationServerProvider" }}
{{- end }}
Expand Down Expand Up @@ -103,10 +103,10 @@ metadata:
data:
{{- $existingConfigMap := (lookup "v1" "ConfigMap" .Release.Namespace (include "chart.fullname" . | printf "%s-token-auth-config")) }}
{{- $newData := dict }}
{{- if and (semverCompare ">= 0.4.7" .Values.chromadb.apiVersion) (semverCompare "< 0.5.0" .Values.chromadb.apiVersion) }}
{{- if and (semverCompare ">= 0.4.7" (include "chromadb.apiVersion" .)) (semverCompare "< 0.5.0" (include "chromadb.apiVersion" .)) }}
{{- $_ := set $newData "CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER" "chromadb.auth.token.TokenConfigServerAuthCredentialsProvider" }}
{{- $_ := set $newData "CHROMA_SERVER_AUTH_PROVIDER" "chromadb.auth.token.TokenAuthServerProvider" }}
{{- else if (semverCompare ">= 0.5.0" .Values.chromadb.apiVersion) }}
{{- else if (semverCompare ">= 0.5.0" (include "chromadb.apiVersion" .)) }}
{{- $_ := set $newData "CHROMA_SERVER_AUTHN_PROVIDER" "chromadb.auth.token_authn.TokenAuthenticationServerProvider" }}
{{- $_ := set $newData "CHROMA_AUTH_TOKEN_TRANSPORT_HEADER" .Values.chromadb.auth.token.headerType }}
{{- end }}
Expand Down
10 changes: 5 additions & 5 deletions charts/chromadb-chart/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and (semverCompare ">= 0.4.7" .Values.chromadb.apiVersion) .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "basic") }}
{{- if and (semverCompare ">= 0.4.7" (include "chromadb.apiVersion" .)) .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "basic") }}
initContainers:
- name: generate-htpasswd
image: {{ .Values.initImage }}
Expand Down Expand Up @@ -103,9 +103,9 @@ spec:
value: "{{ .Values.chromadb.logConfigFileLocation }}"
{{- end }}
{{- if and .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "token") }}
{{- if and (semverCompare ">= 0.4.7" .Values.chromadb.apiVersion) (semverCompare "< 0.5.0" .Values.chromadb.apiVersion) }}
{{- if and (semverCompare ">= 0.4.7" (include "chromadb.apiVersion" .)) (semverCompare "< 0.5.0" (include "chromadb.apiVersion" .)) }}
- name: CHROMA_SERVER_AUTH_CREDENTIALS
{{- else if (semverCompare ">= 0.5.0" .Values.chromadb.apiVersion)}}
{{- else if (semverCompare ">= 0.5.0" (include "chromadb.apiVersion" .))}}
- name: CHROMA_SERVER_AUTHN_CREDENTIALS
{{- end }}
valueFrom:
Expand Down Expand Up @@ -134,7 +134,7 @@ spec:
- mountPath: "{{.Values.chromadb.persistDirectory}}"
name: data
{{- end }}
{{- if and (semverCompare ">= 0.4.7" .Values.chromadb.apiVersion) .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "basic") }}
{{- if and (semverCompare ">= 0.4.7" (include "chromadb.apiVersion" .)) .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "basic") }}
- mountPath: /chroma/auth/
name: htpasswd-volume
{{- end }}
Expand All @@ -157,7 +157,7 @@ spec:
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
volumes:
{{- if and (semverCompare ">= 0.4.7" .Values.chromadb.apiVersion) .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "basic") }}
{{- if and (semverCompare ">= 0.4.7" (include "chromadb.apiVersion" .)) .Values.chromadb.auth.enabled (eq .Values.chromadb.auth.type "basic") }}
- name: htpasswd-volume
emptyDir: { }
{{- end }}
Expand Down
1 change: 0 additions & 1 deletion charts/chromadb-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ startupProbe:
initialDelaySeconds: 10

chromadb:
apiVersion: "0.5.5"
allowReset: false
isPersistent: true
persistDirectory: /index_data
Expand Down

0 comments on commit 763c434

Please sign in to comment.