Skip to content

Commit 5265500

Browse files
feat: update charts to support openshift requirements (#19)
--------- Co-authored-by: Alexander Dejanovski <[email protected]>
1 parent 93624de commit 5265500

10 files changed

+265
-73
lines changed

charts/langflow-ide/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: langflow-ide
33
description: Helm chart for Langflow IDE
44
type: application
5-
version: 0.1.0
5+
version: 0.1.1
66
appVersion: latest
77
maintainers:
88
- name: Langflow

charts/langflow-ide/templates/backend-statefulset.yaml

+13-7
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,25 @@ spec:
3434
{{- end }}
3535
serviceAccountName: {{ include "langflow.serviceAccountName" . }}
3636
securityContext:
37-
{{- toYaml .Values.langflow.backend.podSecurityContext | nindent 8 }}
38-
{{- if .Values.secretProvider.enabled }}
37+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
3938
volumes:
39+
{{- if .Values.secretProvider.enabled }}
4040
- name: secrets-store-inline
4141
csi:
4242
driver: secrets-store.csi.k8s.io
4343
readOnly: true
4444
volumeAttributes:
4545
secretProviderClass: "{{- .Values.secretProvider.name }}"
46-
{{- end }}
46+
{{- end }}
47+
{{- with .Values.langflow.backend.volumes }}
48+
{{- toYaml . | nindent 8 }}
49+
{{- end }}
4750
containers:
4851
- name: {{ .Chart.Name }}
4952
securityContext:
50-
{{- toYaml .Values.langflow.backend.securityContext | nindent 12 }}
53+
{{- toYaml .Values.securityContext | nindent 12 }}
5154
image: "{{ .Values.langflow.backend.image.repository }}:{{ .Values.langflow.backend.image.tag | default .Values.langflow.global.image.tag | default .Chart.AppVersion }}"
52-
imagePullPolicy: {{ .Values.langflow.backend.image.pullPolicy | default .Values.langflow.global.image.pullPolicy }}
55+
imagePullPolicy: {{ .Values.langflow.backend.image.imagePullPolicy | default .Values.langflow.global.image.imagePullPolicy }}
5356
command: ["/bin/bash", "-c"]
5457
args:
5558
- >
@@ -65,9 +68,8 @@ spec:
6568
- name: http
6669
containerPort: {{ .Values.langflow.backend.service.port }}
6770
protocol: TCP
68-
{{- if or .Values.secretProvider.enabled .Values.langflow.backend.sqlite.enabled }}
71+
{{- if or .Values.secretProvider.enabled .Values.langflow.backend.sqlite.enabled .Values.langflow.backend.volumeMounts }}
6972
volumeMounts:
70-
{{- end }}
7173
{{- if .Values.secretProvider.enabled }}
7274
- name: secrets-store-inline
7375
mountPath: "/mnt/secrets"
@@ -77,6 +79,10 @@ spec:
7779
- name: data
7880
mountPath: /data
7981
{{- end }}
82+
{{- with .Values.langflow.backend.volumeMounts }}
83+
{{- toYaml . | nindent 12 }}
84+
{{- end }}
85+
{{- end }}
8086
livenessProbe:
8187
httpGet:
8288
path: /health
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- $openshift := .Capabilities.APIVersions.Has "security.openshift.io/v1" -}}
2+
{{- if .Values.serviceAccount.create -}}
3+
{{- if $openshift -}}
4+
apiVersion: rbac.authorization.k8s.io/v1
5+
kind: ClusterRole
6+
metadata:
7+
name: {{ include "langflow.fullname" . }}-openshift-scc
8+
labels:
9+
{{- include "langflow.labels" . | nindent 4 }}
10+
rules:
11+
- apiGroups:
12+
- security.openshift.io
13+
resourceNames:
14+
- anyuid
15+
- nonroot-v2
16+
resources:
17+
- securitycontextconstraints
18+
verbs:
19+
- use
20+
{{- end }}
21+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- $openshift := .Capabilities.APIVersions.Has "security.openshift.io/v1" -}}
2+
{{- if .Values.serviceAccount.create -}}
3+
{{- if $openshift -}}
4+
apiVersion: rbac.authorization.k8s.io/v1
5+
kind: ClusterRoleBinding
6+
metadata:
7+
name: {{ include "langflow.fullname" . }}-openshift-scc
8+
labels:
9+
{{- include "langflow.labels" . | nindent 4 }}
10+
roleRef:
11+
apiGroup: rbac.authorization.k8s.io
12+
kind: ClusterRole
13+
name: {{ include "langflow.fullname" . }}-openshift-scc
14+
subjects:
15+
- kind: ServiceAccount
16+
name: {{ include "langflow.serviceAccountName" . }}
17+
namespace: {{ .Release.Namespace }}
18+
{{- end -}}
19+
{{- end -}}

charts/langflow-ide/templates/frontend-deployment.yaml

+21-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
{{- end }}
3535
serviceAccountName: {{ include "langflow.serviceAccountName" . }}
3636
securityContext:
37-
{{- toYaml .Values.langflow.frontend.podSecurityContext | nindent 8 }}
37+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
3838
volumes:
3939
{{- if .Values.secretProvider.enabled }}
4040
- name: secrets-store-inline
@@ -44,12 +44,19 @@ spec:
4444
volumeAttributes:
4545
secretProviderClass: "{{- .Values.secretProvider.name }}"
4646
{{- end }}
47+
{{- with .Values.langflow.frontend.volumes }}
48+
{{- toYaml . | nindent 8 }}
49+
{{- end }}
50+
- name: nginx
51+
emptyDir: {}
52+
- name: nginx-cache
53+
emptyDir: {}
4754
containers:
4855
- name: {{ .Chart.Name }}
49-
securityContext:
50-
{{- toYaml .Values.langflow.securityContext | nindent 12 }}
5156
image: "{{ .Values.langflow.frontend.image.repository }}:{{ .Values.langflow.frontend.image.tag | default .Values.langflow.global.image.tag | default .Chart.AppVersion }}"
52-
imagePullPolicy: {{ .Values.langflow.frontend.image.pullPolicy | default .Values.langflow.global.image.pullPolicy }}
57+
imagePullPolicy: {{ .Values.langflow.frontend.image.imagePullPolicy | default .Values.langflow.global.image.imagePullPolicy }}
58+
securityContext:
59+
{{- toYaml .Values.securityContext | nindent 12 }}
5360
ports:
5461
- name: http
5562
containerPort: {{ .Values.langflow.frontend.service.port }}
@@ -60,6 +67,16 @@ spec:
6067
mountPath: "/mnt/secrets"
6168
readOnly: true
6269
{{- end }}
70+
{{- with .Values.langflow.frontend.volumeMounts }}
71+
{{- toYaml . | nindent 12 }}
72+
{{- end }}
73+
74+
- name: nginx
75+
mountPath: "/tmp/nginx"
76+
readOnly: false
77+
- name: nginx-cache
78+
mountPath: "/var/cache/nginx"
79+
readOnly: false
6380
livenessProbe:
6481
httpGet:
6582
path: /index.html

charts/langflow-ide/values.yaml

+99-37
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
imagePullSecrets: []
22

3-
nameOverride: "langflow"
3+
nameOverride: "langflow-service"
44
# Override for the name of the helm deployment
5-
fullnameOverride: "langflow"
5+
# Note: using `langflow` as service name causes
6+
# env var collision when deploying on openshift
7+
# https://github.com/langflow-ai/langflow/issues/4330#issuecomment-2459097917
8+
fullnameOverride: "langflow-service"
69

710
serviceAccount:
811
# Specifies whether a service account should be created
912
create: true
1013
# Annotations to add to the service account
1114
annotations: {}
1215
# The name of the service account to use.
13-
# If not set and create is true, a name is generated using the fullname template
16+
# If not set and create is true, a name is generated using the
17+
# fullname template
1418
name: ""
1519

1620
ingress:
@@ -26,11 +30,27 @@ ingress:
2630
# hosts:
2731
# - chart-example.local
2832

33+
securityContext:
34+
capabilities:
35+
drop:
36+
- ALL
37+
readOnlyRootFilesystem: true
38+
runAsNonRoot: true
39+
runAsUser: 1000
40+
allowPrivilegeEscalation: false
41+
runAsGroup: 1000
42+
43+
podSecurityContext:
44+
fsGroup: 1000
45+
runAsUser: 1000
46+
runAsNonRoot: true
47+
runAsGroup: 1000
48+
49+
2950
langflow:
3051
global:
3152
image:
32-
pullPolicy: IfNotPresent
33-
tag: ""
53+
tag: "latest"
3454
backend:
3555
replicaCount: 1
3656
service:
@@ -39,9 +59,17 @@ langflow:
3959
backendOnly: true
4060
numWorkers: 1
4161
image:
42-
repository: langflowai/langflow-backend
43-
pullPolicy: IfNotPresent
44-
tag: ""
62+
repository: langflowai/langflow
63+
imagePullPolicy: IfNotPresent
64+
tag: latest
65+
command:
66+
- python
67+
- -m
68+
- langflow
69+
- run
70+
- --host
71+
- 0.0.0.0
72+
- --backend-only
4573
resources:
4674
requests:
4775
cpu: 0.5
@@ -54,42 +82,75 @@ langflow:
5482
periodSeconds: 10
5583
timeoutSeconds: 5
5684
initialDelaySeconds: 5
57-
env: []
85+
env:
86+
- name: LANGFLOW_PORT
87+
value: "7860"
88+
- name: LANGFLOW_ALEMBIC_LOG_FILE
89+
value: "/app/db/alembic.log"
90+
- name: LANGFLOW_UPDATE_STARTER_PROJECTS
91+
value: "false"
5892
nodeSelector: {}
59-
60-
6193
tolerations: []
62-
6394
affinity: {}
6495
podAnnotations:
6596
prometheus.io/scrape: "true"
66-
prometheus.io/port: "9090"
97+
prometheus.io/port: 9090
6798
prometheus.io/path: "/metrics"
6899

69-
securityContext: {}
70-
# capabilities:
71-
# drop:
72-
# - ALL
73-
# readOnlyRootFilesystem: true
74-
# runAsNonRoot: true
75-
# runAsUser: 1000
76-
77-
podSecurityContext: {}
100+
securityContext:
101+
capabilities:
102+
drop:
103+
- ALL
104+
readOnlyRootFilesystem: true
105+
runAsNonRoot: true
106+
runAsUser: 1000
107+
allowPrivilegeEscalation: false
108+
runAsGroup: 1000
109+
110+
podSecurityContext:
111+
fsGroup: 1000
112+
runAsUser: 1000
113+
runAsNonRoot: true
114+
runAsGroup: 1000
78115

79116
externalDatabase:
80-
# Compose in the SQLAlchemy format: https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls
117+
# Compose in the SQLAlchemy format:
118+
# https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls
81119
enabled: false
82120
driver: {}
83121
# value: "postgresql"
84122
port: {}
85123
user: {}
86124
password: {}
87-
# valueFrom:
88-
# secretKeyRef:
89-
# key: password
125+
# valueFrom:
126+
# secretKeyRef:
127+
# key: password
90128
# name: <secret-name>
91129
database: {}
92130

131+
volumes:
132+
- name: flows
133+
emptyDir: {}
134+
- name: tmp
135+
emptyDir: {}
136+
- name: data
137+
emptyDir: {}
138+
- name: db
139+
emptyDir: {}
140+
141+
volumeMounts:
142+
- name: flows
143+
mountPath: /app/flows
144+
readOnly: false
145+
- name: tmp
146+
mountPath: /tmp
147+
readOnly: false
148+
- name: data
149+
mountPath: /app/data
150+
readOnly: false
151+
- name: db
152+
mountPath: /app/db
153+
readOnly: false
93154

94155
sqlite:
95156
enabled: true
@@ -133,7 +194,7 @@ langflow:
133194
# superuserPassword: <superuser password>
134195
# secretKey: <encryption key, optional>
135196
# newUserIsActive: true|false
136-
197+
137198
frontend:
138199
enabled: true
139200
replicaCount: 1
@@ -142,8 +203,8 @@ langflow:
142203
port: 8080
143204
image:
144205
repository: langflowai/langflow-frontend
145-
pullPolicy: IfNotPresent
146-
tag: ""
206+
imagePullPolicy: IfNotPresent
207+
tag: latest
147208
resources:
148209
requests:
149210
cpu: 0.3
@@ -162,14 +223,15 @@ langflow:
162223

163224
affinity: {}
164225
podAnnotations: {}
165-
podSecurityContext: {}
166-
securityContext: {}
167-
# capabilities:
168-
# drop:
169-
# - ALL
170-
# readOnlyRootFilesystem: true
171-
# runAsNonRoot: true
172-
# runAsUser: 1000
226+
227+
volumes:
228+
- name: tmp
229+
emptyDir: {}
230+
231+
volumeMounts:
232+
- name: tmp
233+
mountPath: /tmp
234+
readOnly: false
173235

174236
secretProvider:
175237
enabled: false

charts/langflow-runtime/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: langflow-runtime
33
description: A helm chart for running LangFlow flows as a service
44
type: application
5-
version: 0.1.0
5+
version: 0.1.1
66
appVersion: latest
77
maintainers:
88
- name: Langflow
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- $openshift := .Capabilities.APIVersions.Has "security.openshift.io/v1" -}}
2+
{{- if .Values.serviceAccount.create -}}
3+
{{- if $openshift -}}
4+
apiVersion: rbac.authorization.k8s.io/v1
5+
kind: ClusterRole
6+
metadata:
7+
name: {{ include "langflow-runtime.fullname" . }}-openshift-scc
8+
labels:
9+
{{- include "langflow-runtime.labels" . | nindent 4 }}
10+
rules:
11+
- apiGroups:
12+
- security.openshift.io
13+
resourceNames:
14+
- anyuid
15+
- nonroot-v2
16+
resources:
17+
- securitycontextconstraints
18+
verbs:
19+
- use
20+
{{- end }}
21+
{{- end -}}

0 commit comments

Comments
 (0)