Skip to content

Commit

Permalink
feat:invite app add deployment files (#4614)
Browse files Browse the repository at this point in the history
Signed-off-by: jingyang <3161362058@qq.com>
  • Loading branch information
zjy365 committed Mar 25, 2024
1 parent cda0c5c commit 929faae
Show file tree
Hide file tree
Showing 6 changed files with 198 additions and 9 deletions.
13 changes: 13 additions & 0 deletions frontend/providers/invite/deploy/Kubefile
@@ -0,0 +1,13 @@
FROM scratch

USER 65532:65532

COPY registry registry
COPY manifests manifests

ENV cloudDomain="127.0.0.1.nip.io"
ENV cloudPort=""
ENV certSecretName="wildcard-cert"
ENV lafBaseUrl=""

CMD ["kubectl apply -f manifests"]
19 changes: 19 additions & 0 deletions frontend/providers/invite/deploy/manifests/appcr.yaml.tmpl
@@ -0,0 +1,19 @@
apiVersion: app.sealos.io/v1
kind: App
metadata:
name: invite
namespace: app-system
spec:
data:
desc: invite
url: "https://invite.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}"
icon: "https://invite.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}/logo.svg"
menuData:
helpDropDown: false
nameColor: text-black
name: invite
type: iframe
displayType: normal
i18n:
zh:
name: 邀请注册
86 changes: 86 additions & 0 deletions frontend/providers/invite/deploy/manifests/deploy.yaml.tmpl
@@ -0,0 +1,86 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
app: invite-frontend
name: invite-frontend
---
apiVersion: v1
kind: ConfigMap
metadata:
name: invite-frontend-config
namespace: invite-frontend
data:
config.yaml: |-
addr: :3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: invite-frontend
namespace: invite-frontend
spec:
replicas: 1
selector:
matchLabels:
app: invite-frontend
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
template:
metadata:
labels:
app: invite-frontend
spec:
containers:
- name: invite-frontend
env:
- name: SEALOS_DOMAIN
value: {{ .cloudDomain }}
- name: LAF_BASE_URL
value: {{ .lafBaseUrl }}
- name: GIFT_RATIO
value: "0.1"
securityContext:
runAsNonRoot: true
runAsUser: 1001
allowPrivilegeEscalation: false
capabilities:
drop:
- 'ALL'
resources:
limits:
cpu: 1000m
memory: 1024Mi
requests:
cpu: 10m
memory: 128Mi
# do not modify this image, it is used for CI/CD
image: ghcr.io/labring/sealos-invite-frontend:latest
imagePullPolicy: Always
volumeMounts:
- name: invite-frontend-volume
mountPath: /config.yaml
subPath: config.yaml
volumes:
- name: invite-frontend-volume
configMap:
name: invite-frontend-config
---
apiVersion: v1
kind: Service
metadata:
labels:
app: invite-frontend
name: invite-frontend
namespace: invite-frontend
spec:
ports:
- name: http
port: 3000
protocol: TCP
targetPort: 3000
selector:
app: invite-frontend
51 changes: 51 additions & 0 deletions frontend/providers/invite/deploy/manifests/ingress.yaml.tmpl
@@ -0,0 +1,51 @@
# Copyright © 2023 sealos.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/cors-allow-methods: "PUT, GET, POST, DELETE, PATCH, OPTIONS"
nginx.ingress.kubernetes.io/cors-allow-origin: "https://{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}, https://*.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}"
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
nginx.ingress.kubernetes.io/cors-max-age: "600"
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
nginx.ingress.kubernetes.io/configuration-snippet: |
more_clear_headers "X-Frame-Options:";
more_set_headers "Content-Security-Policy: default-src * blob: data: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}; img-src * data: blob: resource: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}; connect-src * wss: blob: resource:; style-src 'self' 'unsafe-inline' blob: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} resource:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} resource: *.baidu.com *.bdstatic.com https://js.stripe.com; frame-src 'self' *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} mailto: tel: weixin: mtt: *.baidu.com https://js.stripe.com; frame-ancestors 'self' https://{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} https://*.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}";
more_set_headers "X-Xss-Protection: 1; mode=block";
higress.io/response-header-control-remove: X-Frame-Options
higress.io/response-header-control-update: |
Content-Security-Policy "default-src * blob: data: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}; img-src * data: blob: resource: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}; connect-src * wss: blob: resource:; style-src 'self' 'unsafe-inline' blob: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} resource:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} resource: *.baidu.com *.bdstatic.com https://js.stripe.com; frame-src 'self' *.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} {{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} mailto: tel: weixin: mtt: *.baidu.com https://js.stripe.com; frame-ancestors 'self' https://{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }} https://*.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}"
X-Xss-Protection "1; mode=block"
name: invite-frontend
namespace: invite-frontend
spec:
rules:
- host: invite.{{ .cloudDomain }}
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: invite-frontend
port:
number: 3000
tls:
- hosts:
- invite.{{ .cloudDomain }}
secretName: {{ .certSecretName }}
Binary file modified frontend/providers/invite/public/favicon.ico
Binary file not shown.
38 changes: 29 additions & 9 deletions frontend/providers/invite/public/logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 929faae

Please sign in to comment.