diff --git a/helm/openrag/templates/configmaps/flows/agent-flow-configmap.yaml b/helm/openrag/templates/configmaps/flows/agent-flow-configmap.yaml new file mode 100644 index 00000000..cff35fe9 --- /dev/null +++ b/helm/openrag/templates/configmaps/flows/agent-flow-configmap.yaml @@ -0,0 +1,12 @@ +{{- if .Values.langflow.flows.loadDefaults }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "openrag.fullname" . }}-flow-agent + namespace: {{ include "openrag.namespace" . }} + labels: + {{- include "openrag.labels" . | nindent 4 }} +data: + openrag_agent.json: |- +{{ .Files.Get "flows/openrag_agent.json" | indent 4 }} +{{- end }} diff --git a/helm/openrag/templates/configmaps/flows/ingestion-flow-configmap.yaml b/helm/openrag/templates/configmaps/flows/ingestion-flow-configmap.yaml new file mode 100644 index 00000000..ad236517 --- /dev/null +++ b/helm/openrag/templates/configmaps/flows/ingestion-flow-configmap.yaml @@ -0,0 +1,12 @@ +{{- if .Values.langflow.flows.loadDefaults }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "openrag.fullname" . }}-flow-ingestion + namespace: {{ include "openrag.namespace" . }} + labels: + {{- include "openrag.labels" . | nindent 4 }} +data: + ingestion_flow.json: |- +{{ .Files.Get "flows/ingestion_flow.json" | indent 4 }} +{{- end }} diff --git a/helm/openrag/templates/configmaps/flows/nudges-flow-configmap.yaml b/helm/openrag/templates/configmaps/flows/nudges-flow-configmap.yaml new file mode 100644 index 00000000..5ebe05fb --- /dev/null +++ b/helm/openrag/templates/configmaps/flows/nudges-flow-configmap.yaml @@ -0,0 +1,12 @@ +{{- if .Values.langflow.flows.loadDefaults }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "openrag.fullname" . }}-flow-nudges + namespace: {{ include "openrag.namespace" . }} + labels: + {{- include "openrag.labels" . | nindent 4 }} +data: + openrag_nudges.json: |- +{{ .Files.Get "flows/openrag_nudges.json" | indent 4 }} +{{- end }} diff --git a/helm/openrag/templates/configmaps/flows/url-flow-configmap.yaml b/helm/openrag/templates/configmaps/flows/url-flow-configmap.yaml new file mode 100644 index 00000000..911ee5e4 --- /dev/null +++ b/helm/openrag/templates/configmaps/flows/url-flow-configmap.yaml @@ -0,0 +1,12 @@ +{{- if .Values.langflow.flows.loadDefaults }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "openrag.fullname" . }}-flow-url + namespace: {{ include "openrag.namespace" . }} + labels: + {{- include "openrag.labels" . | nindent 4 }} +data: + openrag_url_mcp.json: |- +{{ .Files.Get "flows/openrag_url_mcp.json" | indent 4 }} +{{- end }} diff --git a/helm/openrag/templates/langflow/deployment.yaml b/helm/openrag/templates/langflow/deployment.yaml index f583f9a1..54ba3db8 100644 --- a/helm/openrag/templates/langflow/deployment.yaml +++ b/helm/openrag/templates/langflow/deployment.yaml @@ -30,6 +30,29 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.langflow.flows.loadDefaults }} + initContainers: + - name: load-default-flows + image: busybox:1.36 + command: + - /bin/sh + - -c + - | + FLOWS_DIR="{{ .Values.langflow.persistence.mountPath }}/{{ .Values.langflow.persistence.flowsSubPath }}" + mkdir -p "$FLOWS_DIR" + if [ -z "$(ls -A $FLOWS_DIR 2>/dev/null)" ]; then + echo "Loading default flows..." + cp /default-flows/*.json "$FLOWS_DIR/" + echo "Flows loaded: $(ls $FLOWS_DIR)" + else + echo "Flows already exist, skipping." + fi + volumeMounts: + - name: langflow-data + mountPath: {{ .Values.langflow.persistence.mountPath }} + - name: default-flows + mountPath: /default-flows + {{- end }} containers: - name: langflow image: "{{ .Values.langflow.image.repository }}:{{ .Values.langflow.image.tag | default .Values.global.imageTag }}" @@ -196,6 +219,19 @@ spec: {{- else }} emptyDir: {} {{- end }} + {{- if .Values.langflow.flows.loadDefaults }} + - name: default-flows + projected: + sources: + - configMap: + name: {{ include "openrag.fullname" . }}-flow-ingestion + - configMap: + name: {{ include "openrag.fullname" . }}-flow-agent + - configMap: + name: {{ include "openrag.fullname" . }}-flow-nudges + - configMap: + name: {{ include "openrag.fullname" . }}-flow-url + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/helm/openrag/values.yaml b/helm/openrag/values.yaml index c589ea74..ade7e1fa 100644 --- a/helm/openrag/values.yaml +++ b/helm/openrag/values.yaml @@ -71,6 +71,7 @@ langflow: # Flow configuration (UUIDs for Langflow workflows) flows: + loadDefaults: true # Load default OpenRAG flows on first deployment chatFlowId: "1098eea1-6649-4e1d-aed1-b77249fb8dd0" ingestFlowId: "5488df7c-b93f-4f87-a446-b67028bc0813" urlIngestFlowId: "72c3d17c-2dac-4a73-b48a-6518473d7830"