610 lines
19 KiB
Go
610 lines
19 KiB
Go
package c_app
|
|
|
|
const CmiiFrontendConfigMapTemplate = `
|
|
kind: ConfigMap
|
|
apiVersion: v1
|
|
metadata:
|
|
name: tenant-prefix-{{ .ShortName }}
|
|
namespace: {{ .Namespace }}
|
|
data:
|
|
ingress-config.js: |-
|
|
var __GlobalIngressConfig = {
|
|
TenantEnvironment: "{{ .TenantEnv }}",
|
|
CloudHOST: "{{ .WebIP }}:{{ .WebPort }}",
|
|
ApplicationShortName: "{{ .ShortName }}",
|
|
AppClientId: "{{ .ClientId }}"
|
|
}
|
|
`
|
|
|
|
const CmiiFrontendDefaultNginxConfTemplate = `
|
|
kind: ConfigMap
|
|
apiVersion: v1
|
|
metadata:
|
|
name: nginx-cm
|
|
namespace: {{ .Namespace }}
|
|
labels:
|
|
cmii.type: frontend
|
|
data:
|
|
nginx.conf: |
|
|
user root;
|
|
worker_processes auto;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
http {
|
|
include mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
sendfile on;
|
|
|
|
keepalive_timeout 600;
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
const CmiiFrontendIngressTemplate = `
|
|
apiVersion: networking.k8s.io/v1beta1
|
|
kind: Ingress
|
|
metadata:
|
|
name: frontend-applications-ingress
|
|
namespace: {{ .Namespace }}
|
|
labels:
|
|
type: frontend
|
|
octopus.control: all-ingress-config-wdd
|
|
app.kubernetes.io/managed-by: octopus-control
|
|
app.kubernetes.io/version: {{ .TagVersion }}
|
|
annotations:
|
|
kubernetes.io/ingress.class: "nginx"
|
|
nginx.ingress.kubernetes.io/enable-cors: "true"
|
|
nginx.ingress.kubernetes.io/rewrite-target: /$1
|
|
nginx.ingress.kubernetes.io/configuration-snippet: |
|
|
rewrite ^(/green)$ $1/ redirect;
|
|
rewrite ^(/supervision)$ $1/ redirect;
|
|
rewrite ^(/inspection)$ $1/ redirect;
|
|
rewrite ^(/park)$ $1/ redirect;
|
|
rewrite ^(/pangu)$ $1/ redirect;
|
|
rewrite ^(/ai-brain)$ $1/ redirect;
|
|
rewrite ^(/base)$ $1/ redirect;
|
|
rewrite ^(/cms)$ $1/ redirect;
|
|
rewrite ^(/cmsportal)$ $1/ redirect;
|
|
rewrite ^(/detection)$ $1/ redirect;
|
|
rewrite ^(/emergency)$ $1/ redirect;
|
|
rewrite ^(/hyper)$ $1/ redirect;
|
|
rewrite ^(/logistics)$ $1/ redirect;
|
|
rewrite ^(/mws)$ $1/ redirect;
|
|
rewrite ^(/mws-admin)$ $1/ redirect;
|
|
rewrite ^(/oms)$ $1/ redirect;
|
|
rewrite ^(/open)$ $1/ redirect;
|
|
rewrite ^(/security)$ $1/ redirect;
|
|
rewrite ^(/share)$ $1/ redirect;
|
|
rewrite ^(/splice)$ $1/ redirect;
|
|
rewrite ^(/splice-visual)$ $1/ redirect;
|
|
rewrite ^(/traffic)$ $1/ redirect;
|
|
rewrite ^(/visualization)$ $1/ redirect;
|
|
rewrite ^(/communication)$ $1/ redirect;
|
|
rewrite ^(/infrastructure)$ $1/ redirect;
|
|
rewrite ^(/media)$ $1/ redirect;
|
|
rewrite ^(/seniclive)$ $1/ redirect;
|
|
spec:
|
|
rules:
|
|
- host: fake-domain.{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /inspection/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform
|
|
servicePort: 9528
|
|
- path: /supervision/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-suav-platform-supervision
|
|
servicePort: 9528
|
|
- path: /supervisionh5/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-suav-platform-supervisionh5
|
|
servicePort: 9528
|
|
- path: /green/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform
|
|
servicePort: 9528
|
|
- path: /park/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform
|
|
servicePort: 9528
|
|
- path: /pangu/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform
|
|
servicePort: 9528
|
|
- path: /emersupport/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform
|
|
servicePort: 9528
|
|
- path: /infrastructure/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform
|
|
servicePort: 9528
|
|
- path: /?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-cms-portal
|
|
servicePort: 9528
|
|
- path: /ai-brain/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-ai-brain
|
|
servicePort: 9528
|
|
- path: /base/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-base
|
|
servicePort: 9528
|
|
- path: /cms/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-cms
|
|
servicePort: 9528
|
|
- path: /cmsportal/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-cms-portal
|
|
servicePort: 9528
|
|
- path: /detection/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-detection
|
|
servicePort: 9528
|
|
- path: /emergency/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-emergency-rescue
|
|
servicePort: 9528
|
|
- path: /hyper/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-hyperspectral
|
|
servicePort: 9528
|
|
- path: /logistics/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-logistics
|
|
servicePort: 9528
|
|
- path: /mws/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-mws
|
|
servicePort: 9528
|
|
- path: /mws-admin/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-mws-admin
|
|
servicePort: 9528
|
|
- path: /oms/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-oms
|
|
servicePort: 9528
|
|
- path: /open/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-open
|
|
servicePort: 9528
|
|
- path: /security/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform
|
|
servicePort: 9528
|
|
- path: /share/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-share
|
|
servicePort: 9528
|
|
- path: /splice/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-splice
|
|
servicePort: 9528
|
|
- path: /splice-visual/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-splice-visual
|
|
servicePort: 9528
|
|
- path: /traffic/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform
|
|
servicePort: 9528
|
|
- path: /visualization/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-visualization
|
|
servicePort: 9528
|
|
- path: /communication/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform
|
|
servicePort: 9528
|
|
- path: /media/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-media
|
|
servicePort: 9528
|
|
- path: /seniclive/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-seniclive
|
|
servicePort: 9528
|
|
- path: /jiangsuwenlv/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-jiangsuwenlv
|
|
servicePort: 9528
|
|
- path: /qinghaitourism/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-qinghaitourism
|
|
servicePort: 9528
|
|
- path: /securityh5/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform-securityh5
|
|
servicePort: 9528
|
|
- path: /fireRescue/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-platform
|
|
servicePort: 9528
|
|
`
|
|
|
|
const CmiiBackendIngressTemplate = `
|
|
apiVersion: networking.k8s.io/v1beta1
|
|
kind: Ingress
|
|
metadata:
|
|
name: backend-applications-ingress
|
|
namespace: {{ .Namespace }}
|
|
labels:
|
|
type: backend
|
|
octopus.control: all-ingress-config-wdd
|
|
app.kubernetes.io/managed-by: octopus-control
|
|
app.kubernetes.io/version: {{ .TagVersion }}
|
|
annotations:
|
|
kubernetes.io/ingress.class: "nginx"
|
|
nginx.ingress.kubernetes.io/enable-cors: "true"
|
|
spec:
|
|
rules:
|
|
- host: cmii-admin-data.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-admin-data
|
|
servicePort: 8080
|
|
- host: cmii-admin-gateway.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-admin-gateway
|
|
servicePort: 8080
|
|
- host: cmii-admin-user.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-admin-user
|
|
servicePort: 8080
|
|
- host: cmii-open-gateway.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-open-gateway
|
|
servicePort: 8080
|
|
- host: cmii-uav-airspace.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-airspace
|
|
servicePort: 8080
|
|
- host: cmii-uav-brain.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-brain
|
|
servicePort: 8080
|
|
- host: cmii-uav-clusters.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-clusters
|
|
servicePort: 8080
|
|
- host: cmii-uav-cms.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-cms
|
|
servicePort: 8080
|
|
- host: cmii-uav-data-post-process.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-data-post-process
|
|
servicePort: 8080
|
|
- host: cmii-uav-developer.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-developer
|
|
servicePort: 8080
|
|
- host: cmii-uav-device.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-device
|
|
servicePort: 8080
|
|
- host: cmii-uav-gateway.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-gateway
|
|
servicePort: 8080
|
|
- host: cmii-uav-industrial-portfolio.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-industrial-portfolio
|
|
servicePort: 8080
|
|
- host: cmii-uav-kpi-monitor.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-kpi-monitor
|
|
servicePort: 8080
|
|
- host: cmii-uav-live.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-live
|
|
servicePort: 8080
|
|
- host: cmii-uav-cloud-live.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-cloud-live
|
|
servicePort: 8080
|
|
- host: cmii-uav-logger.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-logger
|
|
servicePort: 8080
|
|
- host: cmii-uav-material-warehouse.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-material-warehouse
|
|
servicePort: 8080
|
|
- host: cmii-uav-mission.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-mission
|
|
servicePort: 8080
|
|
- host: cmii-uav-monitor.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-monitor
|
|
servicePort: 8080
|
|
- host: cmii-uav-mqtthandler.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-mqtthandler
|
|
servicePort: 8080
|
|
- host: cmii-uav-notice.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-notice
|
|
servicePort: 8080
|
|
- host: cmii-uav-oauth.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-oauth
|
|
servicePort: 8080
|
|
- host: cmii-uav-process.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-process
|
|
servicePort: 8080
|
|
- host: cmii-uav-security-system.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-security-system
|
|
servicePort: 8080
|
|
- host: cmii-uav-surveillance.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-surveillance
|
|
servicePort: 8080
|
|
- host: cmii-uav-user.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-user
|
|
servicePort: 8080
|
|
- host: cmii-uav-waypoint.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-waypoint
|
|
servicePort: 8080
|
|
- host: cmii-uav-alarm.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-alarm
|
|
servicePort: 8080
|
|
- host: cmii-uav-emergency.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-emergency
|
|
servicePort: 8080
|
|
- host: cmii-uav-integration.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-integration
|
|
servicePort: 8080
|
|
- host: cmii-suav-supervision.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-suav-supervision
|
|
servicePort: 8080
|
|
- host: cmii-uav-gis-server.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-gis-server
|
|
servicePort: 8080
|
|
- host: cmii-uav-grid-datasource.uavcloud-{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-grid-datasource
|
|
servicePort: 8080
|
|
`
|
|
|
|
const CmiiGatewayIngressTemplate = `
|
|
apiVersion: networking.k8s.io/v1beta1
|
|
kind: Ingress
|
|
metadata:
|
|
name: all-gateways-ingress
|
|
namespace: {{ .Namespace }}
|
|
labels:
|
|
type: api-gateway
|
|
octopus.control: all-ingress-config-1.1.0
|
|
app.kubernetes.io/managed-by: octopus-control
|
|
app.kubernetes.io/version: {{ .TagVersion }}
|
|
annotations:
|
|
kubernetes.io/ingress.class: "nginx"
|
|
nginx.ingress.kubernetes.io/enable-cors: "true"
|
|
nginx.ingress.kubernetes.io/rewrite-target: /$1
|
|
nginx.ingress.kubernetes.io/configuration-snippet: |
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "Upgrade";
|
|
spec:
|
|
rules:
|
|
- host: fake-domain.{{ .Namespace }}.io
|
|
http:
|
|
paths:
|
|
- path: /oms/api/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-admin-gateway
|
|
servicePort: 8080
|
|
- path: /open/api/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-open-gateway
|
|
servicePort: 8080
|
|
- path: /api/?(.*)
|
|
pathType: ImplementationSpecific
|
|
backend:
|
|
serviceName: cmii-uav-gateway
|
|
servicePort: 8080
|
|
`
|