Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELM] Refactor Chart #1872

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
92198f7
Split templates
lakinduakash Oct 8, 2024
722b891
Fix file name
lakinduakash Oct 8, 2024
b1d4b3c
Move validations to validations.yaml
lakinduakash Oct 8, 2024
5d97a47
Add NOTES.txt
lakinduakash Oct 8, 2024
7d6c007
Update documentation in values.yaml ( for `helm-docs` )
lakinduakash Oct 8, 2024
41d1f2b
Split templates
lakinduakash Oct 8, 2024
d4d2ae6
Fix file name
lakinduakash Oct 8, 2024
80fc6a0
Move validations to validations.yaml
lakinduakash Oct 8, 2024
d90ddbf
Add NOTES.txt
lakinduakash Oct 8, 2024
dc34c1d
Update documentation in values.yaml ( for `helm-docs` )
lakinduakash Oct 8, 2024
602f27e
Merge branch 'refs/heads/main' into lakindu/helm
lakinduakash Oct 25, 2024
2af1bc6
Merge remote-tracking branch 'origin/lakindu/helm' into lakindu/helm
lakinduakash Oct 25, 2024
801e907
Add agents related templates and values
lakinduakash Oct 25, 2024
0c434c3
Add missing EOF
lakinduakash Oct 25, 2024
8c552e5
Add agents-pvc.yaml
lakinduakash Oct 25, 2024
cc15e61
Add h2ogpt-pvc.yaml
lakinduakash Oct 25, 2024
cd6c173
Separate PVC into files and remove autoscaling
lakinduakash Oct 25, 2024
1661737
Remove stack, vllm, tgi, and lmdeploy related checks for agents
lakinduakash Oct 25, 2024
6690942
Update secret configs
lakinduakash Oct 25, 2024
ba0434b
Add conditions for agent and openAi ports
lakinduakash Oct 25, 2024
86f060b
Remove stack from h2ogpt
lakinduakash Oct 25, 2024
a14ed1c
Add HPA for agents
lakinduakash Oct 25, 2024
db1cfce
Fix stack removal
lakinduakash Oct 25, 2024
95573cd
Add default resource limits
lakinduakash Oct 25, 2024
661cf3c
Add README.md generated from helm-docs
lakinduakash Oct 25, 2024
1b75c9d
Update Chart version
lakinduakash Oct 25, 2024
0f52c7b
Update secrets
lakinduakash Oct 28, 2024
9af9f2d
Remove global OpenAI, replicate and openAIAzure
lakinduakash Oct 28, 2024
78b2e72
Update helm-doc
lakinduakash Oct 28, 2024
f5b79da
Fix agents volumes
lakinduakash Oct 28, 2024
0086360
Remove lmdeploy
lakinduakash Oct 30, 2024
eccb0c2
Remove tgi
lakinduakash Oct 30, 2024
86fae3c
Change overrideConfig passing method
lakinduakash Nov 5, 2024
9818a04
Fix boolean values quote issue
lakinduakash Nov 5, 2024
72c5859
Add new line
lakinduakash Nov 6, 2024
36ca38e
Rename agents to agent
lakinduakash Nov 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions helm/h2ogpt-chart/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Thank you for installing {{ .Chart.Name }}.

Your release is named {{ .Release.Name }}.

To learn more about the release, try:

$ helm status {{ .Release.Name }}
$ helm get all {{ .Release.Name }}
25 changes: 25 additions & 0 deletions helm/h2ogpt-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,28 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Configs for agents server
*/}}

{{- define "agents.overrideConfig" -}}
agent_server: True
agent_port: "5004"
{{- end }}

{{/*
Configs for agents with h2ogpt
*/}}

{{- define "h2ogpt.overrideConfig" -}}
{{- if .Values.h2ogpt.agents.enabled }}
agent_server: True
agent_port: "5004"
multiple_workers_gunicorn: True
agent_workers: {{ .Values.h2ogpt.agents.agent_workers}}
{{- else }}
agents_server: False
{{- end }}

{{- end }}
16 changes: 16 additions & 0 deletions helm/h2ogpt-chart/templates/agents-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.agents.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "h2ogpt.fullname" . }}-agents-config
namespace: {{ include "h2ogpt.namespace" . | quote }}
labels:
{{- include "h2ogpt.labels" . | nindent 4 }}
data:
{{- range $key, $value := ( include "agents.overrideConfig" . | fromYaml ) }}
{{ printf "H2OGPT_%s" $key | upper }}: {{ $value | quote }}
{{- end }}
{{- range $key, $value := .Values.agents.overrideConfig }}
{{ printf "H2OGPT_%s" $key | upper }}: {{ $value | quote }}
{{- end }}
{{- end }}
189 changes: 189 additions & 0 deletions helm/h2ogpt-chart/templates/agents-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
{{- if .Values.agents.enabled }}
lakinduakash marked this conversation as resolved.
Show resolved Hide resolved
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "h2ogpt.fullname" . }}-agents
namespace: {{ include "h2ogpt.namespace" . | quote }}
labels:
app: {{ include "h2ogpt.fullname" . }}-agents
spec:
replicas: {{ .Values.agents.replicaCount }}
lakinduakash marked this conversation as resolved.
Show resolved Hide resolved
selector:
matchLabels:
app: {{ include "h2ogpt.fullname" . }}-agents
{{- if .Values.agents.updateStrategy }}
strategy: {{- toYaml .Values.agents.updateStrategy | nindent 4 }}
{{- end }}
template:
metadata:
{{- with .Values.agents.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ include "h2ogpt.fullname" . }}-agents
{{- with .Values.agents.podLabels }}
{{ toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.agents.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.agents.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.agents.podSecurityContext | nindent 8 }}
affinity:
{{- if .Values.agents.podAffinity }}
podAntiAffinity:
{{- if .Values.agents.podAffinity.hostname }}
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- {{ include "h2ogpt.fullname" . }}
topologyKey: kubernetes.io/hostname
{{- end }}
{{- if .Values.agents.podAffinity.zone }}
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- {{ include "h2ogpt.fullname" . }}
topologyKey: failure-domain.beta.kubernetes.io/zone
{{- end }}
{{- end }}
{{- with .Values.agents.extraAffinity }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.agents.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ include "h2ogpt.fullname" . }}-agents
securityContext:
{{- toYaml .Values.agents.securityContext | nindent 12 }}
image: "{{ .Values.agents.image.repository }}:{{ .Values.agents.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.agents.image.pullPolicy }}
command: ["/bin/bash", "-c"]
args:
- >
python3 /workspace/generate.py
ports:
- name: agent
containerPort: 5004
protocol: TCP
{{- if .Values.agents.livenessProbe }}
livenessProbe:
httpGet:
path: /
scheme: HTTP
port: http
{{- toYaml .Values.agents.livenessProbe | nindent 12 }}
{{- end }}
{{- if .Values.agents.readinessProbe }}
readinessProbe:
httpGet:
path: /
scheme: HTTP
port: http
{{- toYaml .Values.agents.readinessProbe | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.agents.resources | nindent 12 }}
envFrom:
- configMapRef:
name: {{ include "h2ogpt.fullname" . }}-agents-config
env:
{{- range $key, $value := .Values.agents.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
{{- if and .Values.global.externalLLM.openAIAzure.enabled .Values.global.externalLLM.enabled }}
- name: OPENAI_AZURE_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.global.externalLLM.secret }}
key: OPENAI_AZURE_KEY
- name: OPENAI_AZURE_API_BASE
valueFrom:
secretKeyRef:
name: {{ .Values.global.externalLLM.secret }}
key: OPENAI_AZURE_API_BASE
{{- end }}
{{- if and .Values.global.externalLLM.openAI.enabled .Values.global.externalLLM.enabled }}
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.global.externalLLM.secret }}
key: OPENAI_API_KEY
{{- end }}
{{- if and .Values.global.externalLLM.replicate.enabled .Values.global.externalLLM.enabled }}
- name: REPLICATE_API_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.global.externalLLM.secret }}
key: REPLICATE_API_TOKEN
lakinduakash marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}
{{- if .Values.global.externalLLM.enabled }}
- name: H2OGPT_MODEL_LOCK
value: {{ toJson .Values.global.externalLLM.modelLock | quote }}
- name: H2OGPT_SCORE_MODEL
value: None
{{- end }}
{{- if .Values.global.visionModels.enabled }}
- name: H2OGPT_VISIBLE_VISION_MODELS
value: {{ .Values.global.visionModels.visibleModels | quote }}
- name: H2OGPT_ROTATE_ALIGN_RESIZE_IMAGE
value: {{ .Values.global.visionModels.rotateAlignResizeImage | quote }}
{{- end }}
volumeMounts:
- name: {{ include "h2ogpt.fullname" . }}-agents-volume
mountPath: /workspace/.cache
subPath: cache
- name: {{ include "h2ogpt.fullname" . }}-volume
mountPath: /workspace/save
subPath: save
{{- if .Values.caCertificates }}
- name: ca-certificates
mountPath: /etc/ssl/certs/root-ca-bundle.crt
subPath: root-ca-bundle.crt
{{- end }}
{{ with .Values.agents.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: {{ include "h2ogpt.fullname" . }}-agents-volume
{{- if not .Values.agents.storage.useEphemeral }}
persistentVolumeClaim:
claimName: {{ include "h2ogpt.fullname" . }}-volume
{{- else}}
ephemeral:
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.agents.storage.size | quote }}
storageClassName: {{ .Values.agents.storage.class }}
{{- end }}
{{- if .Values.caCertificates }}
- name: ca-certificates
configMap:
name: {{ include "h2ogpt.fullname" . }}-ca-certificates
{{- end }}
{{- with .Values.agents.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions helm/h2ogpt-chart/templates/agents-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if and (.Values.agents.enabled) (not .Values.agents.storage.useEphemeral) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "h2ogpt.fullname" . }}-agents-volume
namespace: {{ include "h2ogpt.namespace" . | quote }}
spec:
accessModes:
- ReadWriteOnce
storageClassName: {{ .Values.agents.storage.class }}
resources:
requests:
storage: {{ .Values.agents.storage.size | quote }}
{{- end }}
21 changes: 21 additions & 0 deletions helm/h2ogpt-chart/templates/agents-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.agents.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "h2ogpt.fullname" . }}-agents
namespace: {{ include "h2ogpt.namespace" . | quote }}

{{- with .Values.agents.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
app: {{ include "h2ogpt.fullname" . }}-agents
ports:
- name: agent
protocol: TCP
port: {{ .Values.agents.service.agentsPort }}
targetPort: 5004
type: {{ .Values.agents.service.type }}
{{- end }}
12 changes: 12 additions & 0 deletions helm/h2ogpt-chart/templates/ca-certs-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.caCertificates}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "h2ogpt.fullname" . }}-ca-certificates
namespace: {{ include "h2ogpt.namespace" . | quote }}
labels:
{{- include "h2ogpt.labels" . | nindent 4 }}
data:
root-ca-bundle.crt: |
{{ .Values.caCertificates | nindent 4 | trim }}
{{- end }}
69 changes: 0 additions & 69 deletions helm/h2ogpt-chart/templates/config-map.yaml

This file was deleted.

Loading
Loading