初始化项目
This commit is contained in:
394
agent-deploy/d_app/CmiiImageConfig.go
Normal file
394
agent-deploy/d_app/CmiiImageConfig.go
Normal file
@@ -0,0 +1,394 @@
|
||||
package d_app
|
||||
|
||||
var CmiiBackendAppMap = map[string]string{
|
||||
"cmii-admin-data": "5.2.0",
|
||||
"cmii-admin-gateway": "5.2.0",
|
||||
"cmii-admin-user": "5.2.0",
|
||||
"cmii-app-release": "4.2.0-validation",
|
||||
"cmii-open-gateway": "5.2.0",
|
||||
"cmii-suav-supervision": "5.2.0",
|
||||
"cmii-uav-airspace": "5.2.0",
|
||||
"cmii-uav-alarm": "5.2.0",
|
||||
"cmii-uav-autowaypoint": "4.1.6-cm-0828",
|
||||
"cmii-uav-brain": "5.2.0",
|
||||
"cmii-uav-cloud-live": "5.2.0",
|
||||
"cmii-uav-clusters": "5.2.0",
|
||||
"cmii-uav-cms": "5.2.0",
|
||||
"cmii-uav-data-post-process": "5.2.0",
|
||||
"cmii-uav-depotautoreturn": "4.2.0",
|
||||
"cmii-uav-developer": "5.2.0-25858",
|
||||
"cmii-uav-device": "5.2.0",
|
||||
"cmii-uav-emergency": "5.2.0",
|
||||
"cmii-uav-gateway": "5.2.0",
|
||||
"cmii-uav-industrial-portfolio": "5.2.0-25268-10",
|
||||
"cmii-uav-integration": "5.2.0-25447",
|
||||
"cmii-uav-kpi-monitor": "5.2.0",
|
||||
"cmii-uav-logger": "5.2.0",
|
||||
"cmii-uav-material-warehouse": "5.2.0",
|
||||
"cmii-uav-mission": "5.2.0-25840",
|
||||
"cmii-uav-mqtthandler": "5.2.0-25340",
|
||||
"cmii-uav-notice": "5.2.0",
|
||||
"cmii-uav-oauth": "5.2.0",
|
||||
"cmii-uav-process": "5.2.0",
|
||||
"cmii-uav-surveillance": "5.2.0-25854",
|
||||
"cmii-uav-threedsimulation": "5.2.0",
|
||||
"cmii-uav-tower": "5.2.0",
|
||||
"cmii-uav-user": "5.2.0",
|
||||
"cmii-uav-waypoint": "5.2.0",
|
||||
"cmii-uav-multilink": "5.2.0",
|
||||
"cmii-uav-bridge": "5.2.0",
|
||||
"cmii-uas-lifecycle": "5.2.0",
|
||||
"cmii-uas-gateway": "5.2.0",
|
||||
"cmii-uav-gis-server": "5.4.0",
|
||||
"cmii-uav-grid-datasource": "5.4.0",
|
||||
"cmii-uav-grid-engine": "5.4.0",
|
||||
"cmii-uav-grid-manage": "5.4.0",
|
||||
"cmii-uav-sense-adapter": "5.4.0",
|
||||
"cmii-uav-sync": "5.4.0",
|
||||
"cmii-uav-iot-dispatcher": "5.7.0",
|
||||
"cmii-uavms-security-center": "5.7.0",
|
||||
"cmii-uav-fwdd": "5.7.0",
|
||||
"cmii-uav-advanced5g": "5.7.0",
|
||||
"cmii-sky-converge": "5.7.0",
|
||||
"cmii-uav-sec-awareness": "5.7.0",
|
||||
"cmii-uav-security-trace": "5.7.0",
|
||||
"cmii-uavms-pyfusion": "5.7.0",
|
||||
"cmii-uav-iot-manager": "5.7.0",
|
||||
"cmii-uas-datahub": "5.7.0",
|
||||
"cmii-uav-watchdog": "5.7.0",
|
||||
}
|
||||
|
||||
var CmiiFrontendAppMap = map[string]string{
|
||||
"cmii-suav-platform-supervision": "5.2.0",
|
||||
"cmii-suav-platform-supervisionh5": "5.2.0",
|
||||
"cmii-uav-platform": "5.2.0-011004",
|
||||
"cmii-uav-platform-ai-brain": "5.2.0",
|
||||
"cmii-uav-platform-armypeople": "5.2.0-24538",
|
||||
"cmii-uav-platform-base": "5.2.0",
|
||||
"cmii-uav-platform-cms-portal": "5.2.0",
|
||||
"cmii-uav-platform-detection": "5.2.0",
|
||||
"cmii-uav-platform-emergency-rescue": "5.2.0",
|
||||
"cmii-uav-platform-hljtt": "5.2.0",
|
||||
"cmii-uav-platform-jiangsuwenlv": "4.1.3-jiangsu-0427",
|
||||
"cmii-uav-platform-logistics": "5.2.0",
|
||||
"cmii-uav-platform-media": "5.2.0",
|
||||
"cmii-uav-platform-multiterminal": "5.2.0",
|
||||
"cmii-uav-platform-mws": "5.2.0",
|
||||
"cmii-uav-platform-oms": "5.2.0",
|
||||
"cmii-uav-platform-open": "5.2.0",
|
||||
"cmii-uav-platform-qingdao": "4.1.6-24238-qingdao",
|
||||
"cmii-uav-platform-qinghaitourism": "4.1.0-21377-0508",
|
||||
"cmii-uav-platform-security": "4.1.6",
|
||||
"cmii-uav-platform-securityh5": "5.2.0",
|
||||
"cmii-uav-platform-seniclive": "5.2.0",
|
||||
"cmii-uav-platform-share": "5.2.0",
|
||||
"cmii-uav-platform-splice": "5.2.0",
|
||||
"cmii-uav-platform-threedsimulation": "5.2.0-21392",
|
||||
"cmii-uav-platform-visualization": "5.2.0",
|
||||
"cmii-uav-platform-uasms": "5.2.0",
|
||||
"cmii-uav-platform-uas": "5.2.0",
|
||||
"cmii-uav-platform-pilot2-to-cloud": "5.2.0",
|
||||
"cmii-uavms-platform-security-center": "5.2.0",
|
||||
"cmii-uav-platform-dispatchh5": "5.2.0",
|
||||
"cmii-uavms-platform-manager": "5.2.0",
|
||||
"cmii-uav-platform-awareness": "5.2.0",
|
||||
"cmii-uav-platform-flight-control": "5.2.0",
|
||||
}
|
||||
|
||||
var IgnoreCmiiBackendAppName = map[string]string{
|
||||
"cmii-uav-grid-datasource": "0",
|
||||
"cmii-uav-grid-manage": "0",
|
||||
"cmii-uav-grid-engine": "0",
|
||||
"cmii-uav-kpi-monitor": "0",
|
||||
"cmii-uav-gis-server": "0",
|
||||
"cmii-app-release": "0",
|
||||
"cmii-uav-autowaypoint": "0",
|
||||
"cmii-uav-integration": "0",
|
||||
"cmii-uav-developer": "0",
|
||||
"cmii-open-gateway": "0",
|
||||
"cmii-uav-brain": "0",
|
||||
"cmii-uav-data-post-process": "0",
|
||||
"cmii-uav-multilink": "0",
|
||||
"cmii-uav-alarm": "0",
|
||||
"cmii-uav-tower": "0",
|
||||
"cmii-uav-clusters": "0",
|
||||
"cmii-uav-depotautoreturn": "0",
|
||||
"cmii-uas-lifecycle": "0",
|
||||
"cmii-uas-gateway": "0",
|
||||
"cmii-uav-fwdd": "0",
|
||||
"cmii-uav-sync": "0",
|
||||
"cmii-uavms-security-center": "0",
|
||||
"cmii-uav-iot-manager": "0",
|
||||
"cmii-uas-datahub": "0",
|
||||
}
|
||||
|
||||
var IgnoreCmiiFrontendAppName = map[string]string{
|
||||
"cmii-uav-platform-hljtt": "0",
|
||||
"cmii-uav-platform-jiangsuwenlv": "0",
|
||||
"cmii-uav-platform-qinghaitourism": "0",
|
||||
"cmii-uav-platform-qingdao": "0",
|
||||
"cmii-uav-platform-uasms": "0",
|
||||
"cmii-uav-platform-uas": "0",
|
||||
"cmii-uav-platform-seniclive": "0",
|
||||
}
|
||||
|
||||
var CmiiMiddlewareNameMap = map[string]string{
|
||||
"helm-nacos": "single",
|
||||
"helm-emqxs": "single",
|
||||
"helm-mysql": "single",
|
||||
"helm-redis": "replication",
|
||||
"helm-rabbitmq": "single",
|
||||
}
|
||||
|
||||
var CmiiSrsAppMap = map[string]string{
|
||||
"helm-live-op-v2": "deployment",
|
||||
"helm-live-rtsp-op": "4.1.6",
|
||||
"helm-live-srs-rtc": "statefulset",
|
||||
}
|
||||
|
||||
var CmiiGISAppMap = map[string]string{
|
||||
"cmii-uav-gis-server": "5.4.0",
|
||||
"cmii-uav-grid-datasource": "5.4.0",
|
||||
"cmii-uav-grid-engine": "5.4.0",
|
||||
"cmii-uav-grid-manage": "5.4.0",
|
||||
}
|
||||
|
||||
var MiddlewareAmd64 = []string{
|
||||
"bitnami/redis:6.2.6-debian-10-r0",
|
||||
"bitnami/redis:6.2.14-debian-11-r1",
|
||||
"bitnami/mysql:8.0.35-debian-11-r1",
|
||||
"bitnami/mysql:8.1.0-debian-11-r42",
|
||||
"simonrupf/chronyd:0.4.3",
|
||||
"bitnami/bitnami-shell:10-debian-10-r140",
|
||||
"bitnami/bitnami-shell:11-debian-11-r136",
|
||||
"bitnami/rabbitmq:3.9.12-debian-10-r3",
|
||||
"bitnami/rabbitmq:3.11.26-debian-11-r2",
|
||||
"ossrs/srs:v4.0.136",
|
||||
"ossrs/srs:v5.0.195",
|
||||
"ossrs/srs:v4.0-r3",
|
||||
"emqx/emqx:4.4.19",
|
||||
"emqx/emqx:5.5.1",
|
||||
"nacos/nacos-server:v2.1.2",
|
||||
"nacos/nacos-server:v2.1.2-slim",
|
||||
"library/mongo:5.0",
|
||||
"library/rabbitmq:3.9-management",
|
||||
"bitnami/minio:2022.5.4",
|
||||
"bitnami/minio:2023.5.4",
|
||||
"minio/minio:RELEASE.2023-06-02T23-17-26Z",
|
||||
"kubernetesui/dashboard:v2.0.1",
|
||||
"kubernetesui/metrics-scraper:v1.0.4",
|
||||
"library/nginx:1.21.3",
|
||||
"library/redis:6.0.20-alpine",
|
||||
"dyrnq/nfs-subdir-external-provisioner:v4.0.2",
|
||||
"jerrychina2020/rke-tools:v0.175-linux",
|
||||
"jerrychina2020/rke-tools:v0.175",
|
||||
"library/busybox:latest",
|
||||
"harbor.cdcyy.com.cn/cmii/doris.be-ubuntu:2.1.6",
|
||||
"harbor.cdcyy.com.cn/cmii/doris.fe-ubuntu:2.1.6",
|
||||
"harbor.cdcyy.com.cn/cmii/doris.k8s-operator:1.3.1",
|
||||
"harbor.cdcyy.com.cn/cmii/alpine:latest",
|
||||
"harbor.cdcyy.com.cn/cmii/nginx:1.27.0",
|
||||
}
|
||||
|
||||
var Rancher1204Amd64 = []string{
|
||||
"rancher/backup-restore-operator:v1.0.3",
|
||||
"rancher/calico-cni:v3.17.2",
|
||||
"rancher/calico-ctl:v3.17.2",
|
||||
"rancher/calico-kube-controllers:v3.17.2",
|
||||
"rancher/calico-node:v3.17.2",
|
||||
"rancher/calico-pod2daemon-flexvol:v3.17.2",
|
||||
"rancher/cis-operator:v1.0.3",
|
||||
"rancher/cluster-proportional-autoscaler:1.7.1",
|
||||
"rancher/coredns-coredns:1.8.0",
|
||||
"rancher/coreos-etcd:v3.4.14-rancher1",
|
||||
"rancher/coreos-kube-state-metrics:v1.9.7",
|
||||
"rancher/coreos-prometheus-config-reloader:v0.39.0",
|
||||
"rancher/coreos-prometheus-operator:v0.39.0",
|
||||
"rancher/externalip-webhook:v0.1.6",
|
||||
"rancher/flannel-cni:v0.3.0-rancher6",
|
||||
"rancher/coreos-flannel:v0.13.0-rancher1",
|
||||
"rancher/fleet-agent:v0.3.4",
|
||||
"rancher/fleet:v0.3.4",
|
||||
"rancher/fluentd:v0.1.24",
|
||||
"rancher/grafana-grafana:7.1.5",
|
||||
"rancher/hyperkube:v1.20.4-rancher1",
|
||||
"rancher/jimmidyson-configmap-reload:v0.3.0",
|
||||
"rancher/k8s-dns-dnsmasq-nanny:1.15.2",
|
||||
"rancher/k8s-dns-kube-dns:1.15.2",
|
||||
"rancher/k8s-dns-node-cache:1.15.13",
|
||||
"rancher/k8s-dns-sidecar:1.15.2",
|
||||
"rancher/klipper-lb:v0.1.2",
|
||||
"rancher/kube-api-auth:v0.1.4",
|
||||
"rancher/kubectl:v1.20.4",
|
||||
"rancher/kubernetes-external-dns:v0.7.3",
|
||||
"rancher/cluster-proportional-autoscaler:1.8.1",
|
||||
"rancher/library-busybox:1.31.1",
|
||||
"rancher/library-busybox:1.32.1",
|
||||
"rancher/library-nginx:1.19.2-alpine",
|
||||
"rancher/library-traefik:1.7.19",
|
||||
"rancher/local-path-provisioner:v0.0.11",
|
||||
"rancher/local-path-provisioner:v0.0.14",
|
||||
"rancher/local-path-provisioner:v0.0.19",
|
||||
"rancher/log-aggregator:v0.1.7",
|
||||
"rancher/istio-kubectl:1.5.10",
|
||||
"rancher/metrics-server:v0.4.1",
|
||||
"rancher/configmap-reload:v0.3.0-rancher4",
|
||||
"rancher/nginx-ingress-controller-defaultbackend:1.5-rancher1",
|
||||
"rancher/nginx-ingress-controller:nginx-0.43.0-rancher1",
|
||||
"rancher/opa-gatekeeper:v3.1.0-beta.7",
|
||||
"rancher/openzipkin-zipkin:2.14.2",
|
||||
"rancher/pause:3.2",
|
||||
"rancher/plugins-docker:18.09",
|
||||
"rancher/prom-alertmanager:v0.21.0",
|
||||
"rancher/prom-node-exporter:v1.0.1",
|
||||
"rancher/prom-prometheus:v2.18.2",
|
||||
"rancher/prometheus-auth:v0.2.1",
|
||||
"rancher/rancher-agent:v2.5.7",
|
||||
"rancher/rancher-webhook:v0.1.0-beta9",
|
||||
"rancher/rancher:v2.5.7",
|
||||
"rancher/rke-tools:v0.1.72",
|
||||
"rancher/security-scan:v0.1.14",
|
||||
"rancher/security-scan:v0.2.2",
|
||||
"rancher/shell:v0.1.6",
|
||||
"rancher/sonobuoy-sonobuoy:v0.16.3",
|
||||
"rancher/system-upgrade-controller:v0.6.2",
|
||||
}
|
||||
|
||||
var CmiiSRSImageList = []string{
|
||||
"harbor.cdcyy.com.cn/cmii/cmii-live-operator:5.2.0",
|
||||
"harbor.cdcyy.com.cn/cmii/cmii-srs-oss-adaptor:2023-SA",
|
||||
}
|
||||
|
||||
var Cmii530DemoImageList = []string{
|
||||
"cmii-admin-data:5.2.0",
|
||||
"cmii-admin-gateway:5.2.0",
|
||||
"cmii-admin-user:5.2.0",
|
||||
"cmii-app-release:4.2.0-validation",
|
||||
"cmii-open-gateway:5.2.0",
|
||||
"cmii-suav-supervision:5.2.0",
|
||||
"cmii-uav-airspace:5.2.0",
|
||||
"cmii-uav-alarm:5.2.0",
|
||||
"cmii-uav-autowaypoint:4.1.6-cm-0828",
|
||||
"cmii-uav-brain:5.2.0",
|
||||
"cmii-uav-cloud-live:5.2.0",
|
||||
"cmii-uav-clusters:5.2.0",
|
||||
"cmii-uav-cms:5.2.0",
|
||||
"cmii-uav-data-post-process:5.2.0",
|
||||
"cmii-uav-depotautoreturn:4.2.0",
|
||||
"cmii-uav-developer:5.2.0-25858",
|
||||
"cmii-uav-device:5.2.0",
|
||||
"cmii-uav-emergency:5.2.0",
|
||||
"cmii-uav-gateway:5.2.0",
|
||||
"cmii-uav-gis-server:5.2.0",
|
||||
"cmii-uav-grid-datasource:5.2.0-24810",
|
||||
"cmii-uav-grid-engine:5.1.0",
|
||||
"cmii-uav-grid-manage:5.1.0",
|
||||
"cmii-uav-industrial-portfolio:5.2.0-25268-12",
|
||||
"cmii-uav-integration:5.2.0-25447",
|
||||
"cmii-uav-kpi-monitor:5.2.0",
|
||||
"cmii-uav-logger:5.2.0",
|
||||
"cmii-uav-material-warehouse:5.2.0",
|
||||
"cmii-uav-mission:5.2.0-25840",
|
||||
"cmii-uav-mqtthandler:5.2.0-25340-1",
|
||||
"cmii-uav-notice:5.2.0",
|
||||
"cmii-uav-oauth:5.2.0",
|
||||
"cmii-uav-process:5.2.0",
|
||||
"cmii-uav-surveillance:5.2.0-21794",
|
||||
"cmii-uav-threedsimulation:5.2.0",
|
||||
"cmii-uav-tower:5.3.0",
|
||||
"cmii-uav-user:5.2.0",
|
||||
"cmii-uav-waypoint:5.2.0-011102",
|
||||
"cmii-suav-platform-supervision:5.2.0",
|
||||
"cmii-suav-platform-supervisionh5:5.2.0",
|
||||
"cmii-uav-platform:5.2.0",
|
||||
"cmii-uav-platform-ai-brain:5.2.0",
|
||||
"cmii-uav-platform-armypeople:5.2.0-24538",
|
||||
"cmii-uav-platform-base:5.2.0",
|
||||
"cmii-uav-platform-cms-portal:5.2.0",
|
||||
"cmii-uav-platform-detection:5.2.0",
|
||||
"cmii-uav-platform-emergency-rescue:5.2.0",
|
||||
"cmii-uav-platform-hljtt:5.2.0",
|
||||
"cmii-uav-platform-jiangsuwenlv:4.1.3-jiangsu-0427",
|
||||
"cmii-uav-platform-logistics:5.2.0",
|
||||
"cmii-uav-platform-media:5.2.0",
|
||||
"cmii-uav-platform-multiterminal:5.2.0",
|
||||
"cmii-uav-platform-mws:5.2.0",
|
||||
"cmii-uav-platform-oms:5.2.0",
|
||||
"cmii-uav-platform-open:5.2.0",
|
||||
"cmii-uav-platform-qingdao:4.1.6-24238-qingdao",
|
||||
"cmii-uav-platform-qinghaitourism:4.1.0-21377-0508",
|
||||
"cmii-uav-platform-security:4.1.6",
|
||||
"cmii-uav-platform-securityh5:5.2.0",
|
||||
"cmii-uav-platform-seniclive:5.2.0",
|
||||
"cmii-uav-platform-share:5.2.0",
|
||||
"cmii-uav-platform-splice:5.2.0",
|
||||
"cmii-uav-platform-threedsimulation:5.2.0-21392",
|
||||
"cmii-uav-platform-visualization:5.2.0",
|
||||
}
|
||||
|
||||
var Cmii520DemoImageList = []string{
|
||||
"cmii-admin-data:5.2.0",
|
||||
"cmii-admin-gateway:5.2.0",
|
||||
"cmii-admin-user:5.2.0",
|
||||
"cmii-app-release:4.2.0-validation",
|
||||
"cmii-open-gateway:5.2.0",
|
||||
"cmii-suav-supervision:5.2.0",
|
||||
"cmii-uav-airspace:5.2.0",
|
||||
"cmii-uav-alarm:5.2.0",
|
||||
"cmii-uav-autowaypoint:4.1.6-cm-0828",
|
||||
"cmii-uav-brain:5.2.0",
|
||||
"cmii-uav-cloud-live:5.2.0",
|
||||
"cmii-uav-clusters:5.2.0",
|
||||
"cmii-uav-cms:5.2.0",
|
||||
"cmii-uav-data-post-process:5.2.0",
|
||||
"cmii-uav-depotautoreturn:4.2.0",
|
||||
"cmii-uav-developer:5.2.0-25858",
|
||||
"cmii-uav-device:5.2.0",
|
||||
"cmii-uav-emergency:5.2.0",
|
||||
"cmii-uav-gateway:5.2.0",
|
||||
"cmii-uav-gis-server:5.2.0",
|
||||
"cmii-uav-grid-datasource:5.2.0-24810",
|
||||
"cmii-uav-grid-engine:5.1.0",
|
||||
"cmii-uav-grid-manage:5.1.0",
|
||||
"cmii-uav-industrial-portfolio:5.2.0-25268-12",
|
||||
"cmii-uav-integration:5.2.0-25447",
|
||||
"cmii-uav-kpi-monitor:5.2.0",
|
||||
"cmii-uav-logger:5.2.0",
|
||||
"cmii-uav-material-warehouse:5.2.0",
|
||||
"cmii-uav-mission:5.2.0-25840",
|
||||
"cmii-uav-mqtthandler:5.2.0-25340-1",
|
||||
"cmii-uav-notice:5.2.0",
|
||||
"cmii-uav-oauth:5.2.0",
|
||||
"cmii-uav-process:5.2.0",
|
||||
"cmii-uav-surveillance:5.2.0-21794",
|
||||
"cmii-uav-threedsimulation:5.2.0",
|
||||
"cmii-uav-tower:5.3.0",
|
||||
"cmii-uav-user:5.2.0",
|
||||
"cmii-uav-waypoint:5.2.0-011102",
|
||||
"cmii-suav-platform-supervision:5.2.0",
|
||||
"cmii-suav-platform-supervisionh5:5.2.0",
|
||||
"cmii-uav-platform:5.2.0",
|
||||
"cmii-uav-platform-ai-brain:5.2.0",
|
||||
"cmii-uav-platform-armypeople:5.2.0-24538",
|
||||
"cmii-uav-platform-base:5.2.0",
|
||||
"cmii-uav-platform-cms-portal:5.2.0",
|
||||
"cmii-uav-platform-detection:5.2.0",
|
||||
"cmii-uav-platform-emergency-rescue:5.2.0",
|
||||
"cmii-uav-platform-hljtt:5.2.0",
|
||||
"cmii-uav-platform-jiangsuwenlv:4.1.3-jiangsu-0427",
|
||||
"cmii-uav-platform-logistics:5.2.0",
|
||||
"cmii-uav-platform-media:5.2.0",
|
||||
"cmii-uav-platform-multiterminal:5.2.0",
|
||||
"cmii-uav-platform-mws:5.2.0",
|
||||
"cmii-uav-platform-oms:5.2.0",
|
||||
"cmii-uav-platform-open:5.2.0",
|
||||
"cmii-uav-platform-qingdao:4.1.6-24238-qingdao",
|
||||
"cmii-uav-platform-qinghaitourism:4.1.0-21377-0508",
|
||||
"cmii-uav-platform-security:4.1.6",
|
||||
"cmii-uav-platform-securityh5:5.2.0",
|
||||
"cmii-uav-platform-seniclive:5.2.0",
|
||||
"cmii-uav-platform-share:5.2.0",
|
||||
"cmii-uav-platform-splice:5.2.0",
|
||||
"cmii-uav-platform-threedsimulation:5.2.0-21392",
|
||||
"cmii-uav-platform-visualization:5.2.0",
|
||||
}
|
||||
189
agent-deploy/d_app/DeployCmiiApp.go
Normal file
189
agent-deploy/d_app/DeployCmiiApp.go
Normal file
@@ -0,0 +1,189 @@
|
||||
package d_app
|
||||
|
||||
import (
|
||||
"github.com/go-playground/validator/v10"
|
||||
"os"
|
||||
"wdd.io/agent-common/logger"
|
||||
"wdd.io/agent-common/utils"
|
||||
"wdd.io/agent-deploy/z_dep"
|
||||
)
|
||||
|
||||
var (
|
||||
DefaultCmiiBackendConfig = &CmiiBackendConfig{}
|
||||
DefaultCmiiFrontendConfig = &CmiiFrontendConfig{}
|
||||
DefaultIngressConfig = &IngressConfig{
|
||||
FrontendShortNameMaps: FrontendShortNameMaps,
|
||||
BackendImageVersionMap: CmiiBackendAppMap,
|
||||
}
|
||||
|
||||
log = logger.Log
|
||||
)
|
||||
|
||||
type CmiiBackendConfig struct {
|
||||
z_dep.CommonEnvironmentConfig
|
||||
AppName string `json:"app_name,omitempty" validate:"required"`
|
||||
ImageTag string `json:"image_tag,omitempty" validate:"required"`
|
||||
Replicas string `json:"replicas,omitempty" validate:"required" default:"1"`
|
||||
NodePort string `json:"node_port,omitempty"`
|
||||
NeedPvcCache bool `json:"need_pvc_cache,omitempty"`
|
||||
CustomJvmOpt string `json:"custom_jvm_opt,omitempty"`
|
||||
}
|
||||
|
||||
type CmiiFrontendConfig struct {
|
||||
z_dep.CommonEnvironmentConfig `json:"z___dep_._common_environment_config"`
|
||||
AppName string `json:"app_name,omitempty" validate:"required"`
|
||||
ImageTag string `json:"image_tag,omitempty" validate:"required"`
|
||||
Replicas string `json:"replicas,omitempty" validate:"required" default:"1"`
|
||||
ShortName string `json:"short_name,omitempty" validate:"required"`
|
||||
ClientId string
|
||||
}
|
||||
|
||||
type CmiiSrsConfig struct {
|
||||
z_dep.CommonEnvironmentConfig
|
||||
RtmpPort string
|
||||
WebRTCPort string
|
||||
SrtPort string
|
||||
WebApiPort string
|
||||
MySQLK8sAdminPassword string
|
||||
}
|
||||
|
||||
type IngressConfig struct {
|
||||
z_dep.CommonEnvironmentConfig
|
||||
FrontendShortNameMaps map[string]string
|
||||
BackendImageVersionMap map[string]string `json:"backend_image_version_map,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
func (backend *CmiiBackendConfig) BackendDeploy(common *z_dep.CommonEnvironmentConfig) bool {
|
||||
|
||||
// copy
|
||||
utils.CopySameFields(common, backend)
|
||||
|
||||
validate := validator.New()
|
||||
err := validate.Struct(backend)
|
||||
if err != nil {
|
||||
log.ErrorF("backend config validate error: %v\n", err)
|
||||
return false
|
||||
}
|
||||
|
||||
if !z_dep.ParseEnvToApplyFile(backend, CmiiBackendDeploymentTemplate, z_dep.BackendApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
if !z_dep.ParseEnvToApplyFile(backend, CmiiBackendServiceTemplate, z_dep.BackendApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
|
||||
// pvc
|
||||
if backend.NeedPvcCache {
|
||||
if !z_dep.ParseEnvToApplyFile(backend, CmiiBackendPVCTemplate, z_dep.BackendApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (frontend *CmiiFrontendConfig) FrontendDeploy(common *z_dep.CommonEnvironmentConfig) bool {
|
||||
|
||||
// copy
|
||||
utils.CopySameFields(common, frontend)
|
||||
|
||||
validate := validator.New()
|
||||
err := validate.Struct(frontend)
|
||||
if err != nil {
|
||||
log.ErrorF("backend config validate error: %v\n", err)
|
||||
return false
|
||||
}
|
||||
|
||||
if !z_dep.ParseEnvToApplyFile(frontend, CmiiFrontendDeploymentTemplate, z_dep.FrontendApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
if !z_dep.ParseEnvToApplyFile(frontend, CmiiFrontendServiceTemplate, z_dep.FrontendApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (frontend *CmiiFrontendConfig) ConfigMapDeploy(commonEnv *z_dep.CommonEnvironmentConfig) bool {
|
||||
|
||||
// copy
|
||||
utils.CopySameFields(commonEnv, frontend)
|
||||
|
||||
// manual validate
|
||||
if frontend.ShortName == "" || frontend.ClientId == "" {
|
||||
log.ErrorF("short name or client id is empty !")
|
||||
return false
|
||||
}
|
||||
|
||||
return z_dep.ParseEnvToApplyFile(frontend, CmiiFrontendConfigMapTemplate, z_dep.ConfigMapApplyFilePath)
|
||||
}
|
||||
|
||||
func (ingress *IngressConfig) IngressDeploy(commonEnv *z_dep.CommonEnvironmentConfig) bool {
|
||||
// copy
|
||||
utils.CopySameFields(commonEnv, ingress)
|
||||
|
||||
// manual validate
|
||||
if ingress.FrontendShortNameMaps == nil || len(ingress.FrontendShortNameMaps) == 0 {
|
||||
log.Error("frontend short name is empty !")
|
||||
return false
|
||||
}
|
||||
|
||||
if ingress.BackendImageVersionMap == nil || len(ingress.BackendImageVersionMap) == 0 {
|
||||
log.Error("backend image version map is empty !")
|
||||
return false
|
||||
}
|
||||
|
||||
if !z_dep.ParseEnvToApplyFile(ingress, CmiiFrontendIngressTemplate, z_dep.IngresApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
|
||||
if !z_dep.ParseEnvToApplyFile(ingress, CmiiBackendIngressTemplate, z_dep.IngresApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
|
||||
if !z_dep.ParseEnvToApplyFile(ingress, CmiiGatewayIngressTemplate, z_dep.IngresApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (srsConfig *CmiiSrsConfig) SRSDeploy(commonEnv *z_dep.CommonEnvironmentConfig) bool {
|
||||
// copy
|
||||
utils.CopySameFields(commonEnv, srsConfig)
|
||||
|
||||
if srsConfig.MinioInnerIP == "" {
|
||||
log.Error("minio inner ip is nil !")
|
||||
return false
|
||||
}
|
||||
|
||||
if !z_dep.ParseEnvToApplyFile(srsConfig, CmiiSrsTemplate, z_dep.SRSApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func IngressDeploy(commonEnv *z_dep.CommonEnvironmentConfig) bool {
|
||||
if !commonEnv.ParseCommonEnvToApplyFile(CmiiFrontendIngressTemplate, z_dep.IngresApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
|
||||
if !commonEnv.ParseCommonEnvToApplyFile(CmiiBackendIngressTemplate, z_dep.IngresApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
|
||||
if !commonEnv.ParseCommonEnvToApplyFile(CmiiGatewayIngressTemplate, z_dep.IngresApplyFilePath) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func SRSDeploy(commonEnv *z_dep.CommonEnvironmentConfig) bool {
|
||||
os.Remove(z_dep.SRSApplyFilePath)
|
||||
return commonEnv.ParseCommonEnvToApplyFile(CmiiSrsTemplate, z_dep.SRSApplyFilePath)
|
||||
}
|
||||
|
||||
func FrontendDefaultNginxDeploy(commonEnv *z_dep.CommonEnvironmentConfig) bool {
|
||||
return commonEnv.ParseCommonEnvToApplyFile(CmiiFrontendDefaultNginxConfTemplate, z_dep.FrontendApplyFilePath)
|
||||
}
|
||||
18
agent-deploy/d_app/DeployCmiiApp_test.go
Normal file
18
agent-deploy/d_app/DeployCmiiApp_test.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package d_app
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCmiiBackendDeploymentConfig_ParseToApplyConf(t *testing.T) {
|
||||
|
||||
deploymentConfig := CmiiBackendConfig{
|
||||
Namespace: "uavcloud-dev",
|
||||
AppName: "cmii-uav-gateway",
|
||||
ImageTag: "5.2.0-123",
|
||||
Replicas: "2",
|
||||
NodePort: "31213",
|
||||
NeedPvcCache: true,
|
||||
}
|
||||
|
||||
}
|
||||
97
agent-deploy/d_app/FrontendConfigMap.go
Normal file
97
agent-deploy/d_app/FrontendConfigMap.go
Normal file
@@ -0,0 +1,97 @@
|
||||
package d_app
|
||||
|
||||
var FrontendShortNameMaps = map[string]string{
|
||||
"cmii-suav-platform-supervision": "supervision",
|
||||
"cmii-suav-platform-supervisionh5": "supervisionh5",
|
||||
"cmii-uav-platform": "pangu",
|
||||
"cmii-uav-platform-ai-brain": "ai-brain",
|
||||
"cmii-uav-platform-armypeople": "armypeople",
|
||||
"cmii-uav-platform-base": "base",
|
||||
"cmii-uav-platform-cms-portal": "cmsportal",
|
||||
"cmii-uav-platform-detection": "detection",
|
||||
"cmii-uav-platform-emergency-rescue": "emergency",
|
||||
"cmii-uav-platform-logistics": "logistics",
|
||||
"cmii-uav-platform-media": "media",
|
||||
"cmii-uav-platform-multiterminal": "multiterminal",
|
||||
"cmii-uav-platform-mws": "mws",
|
||||
"cmii-uav-platform-oms": "oms",
|
||||
"cmii-uav-platform-open": "open",
|
||||
"cmii-uav-platform-security": "security",
|
||||
"cmii-uav-platform-securityh5": "securityh5",
|
||||
"cmii-uav-platform-seniclive": "seniclive",
|
||||
"cmii-uav-platform-share": "share",
|
||||
"cmii-uav-platform-splice": "splice",
|
||||
"cmii-uav-platform-traffic": "traffic",
|
||||
"cmii-uav-platform-threedsimulation": "threedsimulation",
|
||||
"cmii-uav-platform-jiangsuwenlv": "jiangsuwenlv",
|
||||
"cmii-uav-platform-qinghaitourism": "qinghaitourism",
|
||||
"cmii-uav-platform-qingdao": "qingdao",
|
||||
"cmii-uav-platform-hljtt": "hljtt",
|
||||
"cmii-uav-platform-visualization": "visualization",
|
||||
"cmii-uav-platform-uasms": "uasms",
|
||||
"cmii-uav-platform-uas": "uas",
|
||||
"cmii-uav-platform-dispatchh5": "dispatchh5",
|
||||
"cmii-uav-platform-pilot2-to-cloud": "pilot2cloud",
|
||||
"cmii-uav-platform-hyperspectral": "hyper",
|
||||
"cmii-uav-platform-scanner": "scanner",
|
||||
"cmii-uav-platform-blockchain": "blockchain",
|
||||
"cmii-uav-platform-smsecret": "smsecret",
|
||||
"cmii-uav-platform-classification": "classification",
|
||||
"cmii-uav-platform-smauth": "smauth",
|
||||
"cmii-uavms-platform-security-center": "secenter",
|
||||
"cmii-uav-platform-eventsh5": "eventsh5",
|
||||
"cmii-uav-platform-mianyangbackend": "mianyangbackend",
|
||||
"cmii-uav-platform-dikongzhixingh5": "dikongzhixingh5",
|
||||
"cmii-uavms-platform-manager": "uavmsmanager",
|
||||
"cmii-uav-platform-renyike": "renyike",
|
||||
"cmii-uav-platform-awareness": "awareness",
|
||||
"cmii-uav-platform-flight-control": "flight-control",
|
||||
}
|
||||
|
||||
var FrontendClientIdMaps = map[string]string{
|
||||
"cmii-suav-platform-supervision": "APP_qqSu82THfexI8PLM",
|
||||
"cmii-suav-platform-supervisionh5": "APP_qqSu82THfexI8PLM",
|
||||
"cmii-uav-platform": "empty",
|
||||
"cmii-uav-platform-ai-brain": "APP_rafnuCAmBESIVYMH",
|
||||
"cmii-uav-platform-armypeople": "APP_UIegse6Lfou9pO1U",
|
||||
"cmii-uav-platform-base": "APP_9LY41OaKSqk2btY0",
|
||||
"cmii-uav-platform-cms-portal": "empty",
|
||||
"cmii-uav-platform-detection": "APP_FDHW2VLVDWPnnOCy",
|
||||
"cmii-uav-platform-emergency-rescue": "APP_aGsTAY1uMZrpKdfk",
|
||||
"cmii-uav-platform-logistics": "APP_PvdfRRRBPL8xbIwl",
|
||||
"cmii-uav-platform-media": "APP_4AU8lbifESQO4FD6",
|
||||
"cmii-uav-platform-multiterminal": "APP_PvdfRRRBPL8xbIwl",
|
||||
"cmii-uav-platform-mws": "APP_uKniXPELlRERBBwK",
|
||||
"cmii-uav-platform-oms": "empty",
|
||||
"cmii-uav-platform-open": "empty",
|
||||
"cmii-uav-platform-qingdao": "empty",
|
||||
"cmii-uav-platform-qinghaitourism": "empty",
|
||||
"cmii-uav-platform-security": "APP_JUSEMc7afyWXxvE7",
|
||||
"cmii-uav-platform-securityh5": "APP_N3ImO0Ubfu9peRHD",
|
||||
"cmii-uav-platform-seniclive": "empty",
|
||||
"cmii-uav-platform-share": "APP_4lVSVI0ZGxTssir8",
|
||||
"cmii-uav-platform-splice": "APP_zE0M3sTRXrCIJS8Y",
|
||||
"cmii-uav-platform-threedsimulation": "empty",
|
||||
"cmii-uav-platform-visualization": "empty",
|
||||
"cmii-uav-platform-traffic": "APP_Jc8i2wOQ1t73QEJS",
|
||||
"cmii-uav-platform-jiangsuwenlv": "empty",
|
||||
"cmii-uav-platform-hljtt": "empty",
|
||||
"cmii-uav-platform-uasms": "empty",
|
||||
"cmii-uav-platform-uas": "empty",
|
||||
"cmii-uav-platform-dispatchh5": "empty",
|
||||
"cmii-uav-platform-pilot2-to-cloud": "empty",
|
||||
"cmii-uav-platform-hyperspectral": "empty",
|
||||
"cmii-uav-platform-scanner": "empty",
|
||||
"cmii-uav-platform-blockchain": "empty",
|
||||
"cmii-uav-platform-smsecret": "empty",
|
||||
"cmii-uav-platform-classification": "empty",
|
||||
"cmii-uav-platform-smauth": "empty",
|
||||
"cmii-uavms-platform-security-center": "empty",
|
||||
"cmii-uav-platform-eventsh5": "empty",
|
||||
"cmii-uav-platform-mianyangbackend": "empty",
|
||||
"cmii-uav-platform-dikongzhixingh5": "empty",
|
||||
"cmii-uavms-platform-manager": "empty",
|
||||
"cmii-uav-platform-renyike": "empty",
|
||||
"cmii-uav-platform-awareness": "empty",
|
||||
"cmii-uav-platform-flight-control": "empty",
|
||||
}
|
||||
228
agent-deploy/d_app/TemplateCmiiBackend.go
Normal file
228
agent-deploy/d_app/TemplateCmiiBackend.go
Normal file
@@ -0,0 +1,228 @@
|
||||
package d_app
|
||||
|
||||
const CmiiBackendDeploymentTemplate = `
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .AppName }}
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
cmii.type: backend
|
||||
cmii.app: {{ .AppName }}
|
||||
octopus/control: backend-app-1.0.0
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
app.kubernetes.io/app-version: {{ .TagVersion }}
|
||||
spec:
|
||||
replicas: {{ .Replicas }}
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxUnavailable: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
cmii.type: backend
|
||||
cmii.app: {{ .AppName }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
cmii.type: backend
|
||||
cmii.app: {{ .AppName }}
|
||||
spec:
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: uavcloud.env
|
||||
operator: In
|
||||
values:
|
||||
{{- if .TenantEnv }}
|
||||
- {{ .TenantEnv }}
|
||||
{{- else }}
|
||||
- {{ .Namespace }}
|
||||
{{- end }}
|
||||
imagePullSecrets:
|
||||
- name: harborsecret
|
||||
containers:
|
||||
- name: {{ .AppName }}
|
||||
{{- if .HarborPort }}
|
||||
image: {{ .HarborIPOrCustomImagePrefix }}:{{ .HarborPort }}/cmii/{{ .AppName }}:{{ .ImageTag }}
|
||||
{{- else }}
|
||||
image: {{ .HarborIPOrCustomImagePrefix }}{{ .AppName }}:{{ .ImageTag }}
|
||||
{{- end }}
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: K8S_NAMESPACE
|
||||
value: {{ .Namespace }}
|
||||
- name: APPLICATION_NAME
|
||||
value: {{ .AppName }}
|
||||
- name: CUST_JAVA_OPTS
|
||||
value: "-Xms200m -Xmx1500m -Dlog4j2.formatMsgNoLookups=true"
|
||||
- name: NACOS_REGISTRY
|
||||
value: "helm-nacos:8848"
|
||||
- name: NACOS_DISCOVERY_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
- name: NACOS_DISCOVERY_PORT
|
||||
value: "8080"
|
||||
- name: BIZ_CONFIG_GROUP
|
||||
value: {{ .TagVersion }}
|
||||
- name: SYS_CONFIG_GROUP
|
||||
value: {{ .TagVersion }}
|
||||
- name: IMAGE_VERSION
|
||||
value: {{ .TagVersion }}
|
||||
- name: NACOS_USERNAME
|
||||
value: "developer"
|
||||
- name: NACOS_PASSWORD
|
||||
value: "Deve@9128201"
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: NODE_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.hostIP
|
||||
- name: LIMIT_CPU
|
||||
valueFrom:
|
||||
resourceFieldRef:
|
||||
containerName: {{ .AppName }}
|
||||
resource: limits.cpu
|
||||
- name: LIMIT_MEMORY
|
||||
valueFrom:
|
||||
resourceFieldRef:
|
||||
containerName: {{ .AppName }}
|
||||
resource: limits.memory
|
||||
- name: REQUEST_CPU
|
||||
valueFrom:
|
||||
resourceFieldRef:
|
||||
containerName: {{ .AppName }}
|
||||
resource: requests.cpu
|
||||
- name: REQUEST_MEMORY
|
||||
valueFrom:
|
||||
resourceFieldRef:
|
||||
containerName: {{ .AppName }}
|
||||
resource: requests.memory
|
||||
ports:
|
||||
- name: pod-port
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
resources:
|
||||
limits:
|
||||
memory: 2Gi
|
||||
cpu: "2"
|
||||
requests:
|
||||
memory: 200Mi
|
||||
cpu: 200m
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /cmii/health
|
||||
port: pod-port
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 60
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 20
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /cmii/health
|
||||
port: pod-port
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 60
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 20
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /cmii/health
|
||||
port: pod-port
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 60
|
||||
timeoutSeconds: 3
|
||||
periodSeconds: 20
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
volumeMounts:
|
||||
- name: nfs-backend-log-volume
|
||||
mountPath: /cmii/logs
|
||||
readOnly: false
|
||||
subPath: {{ .Namespace }}/{{ .AppName }}
|
||||
{{- if .NeedPvcCache }}
|
||||
- name: data-cache-volume
|
||||
mountPath: /cmii/cache
|
||||
readOnly: false
|
||||
subPath: {{ .Namespace }}/{{ .AppName }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: nfs-backend-log-volume
|
||||
persistentVolumeClaim:
|
||||
claimName: nfs-backend-log-pvc
|
||||
{{- if .NeedPvcCache }}
|
||||
- name: data-cache-volume
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .AppName }}-cache
|
||||
{{- end }}
|
||||
`
|
||||
|
||||
const CmiiBackendServiceTemplate = `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .AppName }}
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
cmii.type: backend
|
||||
cmii.app: {{ .AppName }}
|
||||
octopus/control: backend-app-1.0.0
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
app.kubernetes.io/app-version: {{ .TagVersion }}
|
||||
spec:
|
||||
{{- if .NodePort }}
|
||||
type: NodePort
|
||||
{{- else }}
|
||||
type: ClusterIP
|
||||
{{- end }}
|
||||
selector:
|
||||
cmii.type: backend
|
||||
cmii.app: {{ .AppName }}
|
||||
ports:
|
||||
- name: backend-tcp
|
||||
port: 8080
|
||||
protocol: TCP
|
||||
targetPort: 8080
|
||||
{{- if .NodePort }}
|
||||
nodePort: {{ .NodePort }}
|
||||
{{- end }}
|
||||
`
|
||||
|
||||
const CmiiBackendPVCTemplate = `
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .AppName }}-cache
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
cmii.type: backend
|
||||
cmii.app: {{ .AppName }}
|
||||
octopus/control: backend-app-1.0.0
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
app.kubernetes.io/app-version: {{ .TagVersion }}
|
||||
spec:
|
||||
storageClassName: nfs-prod-distribute
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
volumeMode: Filesystem
|
||||
resources:
|
||||
requests:
|
||||
storage: 15Gi
|
||||
`
|
||||
98
agent-deploy/d_app/TemplateCmiiFrontend.go
Normal file
98
agent-deploy/d_app/TemplateCmiiFrontend.go
Normal file
@@ -0,0 +1,98 @@
|
||||
package d_app
|
||||
|
||||
const CmiiFrontendDeploymentTemplate = `
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .AppName }}
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
cmii.type: frontend
|
||||
cmii.app: {{ .AppName }}
|
||||
octopus.control: frontend-app-wdd
|
||||
app.kubernetes.io/app-version: {{ .TagVersion }}
|
||||
spec:
|
||||
replicas: {{ .Replicas }}
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxUnavailable: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
cmii.type: frontend
|
||||
cmii.app: {{ .AppName }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
cmii.type: frontend
|
||||
cmii.app: {{ .AppName }}
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: harborsecret
|
||||
containers:
|
||||
- name: {{ .AppName }}
|
||||
{{- if .HarborPort }}
|
||||
image: {{ .HarborIPOrCustomImagePrefix }}:{{ .HarborPort }}/cmii/{{ .AppName }}:{{ .ImageTag }}
|
||||
{{- else }}
|
||||
image: {{ .HarborIPOrCustomImagePrefix }}{{ .AppName }}:{{ .ImageTag }}
|
||||
{{- end }}
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: K8S_NAMESPACE
|
||||
value: {{ .Namespace }}
|
||||
- name: APPLICATION_NAME
|
||||
value: {{ .AppName }}
|
||||
ports:
|
||||
- name: platform-9528
|
||||
containerPort: 9528
|
||||
protocol: TCP
|
||||
resources:
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 1Gi
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 50Mi
|
||||
volumeMounts:
|
||||
- name: nginx-conf
|
||||
mountPath: /etc/nginx/conf.d/nginx.conf
|
||||
subPath: nginx.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: tenant-prefix
|
||||
configMap:
|
||||
name: tenant-prefix-{{ .ShortName }}
|
||||
items:
|
||||
- key: ingress-config.js
|
||||
path: ingress-config.js
|
||||
`
|
||||
|
||||
const CmiiFrontendServiceTemplate = `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .AppName }}
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
cmii.type: frontend
|
||||
cmii.app: {{ .AppName }}
|
||||
octopus.control: frontend-app-wdd
|
||||
app.kubernetes.io/version: {{ .TagVersion }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
cmii.type: frontend
|
||||
cmii.app: {{ .AppName }}
|
||||
ports:
|
||||
- name: web-svc-port
|
||||
port: 9528
|
||||
protocol: TCP
|
||||
targetPort: 9528
|
||||
`
|
||||
515
agent-deploy/d_app/TemplateCmiiSRS.go
Normal file
515
agent-deploy/d_app/TemplateCmiiSRS.go
Normal file
@@ -0,0 +1,515 @@
|
||||
package d_app
|
||||
|
||||
const CmiiSrsTemplate = `
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: helm-live-srs-cm
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
cmii.app: live-srs
|
||||
cmii.type: live
|
||||
octopus.control: wdd
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
helm.sh/chart: cmlc-live-srs-rtc-2.0.0
|
||||
data:
|
||||
srs.rtc.conf: |-
|
||||
listen {{ .RtmpPort }};
|
||||
max_connections 4096;
|
||||
srs_log_tank console;
|
||||
srs_log_level info;
|
||||
srs_log_file /home/srs.log;
|
||||
daemon off;
|
||||
http_api {
|
||||
enabled on;
|
||||
listen 1985;
|
||||
crossdomain on;
|
||||
}
|
||||
stats {
|
||||
network 0;
|
||||
}
|
||||
http_server {
|
||||
enabled on;
|
||||
listen 8080;
|
||||
dir /home/hls;
|
||||
}
|
||||
srt_server {
|
||||
enabled on;
|
||||
listen 30556;
|
||||
maxbw 1000000000;
|
||||
connect_timeout 4000;
|
||||
peerlatency 600;
|
||||
recvlatency 600;
|
||||
}
|
||||
rtc_server {
|
||||
enabled on;
|
||||
listen {{ .WebRTCPort }};
|
||||
candidate $CANDIDATE;
|
||||
}
|
||||
vhost __defaultVhost__ {
|
||||
http_hooks {
|
||||
enabled on;
|
||||
on_publish http://helm-live-op-svc-v2:8080/hooks/on_push;
|
||||
}
|
||||
http_remux {
|
||||
enabled on;
|
||||
}
|
||||
rtc {
|
||||
enabled on;
|
||||
rtmp_to_rtc on;
|
||||
rtc_to_rtmp on;
|
||||
keep_bframe off;
|
||||
}
|
||||
tcp_nodelay on;
|
||||
min_latency on;
|
||||
play {
|
||||
gop_cache off;
|
||||
mw_latency 100;
|
||||
mw_msgs 10;
|
||||
}
|
||||
publish {
|
||||
firstpkt_timeout 8000;
|
||||
normal_timeout 4000;
|
||||
mr on;
|
||||
}
|
||||
dvr {
|
||||
enabled off;
|
||||
dvr_path /home/dvr/[app]/[stream]/[2006][01]/[timestamp].mp4;
|
||||
dvr_plan session;
|
||||
}
|
||||
hls {
|
||||
enabled on;
|
||||
hls_path /home/hls;
|
||||
hls_fragment 10;
|
||||
hls_window 60;
|
||||
hls_m3u8_file [app]/[stream].m3u8;
|
||||
hls_ts_file [app]/[stream]/[2006][01][02]/[timestamp]-[duration].ts;
|
||||
hls_cleanup on;
|
||||
{{- if .WebPort }}
|
||||
hls_entry_prefix http://{{ .WebIP }}:{{ .WebPort }};
|
||||
{{- else }}
|
||||
hls_entry_prefix http://{{ .WebIP }};
|
||||
{{- end }}
|
||||
}
|
||||
}
|
||||
---
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: helm-live-srs-svc-exporter
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
octopus.control: wdd
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
spec:
|
||||
ports:
|
||||
- name: rtmp
|
||||
protocol: TCP
|
||||
port: {{ .RtmpPort }}
|
||||
targetPort: {{ .RtmpPort }}
|
||||
nodePort: {{ .RtmpPort }}
|
||||
- name: rtc
|
||||
protocol: UDP
|
||||
port: {{ .WebRTCPort }}
|
||||
targetPort: {{ .WebRTCPort }}
|
||||
nodePort: {{ .WebRTCPort }}
|
||||
- name: rtc-tcp
|
||||
protocol: TCP
|
||||
port: {{ .WebRTCPort }}
|
||||
targetPort: {{ .WebRTCPort }}
|
||||
nodePort: {{ .WebRTCPort }}
|
||||
- name: srt
|
||||
protocol: UDP
|
||||
port: 30556
|
||||
targetPort: 30556
|
||||
nodePort: {{ .SrtPort }}
|
||||
- name: api
|
||||
protocol: TCP
|
||||
port: 1985
|
||||
targetPort: 1985
|
||||
nodePort: {{ .WebApiPort }}
|
||||
selector:
|
||||
srs-role: rtc
|
||||
type: NodePort
|
||||
sessionAffinity: None
|
||||
externalTrafficPolicy: Cluster
|
||||
|
||||
---
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: helm-live-srs-svc
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
octopus.control: wdd
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 8080
|
||||
targetPort: 8080
|
||||
- name: api
|
||||
protocol: TCP
|
||||
port: 1985
|
||||
targetPort: 1985
|
||||
selector:
|
||||
srs-role: rtc
|
||||
type: ClusterIP
|
||||
sessionAffinity: None
|
||||
|
||||
---
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: helm-live-srsrtc-svc
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
octopus.control: wdd
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
spec:
|
||||
ports:
|
||||
- name: rtmp
|
||||
protocol: TCP
|
||||
port: {{ .RtmpPort }}
|
||||
targetPort: {{ .RtmpPort }}
|
||||
selector:
|
||||
srs-role: rtc
|
||||
type: ClusterIP
|
||||
sessionAffinity: None
|
||||
|
||||
---
|
||||
kind: StatefulSet
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: helm-live-srs-rtc
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
octopus.control: wdd
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
cmii.app: live-srs
|
||||
cmii.type: live
|
||||
helm.sh/chart: cmlc-live-srs-rtc-2.0.0
|
||||
srs-role: rtc
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
srs-role: rtc
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
srs-role: rtc
|
||||
spec:
|
||||
volumes:
|
||||
- name: srs-conf-file
|
||||
configMap:
|
||||
name: helm-live-srs-cm
|
||||
items:
|
||||
- key: srs.rtc.conf
|
||||
path: docker.conf
|
||||
defaultMode: 420
|
||||
- name: srs-vol
|
||||
emptyDir:
|
||||
sizeLimit: 8Gi
|
||||
containers:
|
||||
- name: srs-rtc
|
||||
{{- if .HarborPort }}
|
||||
image: {{ .HarborIPOrCustomImagePrefix }}:{{ .HarborPort }}/cmii/srs:v5.0.195
|
||||
{{- else }}
|
||||
image: {{ .HarborIPOrCustomImagePrefix }}srs:v5.0.195
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: srs-rtmp
|
||||
containerPort: {{ .RtmpPort }}
|
||||
protocol: TCP
|
||||
- name: srs-api
|
||||
containerPort: 1985
|
||||
protocol: TCP
|
||||
- name: srs-flv
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
- name: srs-webrtc
|
||||
containerPort: {{ .WebRTCPort }}
|
||||
protocol: UDP
|
||||
- name: srs-webrtc-tcp
|
||||
containerPort: {{ .WebRTCPort }}
|
||||
protocol: TCP
|
||||
- name: srs-srt
|
||||
containerPort: 30556
|
||||
protocol: UDP
|
||||
env:
|
||||
- name: CANDIDATE
|
||||
value: {{ .WebIP }}
|
||||
resources:
|
||||
limits:
|
||||
cpu: 2000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
volumeMounts:
|
||||
- name: srs-conf-file
|
||||
mountPath: /usr/local/srs/conf/docker.conf
|
||||
subPath: docker.conf
|
||||
- name: srs-vol
|
||||
mountPath: /home/dvr
|
||||
subPath: {{ .Namespace }}/helm-live/dvr
|
||||
- name: srs-vol
|
||||
mountPath: /home/hls
|
||||
subPath: {{ .Namespace }}/helm-live/hls
|
||||
terminationMessagePath: /dev/termination-log
|
||||
terminationMessagePolicy: File
|
||||
imagePullPolicy: Always
|
||||
- name: oss-adaptor
|
||||
{{- if .HarborPort }}
|
||||
image: {{ .HarborIPOrCustomImagePrefix }}:{{ .HarborPort }}/cmii/cmii-srs-oss-adaptor:2023-SA-skip-CHL
|
||||
{{- else }}
|
||||
image: {{ .HarborIPOrCustomImagePrefix }}cmii-srs-oss-adaptor:2023-SA-skip-CHL
|
||||
{{- end }}
|
||||
env:
|
||||
- name: OSS_ENDPOINT
|
||||
value: 'http://{{ .MinioInnerIP }}:9000'
|
||||
- name: OSS_AK
|
||||
value: cmii
|
||||
- name: OSS_SK
|
||||
value: 'B#923fC7mk'
|
||||
- name: OSS_BUCKET
|
||||
value: live-cluster-hls
|
||||
- name: SRS_OP
|
||||
value: 'http://helm-live-op-svc-v2:8080'
|
||||
- name: MYSQL_ENDPOINT
|
||||
value: 'helm-mysql:3306'
|
||||
- name: MYSQL_USERNAME
|
||||
value: k8s_admin
|
||||
- name: MYSQL_PASSWORD
|
||||
value: {{ .MySQLK8sAdminPassword }}
|
||||
- name: MYSQL_DATABASE
|
||||
value: cmii_live_srs_op
|
||||
- name: MYSQL_TABLE
|
||||
value: live_segment
|
||||
- name: LOG_LEVEL
|
||||
value: info
|
||||
- name: OSS_META
|
||||
value: 'yes'
|
||||
resources:
|
||||
limits:
|
||||
cpu: 2000m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
volumeMounts:
|
||||
- name: srs-vol
|
||||
mountPath: /cmii/share/hls
|
||||
subPath: {{ .Namespace }}/helm-live/hls
|
||||
terminationMessagePath: /dev/termination-log
|
||||
terminationMessagePolicy: File
|
||||
imagePullPolicy: Always
|
||||
restartPolicy: Always
|
||||
terminationGracePeriodSeconds: 30
|
||||
dnsPolicy: ClusterFirst
|
||||
securityContext: {}
|
||||
imagePullSecrets:
|
||||
- name: harborsecret
|
||||
affinity: {}
|
||||
schedulerName: default-scheduler
|
||||
serviceName: helm-live-srsrtc-svc
|
||||
podManagementPolicy: OrderedReady
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
partition: 0
|
||||
revisionHistoryLimit: 10
|
||||
---
|
||||
# live-srs部分
|
||||
---
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: helm-live-op-v2
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
octopus.control: wdd
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
cmii.app: live-engine
|
||||
cmii.type: live
|
||||
helm.sh/chart: cmlc-live-live-op-2.0.0
|
||||
live-role: op-v2
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
live-role: op-v2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
live-role: op-v2
|
||||
spec:
|
||||
volumes:
|
||||
- name: srs-conf-file
|
||||
configMap:
|
||||
name: helm-live-op-cm-v2
|
||||
items:
|
||||
- key: live.op.conf
|
||||
path: bootstrap.yaml
|
||||
defaultMode: 420
|
||||
containers:
|
||||
- name: helm-live-op-v2
|
||||
{{- if .HarborPort }}
|
||||
image: {{ .HarborIPOrCustomImagePrefix }}:{{ .HarborPort }}/cmii/cmii-live-operator:5.2.0
|
||||
{{- else }}
|
||||
image: {{ .HarborIPOrCustomImagePrefix }}cmii-live-operator:5.2.0
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: operator
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
resources:
|
||||
limits:
|
||||
cpu: 4800m
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
volumeMounts:
|
||||
- name: srs-conf-file
|
||||
mountPath: /cmii/bootstrap.yaml
|
||||
subPath: bootstrap.yaml
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /cmii/health
|
||||
port: 8080
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 60
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 20
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /cmii/health
|
||||
port: 8080
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 60
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 20
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
terminationMessagePath: /dev/termination-log
|
||||
terminationMessagePolicy: File
|
||||
imagePullPolicy: Always
|
||||
restartPolicy: Always
|
||||
terminationGracePeriodSeconds: 30
|
||||
dnsPolicy: ClusterFirst
|
||||
securityContext: {}
|
||||
imagePullSecrets:
|
||||
- name: harborsecret
|
||||
affinity: {}
|
||||
schedulerName: default-scheduler
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 25%
|
||||
maxSurge: 25%
|
||||
revisionHistoryLimit: 10
|
||||
progressDeadlineSeconds: 600
|
||||
---
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: helm-live-op-svc-v2
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
octopus.control: wdd
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
spec:
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8080
|
||||
targetPort: 8080
|
||||
nodePort: 30333
|
||||
selector:
|
||||
live-role: op-v2
|
||||
type: NodePort
|
||||
sessionAffinity: None
|
||||
---
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: helm-live-op-svc
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
octopus.control: wdd
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
spec:
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8080
|
||||
targetPort: 8080
|
||||
selector:
|
||||
live-role: op
|
||||
type: ClusterIP
|
||||
sessionAffinity: None
|
||||
---
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: helm-live-op-cm-v2
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
octopus.control: wdd
|
||||
app.kubernetes.io/managed-by: octopus
|
||||
cmii.app: live-engine
|
||||
cmii.type: live
|
||||
data:
|
||||
live.op.conf: |-
|
||||
server:
|
||||
port: 8080
|
||||
spring:
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
allow-circular-references: true
|
||||
application:
|
||||
name: cmii-live-operator
|
||||
platform:
|
||||
info:
|
||||
name: cmii-live-operator
|
||||
description: cmii-live-operator
|
||||
version: {{ .TagVersion }}
|
||||
scanPackage: com.cmii.live.op
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
username: nacos
|
||||
password: KingKong@95461234
|
||||
server-addr: helm-nacos:8848
|
||||
extension-configs:
|
||||
- data-id: cmii-live-operator.yml
|
||||
group: {{ .TagVersion }}
|
||||
refresh: true
|
||||
shared-configs:
|
||||
- data-id: cmii-backend-system.yml
|
||||
group: {{ .TagVersion }}
|
||||
refresh: true
|
||||
discovery:
|
||||
enabled: false
|
||||
|
||||
live:
|
||||
engine:
|
||||
type: srs
|
||||
endpoint: 'http://helm-live-srs-svc:1985'
|
||||
proto:
|
||||
rtmp: 'rtmp://{{ .WebIP }}:{{ .RtmpPort }}'
|
||||
rtsp: 'rtsp://{{ .WebIP }}:30554'
|
||||
srt: 'srt://{{ .WebIP }}:{{ .SrtPort }}'
|
||||
flv: 'http://{{ .WebIP }}:30500'
|
||||
hls: 'http://{{ .WebIP }}:30500'
|
||||
rtc: 'webrtc://{{ .WebIP }}:30080'
|
||||
replay: 'https://{{ .WebIP }}:30333'
|
||||
minio:
|
||||
endpoint: http://{{ .MinioInnerIP }}:9000
|
||||
access-key: cmii
|
||||
secret-key: B#923fC7mk
|
||||
bucket: live-cluster-hls
|
||||
`
|
||||
218
agent-deploy/d_app/TemplateIngressConfigMap.go
Normal file
218
agent-deploy/d_app/TemplateIngressConfigMap.go
Normal file
@@ -0,0 +1,218 @@
|
||||
package d_app
|
||||
|
||||
const CmiiFrontendConfigMapTemplate = `
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: tenant-prefix-{{ .ShortName }}
|
||||
namespace: {{ .Namespace }}
|
||||
data:
|
||||
ingress-config.js: |-
|
||||
var __GlobalIngressConfig = {
|
||||
TenantEnvironment: "{{ .TenantEnv }}",
|
||||
{{- if .WebPort }}
|
||||
CloudHOST: "{{ .WebIP }}:{{ .WebPort }}",
|
||||
{{- else }}
|
||||
CloudHOST: "{{ .WebIP }}",
|
||||
{{- end }}
|
||||
{{- if eq .ShortName "pangu" }}
|
||||
ApplicationShortName: "",
|
||||
{{- else }}
|
||||
ApplicationShortName: "{{ .ShortName }}",
|
||||
{{- end }}
|
||||
AppClientId: "{{ .ClientId }}"
|
||||
}
|
||||
`
|
||||
|
||||
const CmiiFrontendDefaultNginxConfTemplate = `
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: nginx-cm
|
||||
namespace: {{ .Namespace }}
|
||||
labels:
|
||||
cmii.type: frontend
|
||||
data:
|
||||
nginx.conf: |
|
||||
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: |
|
||||
{{- range $key, $value := .FrontendShortNameMaps }}
|
||||
rewrite ^(/{{ $value }})$ $1/ redirect;
|
||||
{{- end }}
|
||||
spec:
|
||||
rules:
|
||||
- host: fake-domain.{{ .Namespace }}.io
|
||||
http:
|
||||
paths:
|
||||
{{- if .TenantEnv }}
|
||||
{{- $tenantEnv := .TenantEnv }}
|
||||
- path: /{{ $tenantEnv }}/?(.*)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: cmii-uav-platform
|
||||
servicePort: 9528
|
||||
{{- range $key, $value := .FrontendShortNameMaps }}
|
||||
- path: /{{ $tenantEnv }}/{{ $value }}/?(.*)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: {{ $key }}
|
||||
servicePort: 9528
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- path: /?(.*)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: cmii-uav-platform
|
||||
servicePort: 9528
|
||||
{{- range $key, $value := .FrontendShortNameMaps }}
|
||||
- path: /{{ $value }}/?(.*)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: {{ $key }}
|
||||
servicePort: 9528
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
`
|
||||
|
||||
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:
|
||||
{{- if .TenantEnv }}
|
||||
{{- $tenantEnv := .TenantEnv }}
|
||||
{{- range $key, $value := .BackendImageVersionMap }}
|
||||
- host: {{ $key }}.uavcloud-{{ $tenantEnv }}.io
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: {{ $key }}
|
||||
servicePort: 8080
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $tenantEnv := .Namespace }}
|
||||
{{- range $key, $value := .BackendImageVersionMap }}
|
||||
- host: {{ $key }}.uavcloud-{{ $tenantEnv }}.io
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: {{ $key }}
|
||||
servicePort: 8080
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
`
|
||||
|
||||
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 upgradePrefix $http_upgrade;
|
||||
proxy_set_header Connection "upgradePrefix";
|
||||
spec:
|
||||
rules:
|
||||
- host: fake-domain.{{ .Namespace }}.io
|
||||
http:
|
||||
paths:
|
||||
{{- if .TenantEnv }}
|
||||
{{- $tenantEnv := .TenantEnv }}
|
||||
- path: /{{ $tenantEnv }}/oms/api/?(.*)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: cmii-admin-gateway
|
||||
servicePort: 8080
|
||||
- path: /{{ $tenantEnv }}/open/api/?(.*)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: cmii-open-gateway
|
||||
servicePort: 8080
|
||||
- path: /{{ $tenantEnv }}/api/?(.*)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: cmii-uav-gateway
|
||||
servicePort: 8080
|
||||
- path: /{{ $tenantEnv }}/uas/api/?(.*)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: cmii-uas-gateway
|
||||
servicePort: 8080
|
||||
{{- else }}
|
||||
- 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
|
||||
- path: /uas/api/?(.*)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: cmii-uas-gateway
|
||||
servicePort: 8080
|
||||
{{- end }}
|
||||
`
|
||||
Reference in New Issue
Block a user