Add langflow-ide chart 0.1.0

This commit is contained in:
wbsong111
2024-12-18 09:41:24 +09:00
parent b406939c2d
commit a269862422
77 changed files with 8846 additions and 0 deletions
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "langflow.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "langflow.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "langflow.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "langflow.labels" -}}
helm.sh/chart: {{ include "langflow.chart" . }}
{{ include "langflow.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "langflow.selectorLabels" -}}
app.kubernetes.io/name: {{ include "langflow.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "langflow.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "langflow.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
@@ -0,0 +1,155 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "langflow.fullname" . }}
labels:
app: {{ template "langflow.name" . }}
chart: {{ template "langflow.chart" . }}
release: {{ .Release.Name }}
langflow-scope: "backend"
spec:
serviceName: "{{ include "langflow.fullname" . }}-service"
replicas: {{ .Values.langflow.backend.replicaCount }}
selector:
matchLabels:
app: {{ template "langflow.name" . }}
chart: {{ template "langflow.chart" . }}
release: {{ .Release.Name }}
langflow-scope: "backend"
template:
metadata:
{{- with .Values.langflow.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ template "langflow.name" . }}
chart: {{ template "langflow.chart" . }}
release: {{ .Release.Name }}
langflow-scope: "backend"
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "langflow.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.langflow.podSecurityContext | nindent 8 }}
{{- if .Values.secretProvider.enabled }}
volumes:
- name: secrets-store-inline
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: "{{- .Values.secretProvider.name }}"
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.langflow.backend.securityContext | nindent 12 }}
image: "{{ .Values.langflow.backend.image.repository }}:{{ .Values.langflow.backend.image.tag | default .Values.langflow.global.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.langflow.backend.image.pullPolicy | default .Values.langflow.global.image.pullPolicy }}
command: ["/bin/bash", "-c"]
args:
- >
set -e &&
if [ -n "$LF_CHART_EXTERNALDB_DRIVER" ]; then
echo "LF_CHART_EXTERNALDB_DRIVER is set, using external database at $LF_CHART_EXTERNALDB_HOST" &&
export LANGFLOW_DATABASE_URL="$LF_CHART_EXTERNALDB_DRIVER://$LF_CHART_EXTERNALDB_USER:$LF_CHART_EXTERNALDB_PASSWORD@$LF_CHART_EXTERNALDB_HOST:$LF_CHART_EXTERNALDB_PORT/$LF_CHART_EXTERNALDB_DATABASE"
else
echo "LF_CHART_EXTERNALDB_DRIVER is not set, using SQLLite database"
fi &&
langflow run --host 0.0.0.0 --port {{ .Values.langflow.backend.service.port }}
ports:
- name: http
containerPort: {{ .Values.langflow.backend.service.port }}
protocol: TCP
{{- if or .Values.secretProvider.enabled .Values.langflow.backend.sqlite.enabled }}
volumeMounts:
{{- end }}
{{- if .Values.secretProvider.enabled }}
- name: secrets-store-inline
mountPath: "/mnt/secrets"
readOnly: true
{{- end }}
{{- if .Values.langflow.backend.sqlite.enabled }}
- name: data
mountPath: /data
{{- end }}
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: {{ .Values.langflow.backend.probe.initialDelaySeconds }}
periodSeconds: {{ .Values.langflow.backend.probe.periodSeconds }}
timeoutSeconds: {{ .Values.langflow.backend.probe.timeoutSeconds }}
failureThreshold: {{ .Values.langflow.backend.probe.failureThreshold }}
readinessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: {{ .Values.langflow.backend.probe.initialDelaySeconds }}
periodSeconds: {{ .Values.langflow.backend.probe.periodSeconds }}
timeoutSeconds: {{ .Values.langflow.backend.probe.timeoutSeconds }}
failureThreshold: {{ .Values.langflow.backend.probe.failureThreshold }}
env:
- name: LANGFLOW_BACKEND_ONLY
value: "{{ .Values.langflow.backend.backendOnly }}"
- name: LANGFLOW_NUM_WORKERS
value: "{{ .Values.langflow.backend.numWorkers }}"
{{- if .Values.langflow.backend.sqlite.enabled }}
- name: LANGFLOW_DATABASE_URL
value: "sqlite:////data/langflow.db"
{{- end }}
{{- with .Values.langflow.backend.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.langflow.backend.externalDatabase.enabled }}
- name: LF_CHART_EXTERNALDB_DRIVER
{{- toYaml .Values.langflow.backend.externalDatabase.driver | nindent 14 }}
- name: LF_CHART_EXTERNALDB_HOST
{{- toYaml .Values.langflow.backend.externalDatabase.host | nindent 14 }}
- name: LF_CHART_EXTERNALDB_PORT
{{- toYaml .Values.langflow.backend.externalDatabase.port | nindent 14 }}
- name: LF_CHART_EXTERNALDB_DATABASE
{{- toYaml .Values.langflow.backend.externalDatabase.database | nindent 14 }}
- name: LF_CHART_EXTERNALDB_USER
{{- toYaml .Values.langflow.backend.externalDatabase.user | nindent 14 }}
- name: LF_CHART_EXTERNALDB_PASSWORD
{{- toYaml .Values.langflow.backend.externalDatabase.password | nindent 14 }}
{{- end }}
resources:
{{- toYaml .Values.langflow.backend.resources | nindent 12 }}
{{- with .Values.langflow.backend.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.langflow.backend.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.langflow.backend.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.langflow.backend.sqlite.enabled }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: {{ .Values.langflow.backend.sqlite.volume.size }}
{{- if .Values.langflow.backend.sqlite.volume.existingStorageClassName }}
{{- if ne .Values.langflow.backend.sqlite.volume.existingStorageClassName "default"}}
storageClassName: {{ .Values.langflow.backend.sqlite.volume.existingStorageClassName }}
{{- else }}
{{- end }}
{{- else }}
storageClassName: "{{ template "langflow.fullname" . }}-sqlite"
{{- end }}
{{- end }}
@@ -0,0 +1,27 @@
{{- if and .Values.langflow.backend.sqlite.enabled (not .Values.langflow.backend.sqlite.volume.existingStorageClassName) }}
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: "{{ template "langflow.fullname" . }}-sqlite"
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "langflow.name" . }}
chart: {{ template "langflow.chart" . }}
release: {{ .Release.Name }}
allowVolumeExpansion: true
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
{{- if .Values.langflow.backend.sqlite.volume.storageClass }}
provisioner: {{ .Values.langflow.backend.sqlite.volume.storageClass.provisioner }}
parameters:
{{- if .Values.langflow.backend.sqlite.volume.storageClass.type }}
type: {{ .Values.langflow.backend.sqlite.volume.storageClass.type }}
{{- end }}
{{- if .Values.langflow.backend.sqlite.volume.storageClass.fsType }}
fsType: {{ .Values.langflow.backend.sqlite.volume.storageClass.fsType }}
{{- end }}
{{- if .Values.langflow.backend.sqlite.volume.storageClass.extraParams }}
{{ toYaml .Values.langflow.backend.sqlite.volume.storageClass.extraParams | indent 2 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,98 @@
{{- if .Values.langflow.frontend.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "langflow.fullname" . }}-frontend
labels:
app: {{ template "langflow.name" . }}
chart: {{ template "langflow.chart" . }}
release: {{ .Release.Name }}
langflow-scope: "frontend"
spec:
replicas: {{ .Values.langflow.frontend.replicaCount }}
selector:
matchLabels:
app: {{ template "langflow.name" . }}
chart: {{ template "langflow.chart" . }}
release: {{ .Release.Name }}
langflow-scope: "frontend"
template:
metadata:
{{- with .Values.langflow.frontend.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ template "langflow.name" . }}
chart: {{ template "langflow.chart" . }}
release: {{ .Release.Name }}
langflow-scope: "frontend"
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "langflow.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.langflow.frontend.podSecurityContext | nindent 8 }}
volumes:
{{- if .Values.secretProvider.enabled }}
- name: secrets-store-inline
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: "{{- .Values.secretProvider.name }}"
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.langflow.securityContext | nindent 12 }}
image: "{{ .Values.langflow.frontend.image.repository }}:{{ .Values.langflow.frontend.image.tag | default .Values.langflow.global.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.langflow.frontend.image.pullPolicy | default .Values.langflow.global.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.langflow.frontend.service.port }}
protocol: TCP
volumeMounts:
{{- if .Values.secretProvider.enabled }}
- name: secrets-store-inline
mountPath: "/mnt/secrets"
readOnly: true
{{- end }}
livenessProbe:
httpGet:
path: /index.html
port: http
initialDelaySeconds: {{ .Values.langflow.frontend.probe.initialDelaySeconds }}
periodSeconds: {{ .Values.langflow.frontend.probe.periodSeconds }}
timeoutSeconds: {{ .Values.langflow.frontend.probe.timeoutSeconds }}
failureThreshold: {{ .Values.langflow.frontend.probe.failureThreshold }}
readinessProbe:
httpGet:
path: /index.html
port: http
initialDelaySeconds: {{ .Values.langflow.frontend.probe.initialDelaySeconds }}
periodSeconds: {{ .Values.langflow.frontend.probe.periodSeconds }}
timeoutSeconds: {{ .Values.langflow.frontend.probe.timeoutSeconds }}
failureThreshold: {{ .Values.langflow.frontend.probe.failureThreshold }}
env:
- name: BACKEND_URL
value: "http://{{ template "langflow.fullname" . }}-backend.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.langflow.backend.service.port }}"
- name: FRONTEND_PORT
value: "{{ .Values.langflow.frontend.service.port }}"
resources:
{{- toYaml .Values.langflow.frontend.resources | nindent 12 }}
{{- with .Values.langflow.frontend.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.langflow.frontend.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.langflow.frontend.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
@@ -0,0 +1,40 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "langflow.fullname" . -}}
{{- $svcPort := .Values.langflow.frontend.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "langflow.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path | quote }}
pathType: {{ .pathType | default "Exact" | quote }} # You can change this to Exact or ImplementationSpecific if needed
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,41 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "langflow.fullname" . }}
labels:
app: {{ template "langflow.name" . }}
chart: {{ template "langflow.chart" . }}
release: {{ .Release.Name }}
spec:
type: {{ .Values.langflow.frontend.service.type }}
ports:
- port: {{ .Values.langflow.frontend.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ template "langflow.name" . }}
chart: {{ template "langflow.chart" . }}
release: {{ .Release.Name }}
langflow-scope: "frontend"
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "langflow.fullname" . }}-backend
labels:
app: {{ template "langflow.name" . }}
chart: {{ template "langflow.chart" . }}
release: {{ .Release.Name }}
spec:
type: {{ .Values.langflow.backend.service.type }}
ports:
- port: {{ .Values.langflow.backend.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ template "langflow.name" . }}
chart: {{ template "langflow.chart" . }}
release: {{ .Release.Name }}
langflow-scope: "backend"
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "langflow.serviceAccountName" . }}
labels:
{{- include "langflow.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}