Skip to content

Commit

Permalink
Add Danswer Azimuth chart
Browse files Browse the repository at this point in the history
  • Loading branch information
sd109 authored and sd109 committed Aug 30, 2024
1 parent b41a988 commit c680804
Show file tree
Hide file tree
Showing 11 changed files with 314 additions and 0 deletions.
23 changes: 23 additions & 0 deletions danswer-azimuth/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
21 changes: 21 additions & 0 deletions danswer-azimuth/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: danswer-azimuth
description: An self-service platform for Retrieval-Augmented Generation.
type: application
version: 0.1.0
appVersion: 0.1.0
icon: https://raw.githubusercontent.com/danswer-ai/danswer/1fabd9372d66cd54238847197c33f091a724803b/DanswerWithName.png

# TODO: Switch to upstream Danswer chart if/when the following patches are accepted:
# - https://github.com/danswer-ai/danswer/pull/1605
# - https://github.com/danswer-ai/danswer/pull/1606
# - https://github.com/danswer-ai/danswer/pull/1608
# - https://github.com/danswer-ai/danswer/pull/1726
# - https://github.com/danswer-ai/danswer/pull/1754
dependencies:
- name: danswer-stack
version: 0.5.10
repository: https://stackhpc.github.io/danswer

annotations:
azimuth.stackhpc.com/label: Danswer
4 changes: 4 additions & 0 deletions danswer-azimuth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Danswer Azimuth

This Helm chart deploys a Danswer instance that is exposed to users
via the Azimuth Platforms page.
2 changes: 2 additions & 0 deletions danswer-azimuth/azimuth-ui.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
controls: {}

1 change: 1 addition & 0 deletions danswer-azimuth/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

44 changes: 44 additions & 0 deletions danswer-azimuth/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "danswer-azimuth.name" -}}
{{- .Chart.Name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
*/}}
{{- define "danswer-azimuth.fullname" -}}
{{- if contains .Chart.Name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "danswer-azimuth.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Selector labels for a chart-level resource.
*/}}
{{- define "danswer-azimuth.selectorLabels" -}}
app.kubernetes.io/name: {{ include "danswer-azimuth.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Labels for a chart-level resource.
*/}}
{{- define "danswer-azimuth.labels" -}}
helm.sh/chart: {{ include "danswer-azimuth.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
{{ include "danswer-azimuth.selectorLabels" . }}
{{- end }}
9 changes: 9 additions & 0 deletions danswer-azimuth/templates/client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: zenith.stackhpc.com/v1alpha1
kind: Client
metadata:
name: {{ include "danswer-azimuth.fullname" . }}
labels: {{ include "danswer-azimuth.labels" . | nindent 4 }}
spec:
reservationName: {{ include "danswer-azimuth.fullname" . }}
upstream:
serviceName: {{ .Release.Name }}-nginx
163 changes: 163 additions & 0 deletions danswer-azimuth/templates/hooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Release.Name }}-danswer-fixup
namespace: {{ .Release.Name }}
annotations:
# Need to keep around for post-delete hooks
helm.sh/resource-policy: keep
rules:
- apiGroups:
- ""
resources:
- persistentvolumeclaims
verbs:
- get
- list
- delete
- apiGroups:
- apps
resources:
- statefulsets
- deployments
verbs:
- get
- patch
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Release.Name }}-danswer-fixup
namespace: {{ .Release.Name }}
annotations:
# Need to keep around for post-delete hooks
helm.sh/resource-policy: keep
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ .Release.Name }}-danswer-fixup
subjects:
# Namespace is unique to Azimuth app so using default
# service account is fine.
- kind: ServiceAccount
name: default
namespace: {{ .Release.Name }}
---
# Delete stateful set PVCs since upstream Helm chart doesn't expose this config option
apiVersion: batch/v1
kind: Job
metadata:
name: pvc-cleanup
namespace: {{ .Release.Name }}
annotations:
helm.sh/hook: post-delete
helm.sh/hook-weight: "0"
helm.sh/hook-delete-policy: hook-succeeded
spec:
template:
spec:
containers:
- name: pvc-deleter
image: gcr.io/google_containers/hyperkube:v1.18.0
command:
- kubectl
- delete
- -n
- {{ .Release.Name }}
- pvc
- --all
restartPolicy: Never
serviceAccountName: default
---
# Until https://github.com/unoplat/vespa-helm-charts/pull/23
# is merged, we need to patch vespa stateful set after deployment
# so that service label selectors match correctly.
# Since Danswer API pod gives up on Vespa application package
# init request after just 5 retries we also need to restart the API
# deployment to trigger a retry on the Vespa setup by the API pod
# after labels are corrected.
# Use three separate hooks with different hook-weights to control ordering.
apiVersion: batch/v1
kind: Job
metadata:
name: vespa-label-updater
namespace: {{ .Release.Name }}
annotations:
helm.sh/hook: post-install,post-upgrade,post-rollback
helm.sh/hook-weight: "1"
helm.sh/hook-delete-policy: hook-succeeded
spec:
template:
spec:
containers:
- name: label-updater
image: gcr.io/google_containers/hyperkube:v1.18.0
command:
- kubectl
- patch
- -n
- {{ .Release.Name }}
- statefulset/vespa
- -p
- {{ printf "{'spec':{'template':{'metadata':{'labels':{'app.kubernetes.io/instance':'%s'}}}}}" .Release.Name | replace "'" "\"" | squote }}
restartPolicy: Never
serviceAccountName: default
---
apiVersion: batch/v1
kind: Job
metadata:
name: vespa-waiter
namespace: {{ .Release.Name }}
annotations:
helm.sh/hook: post-install,post-upgrade,post-rollback
helm.sh/hook-weight: "2"
helm.sh/hook-delete-policy: hook-succeeded
spec:
template:
spec:
containers:
- name: waiter
image: gcr.io/google_containers/hyperkube:v1.18.0
command:
- kubectl
- wait
- -n
- {{ .Release.Name }}
- --for=condition=Ready
- pod/vespa-0
restartPolicy: Never
serviceAccountName: default
---
apiVersion: batch/v1
kind: Job
metadata:
name: danswer-api-restarter
namespace: {{ .Release.Name }}
annotations:
helm.sh/hook: post-install,post-upgrade,post-rollback
helm.sh/hook-weight: "3"
helm.sh/hook-delete-policy: hook-succeeded
spec:
template:
spec:
containers:
- name: restarter
image: gcr.io/google_containers/hyperkube:v1.18.0
command:
- kubectl
- rollout
- restart
- -n
- {{ .Release.Name }}
- {{ printf "deployment/%s-danswer-stack-api-deployment" .Release.Name }}
restartPolicy: Never
serviceAccountName: default
13 changes: 13 additions & 0 deletions danswer-azimuth/templates/reservation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: zenith.stackhpc.com/v1alpha1
kind: Reservation
metadata:
name: {{ include "danswer-azimuth.fullname" . }}
labels: {{ include "danswer-azimuth.labels" . | nindent 4 }}
annotations:
azimuth.stackhpc.com/service-label: {{ quote .Values.zenithClient.label }}
azimuth.stackhpc.com/service-icon-url: {{ .Values.zenithClient.iconUrl }}
{{- with .Values.zenithClient.description }}
azimuth.stackhpc.com/service-description: {{ quote . }}
{{- end }}
spec:
credentialSecretName: {{ include "danswer-azimuth.fullname" . }}-credential
5 changes: 5 additions & 0 deletions danswer-azimuth/values.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {}
}
29 changes: 29 additions & 0 deletions danswer-azimuth/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
zenithClient:
iconUrl: https://raw.githubusercontent.com/danswer-ai/danswer/1fabd9372d66cd54238847197c33f091a724803b/Danswer.png
description:
label: "Danswer"

vespaVolumeSize: &vespa-capacity 10Gi

danswer-stack:
# appVersionOverride: # e.g. v0.5.1
configMap:
AUTH_TYPE: basic
DISABLE_TELEMETRY: true
DISABLE_LLM_CHOOSE_SEARCH: true
nginx:
service:
type: ClusterIP
vespa:
service:
type: ClusterIP
volumeClaimTemplates:
- metadata:
name: vespa-storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: *vespa-capacity

0 comments on commit c680804

Please sign in to comment.