This commit is contained in:
zeaslity
2024-10-30 16:30:51 +08:00
commit 437acbeb63
3363 changed files with 653948 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
ci/*
/templates/traefik.yaml

View File

@@ -0,0 +1,14 @@
apiVersion: v2
name: frontend-app
description: uavcloud frontend applications
version: 1.2.2
appVersion: 2.2.2
keywords:
- uavcloud
- frontend
- template
- function
- chinamobile

View File

@@ -0,0 +1,3 @@
所有的前端应用已经部署完成!

View File

@@ -0,0 +1,34 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Create chart name and version as used by the chart label.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "frontend-app.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 }}
{{- end }}
{{/*
Create the node affinity to determine the deployment of environment
*/}}
{{- define "frontend-app.affinity" -}}
{{- with .Values.global.domain -}}
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: uavcloud.affinity
operator: In
values:
- {{ .k8sNodeEnv }}
{{- end }}
{{- end }}
{{/*
Create the tls configuration for https to enable trafik-ingress
*/}}
{{/*{{- define "frontend-app.trafik.tls" -}}*/}}
{{/*entryPoints:*/}}
{{/* - websecure*/}}
{{/*tls:*/}}
{{/* certResolver: default*/}}
{{/*{{- end }}*/}}

View File

@@ -0,0 +1,71 @@
{{- $namespace := .Release.Namespace -}}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-cm
namespace: {{ $namespace }}
labels:
cmii.type: {{ $.Values.application.type }}
data:
nginx.conf: |
user root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 9528;
server_name localhost;
gzip on;
location / {
root /home/cmii-platform/dist;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: default-nginx-cm
namespace: {{ $namespace }}
data:
default.conf: |
server {
listen 9528;
server_name localhost;
location / {
if ($request_filename ~* ^.*?\.(css|js|gif|gz|svg|mp4|ogg|ogv|webm|htc|xml|woff)$){
# add_header Cache-Control no-cache;
add_header Cache-Control max-age=315360000;
# expires 30d;
}
root /home/cmii-platform/dist;
index index.html index.htm;
try_files $uri $uri/ /index.html;
gzip on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
---

View File

@@ -0,0 +1,101 @@
{{- if .Values.enabled }}
{{- $namespace := .Release.Namespace -}}
{{- $scope := $ -}}
{{- range .Values.application.manifest }}
{{- if .enabled -}}
{{- $applicationName := .name | trunc 63 }}
{{- $applicationShortName := trimPrefix "cmii-uav-platform" $applicationName }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $applicationName }}
namespace: {{ $namespace }}
labels:
cmii.type: {{ $.Values.application.type }}
cmii.app: {{ $applicationName }}
helm.sh/chart: {{ include "frontend-app.chart" $scope }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
app.kubernetes.io/chart-version: {{ $.Chart.AppVersion | quote }}
app.kubernetes.io/app-version: {{ $.Values.global.image.tag | quote }}
spec:
replicas: {{ $.Values.replicaCount }}
strategy:
rollingUpdate:
maxUnavailable: 1
selector:
matchLabels:
cmii.type: {{ $.Values.application.type }}
cmii.app: {{ $applicationName }}
template:
metadata:
{{- with $.Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
cmii.type: {{ $.Values.application.type }}
cmii.app: {{ $applicationName }}
spec:
imagePullSecrets:
- name: harborsecret
securityContext:
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ $applicationName }}
image: "{{ default $.Values.global.image.repository }}/{{ $applicationName }}:{{ .tag }}"
imagePullPolicy: {{ default $.Values.global.image.pullPolicy }}
env:
- name: K8S_NAMESPACE
value: {{ $namespace }}
- name: APPLICATION_NAME
value: {{ $applicationName }}
ports:
- name: platform-9528
containerPort: 9528
protocol: TCP
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: 500m
memory: 500Mi
volumeMounts:
- name: nginx-conf
mountPath: /usr/local/nginx/conf/nginx.conf
subPath: nginx.conf
- name: default-nginx-conf
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
- name: tenant-prefix
subPath: ingress-config.js
mountPath: /home/cmii-platform/dist/ingress-config.js
volumes:
- name: nginx-conf
configMap:
name: nginx-cm
items:
- key: nginx.conf
path: nginx.conf
- name: default-nginx-conf
configMap:
name: default-nginx-cm
items:
- key: default.conf
path: default.conf
- name: tenant-prefix
configMap:
{{- if eq $applicationShortName "" }}
name: tenant-prefix-platform
{{- else if eq $applicationShortName "-hyperspectral" }}
name: tenant-prefix-hyper
{{- else }}
name: tenant-prefix{{ $applicationShortName }}
{{- end }}
items:
- key: ingress-config.js
path: ingress-config.js
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,34 @@
{{- if .Values.enabled }}
{{- $namespace := .Release.Namespace -}}
{{- $scope := $ -}}
{{- range .Values.application.manifest }}
{{- if .enabled -}}
{{- $applicationName := .name | trunc 63 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ $applicationName }}
namespace: {{ $namespace }}
labels:
cmii.type: {{ $.Values.application.type }}
cmii.app: {{ $applicationName }}
helm.sh/chart: {{ include "frontend-app.chart" $scope }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
{{- if $.Values.global.image.tag }}
app.kubernetes.io/version: {{ $.Values.global.image.tag }}
{{- end }}
spec:
type: {{ $.Values.global.appServiceType.frontend }}
selector:
cmii.type: {{ $.Values.application.type }}
cmii.app: {{ $applicationName }}
ports:
- name: web-svc-port
port: 9528
protocol: TCP
targetPort: 9528
---
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,31 @@
{{- $namespace := .Release.Namespace -}}
{{- $scope := $ -}}
{{- range $key, $enable := .Values.application.names }}
{{- if $enable -}}
{{- $applicationName := $key | trunc 63 }}
---
apiVersion: v1
kind: Pod
metadata:
name: "{{ $applicationName }}-test-connection"
namespace: {{ $namespace }}
labels:
type: {{ $.Values.application.type }}
app: {{ $applicationName }}
helm.sh/chart: {{ include "frontend-app.chart" $scope }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
{{- if $.Chart.AppVersion }}
app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
{{- end }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ $applicationName }}:{{ $.Values.service.ports.port }}']
restartPolicy: Never
---
{{- end }}
{{- end }}

View File

@@ -0,0 +1,37 @@
{{- $namespace := .Release.Namespace -}}
{{- $scope := $ -}}
{{/* fetch all the ingress application which is enable to expose to outside as domain address */}}
{{- $ingressList := list -}}
{{- range .Values.ingress.applicationNames }}
{{- $ingressList = append $ingressList . -}}
{{- end }}
{{- range $key, $enable := .Values.application.names }}
{{- if $enable -}}
{{- $applicationName := $key | trunc 63 }}
{{- if has $applicationName $ingressList -}}
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: {{ $applicationName }}
namespace: {{ $namespace }}
labels:
cmii.type: {{ $.Values.application.type }}
cmii.app: {{ $applicationName }}
helm.sh/chart: {{ include "uavcloud-fe-core.chart" $scope }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
{{- if $.Chart.AppVersion }}
app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
{{- end }}
spec:
{{- include "uavcloud-fe-core.trafik.tls" $scope | nindent 2 }}
routes:
- match: Host(`{{ $applicationName }}.{{ $namespace }}.io`)
kind: Rule
services:
- name: {{ $applicationName }}
port: {{ $.Values.service.ports.port }}
---
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,36 @@
application:
manifest:
- {config: null, enabled: true, modules: null, name: cmii-uav-platform, tag: 3.1.0}
- {config: null, enabled: true, modules: null, name: cmii-uav-platform-ai-brain,
tag: 3.1.0}
- {config: null, enabled: true, modules: null, name: cmii-uav-platform-mws, tag: 3.1.0}
- {config: null, enabled: true, modules: null, name: cmii-uav-platform-oms, tag: 3.1.0}
- {config: null, enabled: true, modules: null, name: cmii-uav-platform-open, tag: 3.1.0}
- {config: null, enabled: true, modules: null, name: cmii-uav-platform-splice, tag: 3.1.0}
- {config: null, enabled: true, modules: null, name: cmii-uav-platform-visualization,
tag: 3.1.0}
- {config: null, enabled: true, modules: null, name: cmii-uav-platform-security,
tag: 3.1.0}
- {config: null, enabled: true, modules: null, name: cmii-uav-platform-detection,
tag: 3.1.0}
- {config: null, enabled: true, modules: null, name: cmii-uav-platform-share, tag: 3.1.0}
- {config: null, enabled: true, modules: null, name: cmii-uav-platform-cms-portal,
tag: 3.1.0}
type: frontend
autoscaling: {enabled: null}
enabled: null
env: {custJavaOpts: null, nacosRegistry: null}
global:
affinity: null
appServiceType: {backend: null, frontend: null}
domain: null
image: {pullPolicy: null, repository: null, tag: null}
ingress: null
middlewareService: null
nodeAffinityPreset: {key: null, type: null, values: null}
pvc: {storageClass: null}
podAnnotations: {}
podSecurityContext: {}
replicaCount: 1
securityContext: {}
serviceAccount: {annotations: null, create: null, name: null}