Skip to content

Commit

Permalink
feat(infra): add initial helm chart
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiko Kuroda <[email protected]>
  • Loading branch information
akihikokuroda committed Oct 30, 2024
1 parent dd13178 commit 038ae74
Show file tree
Hide file tree
Showing 11 changed files with 465 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/bee-stack/.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/
15 changes: 15 additions & 0 deletions charts/bee-stack/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dependencies:
- name: mongodb
repository: https://groundhog2k.github.io/helm-charts
version: 0.6.8
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 20.1.7
- name: milvus
repository: https://milvus-io.github.io/milvus-helm
version: 4.0.31
- name: mlflow
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.0.4
digest: sha256:317dd0197ec343b8ffa84df3d19cbb2061200f473e009329753128b206a69b7e
generated: "2024-10-30T15:50:42.209551-04:00"
46 changes: 46 additions & 0 deletions charts/bee-stack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: v2
name: bee-stack
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

dependencies:
- name: mongodb
condition: mongodbEnable
version: 0.6.8
repository: https://groundhog2k.github.io/helm-charts

- name: redis
condition: redisEnable
version: 20.1.7
repository: https://charts.bitnami.com/bitnami

- name: milvus
condition: milvusEnable
version: 4.0.31
repository: https://milvus-io.github.io/milvus-helm

- name: mlflow
condition: mlfowEnable
version: 2.0.4
repository: oci://registry-1.docker.io/bitnamicharts

144 changes: 144 additions & 0 deletions charts/bee-stack/templates/agent-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: agent-bee-stack
labels:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: agent
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: agent
template:
metadata:
labels:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: agent
spec:
serviceAccountName: bee-stack-agent
containers:
- name: bee-stack-agent
image: "{{ .Values.agent.image.repository }}:{{ .Values.agent.image.tag }}"
imagePullPolicy: {{ .Values.agent.image.pullPolicy }}
# command: ["/bin/sh"]
# args: ["-c", "output=$(npx mikro-orm seeder:run 2>&1); echo \"$$output\"; if ! (echo \"$$output\" | grep -qiE \"already seeded|success\"); then echo \"Error occured\" && exit 1; fi && node --enable-source-maps ./dist/server.js"]
command: ["node"]
args: ["--enable-source-maps", "./dist/server.js"]
env:
- name: LLM_BACKEND
value: "{{ .Values.agent.llm.llm_backend }}"
- name: EMBEDDING_BACKEND
value: "{{ .Values.agent.llm.embedding_backend }}"
- name: WATSONX_PROJECT_ID
value: "{{ .Values.agent.llm.watsonx_project_id }}"
- name: WATSONX_API_KEY
value: "{{ .Values.agent.llm.watsonx_api_key }}"
- name: BAM_API_KEY
value: "{{ .Values.agent.llm.bam_api_key }}"
- name: OPENAI_API_KEY
value: "{{ .Values.agent.llm.openai_api_key }}"

- name: MONGODB_URL
value: "mongodb://{{ .Release.Name }}-mongodb:27017?directConnection=true"
- name: MONGODB_DATABASE_NAME
value: bee-api
- name: REDIS_URL
value: "redis://{{ .Release.Name }}-redis-master:6379/0"
- name: REDIS_CACHE_URL
value: "redis://{{ .Release.Name }}-redis-master:6379/8"
- name: AUTH_JWKS_URI
value: "http://localhost:4000/v1/ui/jwks"
- name: AUTH_JWT_ISSUER
value: "https://localhost"
- name: AUTH_JWT_AUDIENCE
value: bee-test
- name: HTTP_PROXY_URL
value: "http://localhost:3128"
- name: BEE_CODE_INTERPRETER_URL
value: "http://bee-code-interpreter-k3s:30051"

- name: BEE_CODE_INTERPRETER_STORAGE_BACKEND
value: filesystem
- name: BEE_CODE_INTERPRETER_FILE_STORAGE_PATH
value: "/storage"
- name: SHUTDOWN_GRACEFUL_PERIOD
value: "1"

- name: S3_ENDPOINT
value: "http://minio:9000"
- name: S3_ACCESS_KEY_ID
value: minioadmin
- name: S3_SECRET_ACCESS_KEY
value: minioadmin
- name: S3_BUCKET_FILE_STORAGE
value: bee-api

- name: BEE_OBSERVE_API_URL
value: "http://bee-observe:3000"
- name: BEE_OBSERVE_API_AUTH_KEY
value: observe-auth-key

- name: MILVUS_HOST
value: milvus
- name: MILVUS_PORT
value: "19530"
- name: MILVUS_USE_TLS
value: "false"
- name: MILVUS_USERNAME
value: user
- name: MILVUS_PASSWORD
value: password
- name: MILVUS_DATABASE_NAME
value: default

- name: RUN_BULLMQ_WORKERS
value: "runs,runs:cleanup,vectorStores:cleanup,vectorStores:fileProcessor,files:extraction"

- name: CRYPTO_CIPHER_KEY
value: random_crypto_key
- name: OTEL_SDK_DISABLED
value: "true"

- name: USER_ID_DEFAULT
value: dummy
- name: PROJECT_ID_DEFAULT
value: proj_670cc04869ddffe24f4fd70f
- name: ORGANIZATION_ID_DEFAULT
value: org_670cc04869ddffe24f4fd70d
- name: ORGANIZATION_OWNER_ID_DEFAULT
value: dummy
- name: PROJECT_ADMIN_ID_DEFAULT
value: dummy
- name: AUTH_CLIENT_ID
value: dummy
- name: AUTH_CLIENT_SECRET
value: dummy
- name: AUTH_SERVER_PORT
value: "4001"
- name: AUTH_WELL_KNOWN
value: "http://127.0.0.1:4001/.well-known/openid-configuration"
- name: AUTH_AUDIENCE
value: bee-test
ports:
- name: http
containerPort: 4000
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
#readinessProbe:
# httpGet:
# path: /
# port: http
#volumeMounts:
# - mountPath: /storage
# name: code-interpreter-storage
# readOnly: false
# volumes:
# - name: code-interpreter-storage
# secret:
# optional: false
# secretName: mysecret
5 changes: 5 additions & 0 deletions charts/bee-stack/templates/agent-sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: bee-stack-agent
automountServiceAccountToken: true
14 changes: 14 additions & 0 deletions charts/bee-stack/templates/agent-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: bee-stack-agent
spec:
type: ClusterIP
ports:
- port: 4000
targetPort: 4000
protocol: TCP
name: http
selector:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: agent
56 changes: 56 additions & 0 deletions charts/bee-stack/templates/observe-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: observe-bee-stack
labels:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: observe
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: observe
template:
metadata:
labels:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: observe
spec:
serviceAccountName: bee-stack-agent
containers:
- name: bee-stack-observe
image: "{{ .Values.observe.image.repository }}:{{ .Values.observe.image.tag }}"
imagePullPolicy: {{ .Values.observe.image.pullPolicy }}
command: ["/bin/sh"]
args: ["-c", "npx mikro-orm --config dist/mikro-orm.config.js migration:up && node ./dist/index.js"]
env:
- name: PORT
value: "3000"
- name: AUTH_KEY
value: observe-auth-key
- name: FASTIFY_BODY_LIMIT
value: "10485760"
- name: REDIS_URL
value: redis://{{ .Release.Name }}-redis-master:6379/1
- name: MONGODB_URL
value: mongodb://{{ .Release.Name }}-mongodb:27017?directConnection=true
- name: DATA_EXPIRATION_IN_DAYS
value: "7"
- name: MLFLOW_API_URL
value: http://{{ .Release.Name }}-mlflow:8080/
- name: MLFLOW_DEFAULT_EXPERIMENT_ID
value: "0"
- name: MLFLOW_AUTHORIZATION
value: BASE_AUTH
- name: MLFLOW_USERNAME
value: user
- name: MLFLOW_PASSWORD
value: password
- name: MLFLOW_TRACE_DELETE_IN_BATCHES_CRON_PATTERN
value: "0 */1 * * * *"
- name: MLFLOW_TRACE_DELETE_IN_BATCHES_BATCH_SIZE
value: "100"
- name: NODE_ENV
value: production

14 changes: 14 additions & 0 deletions charts/bee-stack/templates/observe-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: bee-stack-observe
spec:
type: ClusterIP
ports:
- port: 3000
targetPort: 3000
protocol: TCP
name: http
selector:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: observe
37 changes: 37 additions & 0 deletions charts/bee-stack/templates/ui-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ui-bee-stack
labels:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: ui
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: ui
template:
metadata:
labels:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: ui
spec:
serviceAccountName: bee-stack-agent
containers:
- name: bee-stack-ui
image: "{{ .Values.ui.image.repository }}:{{ .Values.ui.image.tag }}"
imagePullPolicy: {{ .Values.ui.image.pullPolicy }}
env:
- name: NEXTAUTH_URL
value: http://localhost:3000
- name: NEXTAUTH_SECRET
value: top-secret
- name: API_URL
value: http://bee-stack-agent:4000
- name: DUMMY_JWT_TOKEN
value: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ0ZXN0IiwicHJlZmVycmVkX3VzZXJuYW1lIjoiVGVzdCBVc2VyIiwiZW1haWwiOiJ0ZXN0QGVtYWlsLmNvbSIsImlhdCI6MTUxNjIzOTAyMiwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3QiLCJhdWQiOiJiZWUtdGVzdCJ9.vwkGnl7lBbzJYk6BtoW3VoA3mnNJVI-nDQU8aK7zOH-rkf2pn5cn6CKwpq7enDInIXro8WtBLNZP8Nr8GQIZKahICuP3YrPRmzv7YIW8LuXKnx1hycg5OAtj0OtQi5FYwwCxTYW9pBF2it7XwQSBcW7yYsOrvgs7jVhThCOsavX0YiAROxZIhk1idZT4Pl3egfUI_dy9iBxcn7xocTnos-94wqJNt8oCVgB8ynj75yJFHJbiQ-9Tym_V3LcMHoEyv67Jzie8KugCgdpuF6EbQqcyfYJ83q5jJpR2LiuWMuGsNSbjjDY-f1vCSMo9L9-R8KFrDylT_BzLvRBswOzW7A"
ports:
- containerPort: 3000
name: bee-ui
protocol: TCP
15 changes: 15 additions & 0 deletions charts/bee-stack/templates/ui-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: bee-stack-ui
spec:
type: NodePort
#type: ClusterIP
ports:
- port: 3000
# targetPort: 3000
protocol: TCP
name: http
selector:
app.kubernetes.io/name: bee-stack
app.kubernetes.io/instance: ui
Loading

0 comments on commit 038ae74

Please sign in to comment.