Skip to content

Commit

Permalink
add stella chart
Browse files Browse the repository at this point in the history
  • Loading branch information
1473371932 authored and jianchang committed Apr 10, 2024
1 parent fffdbf9 commit 01d33fe
Show file tree
Hide file tree
Showing 8 changed files with 257 additions and 1 deletion.
3 changes: 3 additions & 0 deletions charts/deepflow/charts/stella-agent-ce/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: stella-agent-ce
version: 0.1.0
41 changes: 41 additions & 0 deletions charts/deepflow/charts/stella-agent-ce/templates/_affinity.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- define "nodeaffinity" }}
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
{{- include "nodeAffinityRequiredDuringScheduling" . }}
preferredDuringSchedulingIgnoredDuringExecution:
{{- include "nodeAffinityPreferredDuringScheduling" . }}
{{- end }}

{{- define "nodeAffinityRequiredDuringScheduling" }}
{{- if or .Values.nodeAffinityLabelSelector .Values.global.nodeAffinityLabelSelector }}
nodeSelectorTerms:
{{- range $matchExpressionsIndex, $matchExpressionsItem := .Values.nodeAffinityLabelSelector }}
- matchExpressions:
{{- range $Index, $item := $matchExpressionsItem.matchExpressions }}
- key: {{ $item.key }}
operator: {{ $item.operator }}
{{- if $item.values }}
values:
{{- $vals := split "," $item.values }}
{{- range $i, $v := $vals }}
- {{ $v | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- range $matchExpressionsIndex, $matchExpressionsItem := .Values.global.nodeAffinityLabelSelector }}
- matchExpressions:
{{- range $Index, $item := $matchExpressionsItem.matchExpressions }}
- key: {{ $item.key }}
operator: {{ $item.operator }}
{{- if $item.values }}
values:
{{- $vals := split "," $item.values }}
{{- range $i, $v := $vals }}
- {{ $v | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- /* PVC templates */ -}}
{{- define "persistentVolumeClaim" -}}
{{- range $index, $volume := .Values.storageConfig.persistence }}
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ $volume.name }}
annotations:
{{- toYaml $volume.annotations | nindent 8 }}
spec:
accessModes:
{{- toYaml $volume.accessModes | nindent 8 }}
resources:
requests:
storage: {{ $volume.size | quote }}
{{- if (tpl $volume.storageClass $) }}
storageClassName: {{ tpl $volume.storageClass $ | quote }}
{{- end }}
{{- if $volume.selector }}
selector:
{{- toYaml $volume.selector | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: df-llm-agent
namespace: deepflow
data:
df-llm-agent.yaml: |-
{{- toYaml .Values.configMapData | nindent 6 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: df-llm-agent
namespace: deepflow
spec:
ports:
- port: 20831
nodePort: 30831
targetPort: 20831
protocol: TCP
name: http
selector:
component: df-llm-agent
type: NodePort
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{- if and (not $.Values.global.allInOneLocalStorage ) (eq ( tpl $.Values.storageConfig.generateType . ) "hostPath") (not $.Values.nodeAffinityLabelSelector) }}
{{- fail "You must set nodeAffinityLabelSelector" -}}
{{- end}}
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: df-llm-agent-deployment
namespace: deepflow
labels:
component: df-llm-agent
spec:
replicas: {{ .Values.replicas }}
serviceName: df-llm-agent
selector:
matchLabels:
component: df-llm-agent
template:
metadata:
labels:
component: df-llm-agent
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: df-llm-agent
image: "{{ tpl .Values.image.repository . }}:{{ tpl (toString .Values.image.tag) . }}"
imagePullPolicy: {{ tpl .Values.image.pullPolicy . }}
volumeMounts:
- name: debug-path
mountPath: /root/debug
- name: web-volumes-df-llm-agent
mountPath: /etc/web/df-llm-agent.yaml
subPath: df-llm-agent.yaml
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
affinity:
{{- include "nodeaffinity" . | indent 6 }}
{{- include "podAffinity" . | indent 6 }}
{{- include "podAntiAffinity" . | indent 6 }}
{{- if or .Values.global.tolerations .Values.tolerations }}
{{- end }}
volumes:
- name: web-volumes-df-llm-agent
configMap:
name: df-llm-agent
items:
- key: df-llm-agent.yaml
path: df-llm-agent.yaml
{{- if eq ( tpl .Values.storageConfig.generateType . ) "hostPath" }}
- name: debug-path
hostPath:
path: {{ tpl .Values.storageConfig.hostPath . }}/stella-agent-ce/debug/
type: DirectoryOrCreate
{{- end }}
{{- if eq ( tpl $.Values.storageConfig.generateType . ) "persistentVolumeClaim" }}
volumeClaimTemplates:
{{- include "persistentVolumeClaim" . | indent 2 }}
{{- end }}
52 changes: 52 additions & 0 deletions charts/deepflow/charts/stella-agent-ce/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
global:
allInOneLocalStorage: false
storageClass: ""

replicas: 1
image:
repository: "{{ .Values.global.image.repository }}/df-llm-agent"
pullPolicy: Always
tag: latest
storageConfig:
## persistentVolumeClaim/hostPath
## If you use hostPath, you must configure nodeAffinityLabelSelector, otherwise your data will be lost when Pod drifts
## 如果使用hostPath存储mysql数据,则必须配置nodeAffinityLabelSelector,避免pod漂移导致数据丢失
type: persistentVolumeClaim
generateType: "{{ if $.Values.global.allInOneLocalStorage }}hostPath{{ else }}{{$.Values.storageConfig.type}}{{end}}" #Please ignore this
hostPath: "/opt/stella-agent-ce/debug/"
persistence:
- name: debug-path
storageClass: "{{ .Values.global.storageClass }}"
annotations:
"helm.sh/resource-policy": keep
# existingClaim: your-claim-pvc-name
accessModes:
- ReadWriteOnce
size: 50Gi
configMapData:
daemon: true
api_timeout: 500
sql_show: false
log_file: "/var/log/df-llm-agent.log"
log_level: "info"
instance_path: "/root/df-llm-agent"
redis:
host:
- "redis"
cluster_enabled: false
port: 6379
db: 6
password: "password123"
mysql:
user_name: "root"
user_password: "deepflow"
host: "{{ if $.Values.global.externalMySQL.enabled }}{{$.Values.global.externalMySQL.ip}}{{ else }}{{ $.Release.Name }}-mysql{{end}}"
port: 30130
database: "deepflow_llm"
nodeAffinityLabelSelector:
## If you use hostPath, you must configure nodeAffinityLabelSelector, otherwise your data will be lost when Pod drifts
## 如果使用hostPath存储stella-agent-ce数据,则必须配置nodeAffinityLabelSelector,避免pod漂移导致数据丢失
#- matchExpressions:
# - key: kubernetes.io/hostname
# operator: In
## values: k8s-master
55 changes: 54 additions & 1 deletion charts/deepflow/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -900,4 +900,57 @@ grafana:
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
assertNoLeakedSecrets: false
assertNoLeakedSecrets: false


stella-agent-ce:
replicas: 1
image:
repository: "{{ .Values.global.image.repository }}/df-llm-agent"
pullPolicy: Always
tag: latest

storageConfig:
## persistentVolumeClaim/hostPath
## If you use hostPath, you must configure nodeAffinityLabelSelector, otherwise your data will be lost when Pod drifts
## 如果使用hostPath存储mysql数据,则必须配置nodeAffinityLabelSelector,避免pod漂移导致数据丢失
type: persistentVolumeClaim
generateType: "{{ if $.Values.global.allInOneLocalStorage }}hostPath{{ else }}{{$.Values.storageConfig.type}}{{end}}" #Please ignore this
hostPath: "/opt/stella-agent-ce/debug/"
persistence:
- name: debug-path
storageClass: "{{ .Values.global.storageClass }}"
annotations:
"helm.sh/resource-policy": keep
# existingClaim: your-claim-pvc-name
accessModes:
- ReadWriteOnce
size: 50Gi
configMapData:
daemon: true
api_timeout: 500
sql_show: false
log_file: "/var/log/df-llm-agent.log"
log_level: "info"
instance_path: "/root/df-llm-agent"
redis:
host:
- "redis"
cluster_enabled: false
port: 6379
db: 6
password: "password123"
mysql:
user_name: "root"
user_password: "deepflow"
host: "{{ if $.Values.global.externalMySQL.enabled }}{{$.Values.global.externalMySQL.ip}}{{ else }}{{ $.Release.Name }}-mysql{{end}}"
port: 30130
database: "deepflow_llm"
nodeAffinityLabelSelector:
## If you use hostPath, you must configure nodeAffinityLabelSelector, otherwise your data will be lost when Pod drifts
## 如果使用hostPath存储stella-agent-ce数据,则必须配置nodeAffinityLabelSelector,避免pod漂移导致数据丢失
#- matchExpressions:
# - key: kubernetes.io/hostname
# operator: In
## values: k8s-master

0 comments on commit 01d33fe

Please sign in to comment.