Skip to content

Commit

Permalink
fix(gateway): fix cors headers conf of runtime, ingress nginx install…
Browse files Browse the repository at this point in the history
…ation (#1565)
  • Loading branch information
maslow committed Oct 7, 2023
1 parent 7781a3e commit 8de0a29
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions build/charts/laf-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ spec:
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: DEFAULT_REGION_NAMESPACE
value: {{ .Values.default_region.fixed_namespace | quote}}
- name: DATABASE_URL
value: {{ .Values.databaseUrl | quote}}
- name: METERING_DATABASE_URL
Expand Down
1 change: 1 addition & 0 deletions build/charts/laf-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ apiServerUrl: ""
siteName: "laf"
# init default region conf
default_region:
fixed_namespace: ""
# db conf
database_url: ""
# minio conf
Expand Down
2 changes: 1 addition & 1 deletion build/charts/laf-web/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ spec:
name: laf-server
port:
number: 3000
path: /v1/*
path: /v1/
pathType: Prefix
1 change: 1 addition & 0 deletions build/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ LOG_SERVER_URL="http://log-server.${NAMESPACE}.svc.cluster.local:5060"
LOG_SERVER_DATABASE_URL="mongodb://${DB_USERNAME:-admin}:${PASSWD_OR_SECRET}@mongodb-0.mongo.${NAMESPACE}.svc.cluster.local:27017/function-logs?authSource=admin&replicaSet=rs0&w=majority"
LOG_SERVER_SECRET=$PASSWD_OR_SECRET
helm install server -n ${NAMESPACE} \
--set fixed_namespace=${NAMESPACE} \
--set databaseUrl=${DATABASE_URL} \
--set meteringDatabaseUrl=${METERING_DATABASE_URL} \
--set jwt.secret=${SERVER_JWT_SECRET} \
Expand Down
4 changes: 3 additions & 1 deletion deploy/install-on-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ kubectl label node $NODENAME laf.dev/node.type=runtime
sealos run labring/openebs:v1.9.0
sealos run labring/cert-manager:v1.8.0
sealos run labring/metrics-server:v0.6.2
sealos run ingress-nginx:v1.8.1
sealos run docker.io/labring/ingress-nginx:v1.8.1 \
-e HELM_OPTS="--set controller.hostNetwork=true --set controller.kind=DaemonSet --set controller.service.enabled=false"


sealos run --env DOMAIN=$DOMAIN --env DB_PV_SIZE=5Gi --env OSS_PV_SIZE=5Gi --env EXTERNAL_HTTP_SCHEMA=http lafyun/laf:latest
5 changes: 4 additions & 1 deletion server/src/gateway/ingress/runtime-ingress.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ export class RuntimeGatewayService {
'nginx.ingress.kubernetes.io/enable-cors': 'true',
'nginx.ingress.kubernetes.io/cors-allow-credentials': 'true',
'nginx.ingress.kubernetes.io/cors-allow-methods': '*',
'nginx.ingress.kubernetes.io/cors-allow-headers': '*',
'nginx.ingress.kubernetes.io/cors-allow-headers':
'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,x-laf-develop-token,x-laf-func-data',
'nginx.ingress.kubernetes.io/cors-expose-headers': '*',
'nginx.ingress.kubernetes.io/cors-allow-origin': '*',
'nginx.ingress.kubernetes.io/server-snippet':
'client_header_buffer_size 4096k;\nlarge_client_header_buffers 8 512k;\n',
},
},
spec: { ingressClassName, rules, tls },
Expand Down

0 comments on commit 8de0a29

Please sign in to comment.