This commit is contained in:
2025-11-17 18:45:35 +01:00
parent 0f58e3bdff
commit 14d6f9aa73
7607 changed files with 1969407 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
{{- $nameSpace := include "lowcoder.namespace" . -}}
{{- $name := include "lowcoder.fullname" . -}}
{{- $lowcoderDatabase := first .Values.mongodb.auth.databases -}}
{{- $redisSecret := lookup "v1" "Secret" $nameSpace .Values.redis.auth.existingSecret | default dict -}}
{{- $redisPassword := (index ($redisSecret.data|default dict) .Values.redis.auth.existingSecretPasswordKey | default "" | b64dec) -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "lowcoder.fullname" . }}-api-service
labels:
{{- include "lowcoder.labels" . | nindent 4 }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
data:
{{- if .Values.redis.enabled }}
{{- if .Values.redis.auth.enabled }}
LOWCODER_REDIS_URL: "redis://{{ $redisPassword }}@{{ $name }}-redis-master.{{ $nameSpace }}.svc.cluster.local:6379"
{{- else }}
LOWCODER_REDIS_URL: "redis://{{ $name }}-redis-master.{{ $nameSpace }}.svc.cluster.local:6379"
{{- end }}
{{- else }}
{{- if .Values.redis.auth.enabled }}
LOWCODER_REDIS_URL: "redis://{{ $redisPassword }}@{{ .Values.redis.externalUrl }}"
{{- else }}
LOWCODER_REDIS_URL: "redis://{{ .Values.redis.externalUrl }}"
{{- end }}
{{- end }}
{{- if .Values.global.config.nodeServiceUrl }}
LOWCODER_NODE_SERVICE_URL: {{ .Values.global.config.nodeServiceUrl | quote }}
{{- else }}
LOWCODER_NODE_SERVICE_URL: "http://{{ $name }}-node-service:{{ .Values.nodeService.service.port }}"
{{- end }}
LOWCODER_PUID: {{ .Values.global.config.userId | default "9001" | quote }}
LOWCODER_PGID: {{ .Values.global.config.groupId | default "9001" | quote }}
LOWCODER_CORS_DOMAINS: {{ .Values.global.config.corsAllowedDomains | default "*" | quote }}
LOWCODER_EMAIL_AUTH_ENABLED: {{ .Values.global.config.enableEmailAuth | default "true" | quote }}
LOWCODER_EMAIL_SIGNUP_ENABLED: {{ .Values.global.config.enableUserSignUp | default "true" | quote }}
LOWCODER_EMAIL_NOTIFICATIONS_SENDER: {{ .Values.global.config.emailNotificationSender | default "info@localhost" | quote }}
LOWCODER_MAX_QUERY_TIMEOUT: {{ .Values.global.config.maxQueryTimeout | default "120" | quote }}
LOWCODER_MAX_REQUEST_SIZE: {{ .Values.global.config.maxRequestSize | default "20m" | quote }}
LOWCODER_MAX_ORGS_PER_USER: {{ .Values.global.defaults.maxOrgsPerUser | default "100" | quote }}
LOWCODER_MAX_MEMBERS_PER_ORG: {{ .Values.global.defaults.maxMembersPerOrg | default "1000" | quote }}
LOWCODER_MAX_GROUPS_PER_ORG: {{ .Values.global.defaults.maxGroupsPerOrg | default "100" | quote }}
LOWCODER_MAX_APPS_PER_ORG: {{ .Values.global.defaults.maxAppsPerOrg | default "1000" | quote }}
LOWCODER_MAX_DEVELOPERS: {{ .Values.global.defaults.maxDevelopers | default "50" | quote }}
LOWCODER_DEFAULT_QUERY_TIMEOUT: {{ .Values.global.defaults.queryTimeout | default "10" | quote }}
LOWCODER_WORKSPACE_MODE: {{ .Values.global.config.workspaceMode | default "SAAS" | quote }}
LOWCODER_CREATE_WORKSPACE_ON_SIGNUP: {{ .Values.global.config.createWorkspaceOnSignup | default "true" | quote }}
LOWCODER_ADMIN_SMTP_HOST: {{ .Values.global.mailServer.host | default "localhost" | quote }}
LOWCODER_ADMIN_SMTP_PORT: {{ .Values.global.mailServer.port | default "578" | quote }}
LOWCODER_ADMIN_SMTP_AUTH: {{ .Values.global.mailServer.smtpAuth | default "false" | quote }}
LOWCODER_ADMIN_SMTP_USERNAME: {{ .Values.global.mailServer.authUsername | default "" | quote }}
LOWCODER_ADMIN_SMTP_PASSWORD: {{ .Values.global.mailServer.authPassword | default "" | quote }}
LOWCODER_ADMIN_SMTP_SSL_ENABLED: {{ .Values.global.mailServer.useSSL | default "false" | quote }}
LOWCODER_ADMIN_SMTP_STARTTLS_ENABLED: {{ .Values.global.mailServer.useStartTLS | default "true" | quote }}
LOWCODER_ADMIN_SMTP_STARTTLS_REQUIRED: {{ .Values.global.mailServer.requireStartTLS | default "true" | quote }}
LOWCODER_API_RATE_LIMIT: {{ .Values.global.defaults.apiRateLimit | default "100" | quote }}
LOWCODER_APP_SNAPSHOT_RETENTIONTIME: {{ .Values.global.config.snapshotRetentionTime | default "30" | quote }}
LOWCODER_COOKIE_NAME: {{ .Values.global.cookie.name | default "LOWCODER_CE_SELFHOST_TOKEN" | quote }}
LOWCODER_COOKIE_MAX_AGE: {{ .Values.global.cookie.maxAge | default "24" | quote }}
LOWCODER_MARKETPLACE_PRIVATE_MODE: {{ .Values.global.config.marketplacePrivateMode | default "true" | quote }}
LOWCODER_PLUGINS_DIR: {{ .Values.global.plugins.folder | default "/plugins" | quote }}
LOWCODER_PUBLIC_URL: {{ .Values.global.config.publicUrl | default "https://somedomain.com/" | quote }}

View File

@@ -0,0 +1,84 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "lowcoder.fullname" . }}-api-service
labels:
{{- include "lowcoder.labels" . | nindent 4 }}
spec:
{{- if not .Values.apiService.autoscaling.enabled }}
replicas: {{ .Values.apiService.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "lowcoder.selectorLabels" (dict "component" "api-service" "Values" .Values "Release" .Release "Chart" .Chart) | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "lowcoder.selectorLabels" (dict "component" "api-service" "Values" .Values "Release" .Release "Chart" .Chart) | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "lowcoder.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.mongodb.enabled }}
initContainers:
- name: {{ .Chart.Name }}-wait-for-mongo
image: curlimages/curl:7.87.0
command:
- /bin/sh
args:
- -ec
- |
echo "Wait for mongo database to be ready"
while [[ $(curl --connect-timeout 2 -sw '%{http_code}' 'http://{{ .Values.mongodb.service.nameOverride }}:27017' -o /dev/null) -ne 200 ]]; do
sleep 1;
echo ' still waiting...';
done;
echo 'Connection with MongoDB established.'
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.apiService.image.repository }}:{{ .Values.apiService.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.apiService.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "lowcoder.fullname" . }}-api-service
- secretRef:
name: {{ include "lowcoder.fullname" . }}-api-service
ports:
- name: lowcoder-api
containerPort: 8080
protocol: TCP
livenessProbe:
initialDelaySeconds: 30
httpGet:
path: /api/status/health
port: lowcoder-api
readinessProbe:
initialDelaySeconds: 30
httpGet:
path: /api/status/health
port: lowcoder-api
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,32 @@
{{- if .Values.apiService.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "lowcoder.fullname" . }}-api-service
labels:
{{- include "lowcoder.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "lowcoder.fullname" . }}-api-service
minReplicas: {{ .Values.apiService.autoscaling.minReplicas }}
maxReplicas: {{ .Values.apiService.autoscaling.maxReplicas }}
metrics:
{{- if .Values.apiService.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.apiService.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.apiService.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.apiService.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,36 @@
{{- $nameSpace := include "lowcoder.namespace" . -}}
{{- $mongoUser := (and .Values.mongodb.auth.usernames (first .Values.mongodb.auth.usernames)) | default "" -}}
{{- $mongoPassword := (and .Values.mongodb.auth.passwords (first .Values.mongodb.auth.passwords)) | default "" -}}
{{- $mongoProtocol := ternary "mongodb+srv" "mongodb" .Values.mongodb.useSrv -}}
{{- $mongoSSL := ternary "true" "false" .Values.mongodb.useSSL -}}
{{- $lowcoderDatabase := first .Values.mongodb.auth.databases -}}
{{- $mongoSecret := lookup "v1" "Secret" $nameSpace .Values.mongodb.auth.existingSecret | default dict -}}
{{- $mongoSecretPassword := (index ($mongoSecret.data | default dict) "password" | default "" | b64dec) -}}
{{- $mongoServicename := .Values.mongodb.service.nameOverride | default "" -}}
{{- $externalUrl := .Values.mongodb.service.externalUrl -}}
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ include "lowcoder.fullname" . }}-api-service
labels:
{{- include "lowcoder.labels" . | nindent 4 }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
stringData:
{{- if .Values.mongodb.enabled }}
LOWCODER_MONGODB_URL: "{{ $mongoProtocol }}://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
{{- else }}
LOWCODER_MONGODB_URL: "{{ $mongoProtocol }}://{{ $mongoUser }}:{{ $mongoSecretPassword }}@{{ $externalUrl }}/{{ $lowcoderDatabase }}?retryWrites=true&ssl={{ $mongoSSL }}"
{{- end }}
LOWCODER_DB_ENCRYPTION_PASSWORD: {{ .Values.global.config.encryption.password | default "lowcoder.org" | quote }}
LOWCODER_DB_ENCRYPTION_SALT: {{ .Values.global.config.encryption.salt | default "lowcoder.org" | quote }}
LOWCODER_API_KEY_SECRET: "{{ .Values.global.config.apiKeySecret }}"
LOWCODER_SUPERUSER_USERNAME: {{ .Values.global.config.superuser.username | default "admin@localhost" | quote }}
LOWCODER_SUPERUSER_PASSWORD: {{ .Values.global.config.superuser.password | default "" | quote }}
LOWCODER_NODE_SERVICE_SECRET: {{ .values.global.config.nodeServiceSecret | default "62e348319ab9f5c43c3b5a380b4d82525cdb68740f21140e767989b509ab0aa2" | quote }}
LOWCODER_NODE_SERVICE_SECRET_SALT: {{ .values.global.config.nodeServiceSalt | default "lowcoder.org" | quote }}

View File

@@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "lowcoder.fullname" . }}-api-service
labels:
{{- include "lowcoder.labels" . | nindent 4 }}
spec:
type: {{ .Values.apiService.service.type }}
ports:
- port: {{ .Values.apiService.service.port }}
targetPort: lowcoder-api
protocol: TCP
name: lowcoder-api
{{- if .Values.apiService.service.nodePort }}
{{- if or (eq .Values.apiService.service.type "NodePort") (eq .Values.apiService.service.type "LoadBalancer") }}
nodePort: {{ .Values.apiService.service.nodePort }}
{{- end }}
{{- end }}
selector:
{{- include "lowcoder.selectorLabels" (dict "component" "api-service" "Values" .Values "Release" .Release "Chart" .Chart) | nindent 4 }}