From f1fdfc77776fef9ac3e807f4859be160d2e82690 Mon Sep 17 00:00:00 2001 From: zeaslity Date: Wed, 12 Jun 2024 14:09:49 +0800 Subject: [PATCH] [Agent][Deploy] - cmii update --- agent-deploy/OctopusDeploy.go | 27 +++++++++++++++++++ .../a_dashboard/TemplateK8SDashboard.go | 4 +-- agent-deploy/a_nfs/TemplateNFS.go | 2 +- agent-deploy/a_nfs/TemplateNFSTest.go | 2 +- agent-deploy/b_middle/CmiiEmqxTemplate.go | 2 +- agent-deploy/b_middle/CmiiMongoTemplate.go | 2 +- agent-deploy/b_middle/CmiiMySQLTemplate.go | 4 +-- agent-deploy/b_middle/CmiiNacosTemplate.go | 2 +- agent-deploy/b_middle/CmiiRabbitMQTemplate.go | 4 +-- agent-deploy/b_middle/CmiiRedisTemplate.go | 4 +-- agent-deploy/c_app/TemplateCmiiBackend.go | 2 +- agent-deploy/c_app/TemplateCmiiFrontend.go | 2 +- .../c_app/TemplateIngressConfigMap.go | 4 +++ agent-operator/CmiiK8sOperator_test.go | 4 +-- agent-operator/log/cmii-update-log.txt | 3 +++ 15 files changed, 51 insertions(+), 17 deletions(-) diff --git a/agent-deploy/OctopusDeploy.go b/agent-deploy/OctopusDeploy.go index 1a4429a..6d1f83d 100644 --- a/agent-deploy/OctopusDeploy.go +++ b/agent-deploy/OctopusDeploy.go @@ -164,3 +164,30 @@ func configMapDeploy(common *z_dep.CommonEnvironmentConfig) { c_app.DefaultCmiiFrontendConfig.ConfigMapDeploy(common) } } + +// CmiiEnvironmentDeploy 部署完整的CMII环境的所有组件 +func CmiiEnvironmentDeploy() { + + // common environment + common := &z_dep.CommonEnvironmentConfig{ + WebIP: "lab.uavcmlc.com", + WebPort: "", + HarborIP: image2.CmiiHarborPrefix, + HarborPort: "", + Namespace: "devflight", + TagVersion: "5.5.0", + TenantEnv: "devflight", + } + + folderPrefix := "/home/wdd/IdeaProjects/ProjectOctopus/agent-deploy/" + + // clear old apply file + + // clear all middleware data + // ignore redis rabbitmq mongo nacos emqx + // sync mysql-data + + // generate new apply file for specific environment + + // apply for them +} diff --git a/agent-deploy/a_dashboard/TemplateK8SDashboard.go b/agent-deploy/a_dashboard/TemplateK8SDashboard.go index 4397eac..0fb6dcf 100644 --- a/agent-deploy/a_dashboard/TemplateK8SDashboard.go +++ b/agent-deploy/a_dashboard/TemplateK8SDashboard.go @@ -182,7 +182,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/dashboard:v2.0.1 {{- else }} - image: {{ .HarborIP }}/cmii/dashboard:v2.0.1 + image: {{ .HarborIP }}dashboard:v2.0.1 {{- end }} ports: - containerPort: 8443 @@ -267,7 +267,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/metrics-scraper:v1.0.4 {{- else }} - image: {{ .HarborIP }}/cmii/metrics-scraper:v1.0.4 + image: {{ .HarborIP }}metrics-scraper:v1.0.4 {{- end }} ports: - containerPort: 8000 diff --git a/agent-deploy/a_nfs/TemplateNFS.go b/agent-deploy/a_nfs/TemplateNFS.go index 0e5c4e7..bc4f112 100644 --- a/agent-deploy/a_nfs/TemplateNFS.go +++ b/agent-deploy/a_nfs/TemplateNFS.go @@ -99,7 +99,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/nfs-subdir-external-provisioner:v4.0.2 {{- else }} - image: {{ .HarborIP }}/cmii/nfs-subdir-external-provisioner:v4.0.2 + image: {{ .HarborIP }}nfs-subdir-external-provisioner:v4.0.2 {{- end }} volumeMounts: - name: nfs-client-root diff --git a/agent-deploy/a_nfs/TemplateNFSTest.go b/agent-deploy/a_nfs/TemplateNFSTest.go index e8cba67..f5b90ca 100644 --- a/agent-deploy/a_nfs/TemplateNFSTest.go +++ b/agent-deploy/a_nfs/TemplateNFSTest.go @@ -25,7 +25,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/busybox:latest {{- else }} - image: {{ .HarborIP }}/cmii/busybox:latest + image: {{ .HarborIP }}busybox:latest {{- end }} command: - "/bin/sh" diff --git a/agent-deploy/b_middle/CmiiEmqxTemplate.go b/agent-deploy/b_middle/CmiiEmqxTemplate.go index ba4050a..705c84a 100644 --- a/agent-deploy/b_middle/CmiiEmqxTemplate.go +++ b/agent-deploy/b_middle/CmiiEmqxTemplate.go @@ -105,7 +105,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/emqx:5.5.1 {{- else }} - image: {{ .HarborIP }}/cmii/emqx:5.5.1 + image: {{ .HarborIP }}emqx:5.5.1 {{- end }} imagePullPolicy: Always ports: diff --git a/agent-deploy/b_middle/CmiiMongoTemplate.go b/agent-deploy/b_middle/CmiiMongoTemplate.go index 45f7896..231da44 100644 --- a/agent-deploy/b_middle/CmiiMongoTemplate.go +++ b/agent-deploy/b_middle/CmiiMongoTemplate.go @@ -57,7 +57,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/mongo:5.0 {{- else }} - image: {{ .HarborIP }}/cmii/mongo:5.0 + image: {{ .HarborIP }}mongo:5.0 {{- end }} resources: {} ports: diff --git a/agent-deploy/b_middle/CmiiMySQLTemplate.go b/agent-deploy/b_middle/CmiiMySQLTemplate.go index 3f6645b..5cec8c9 100644 --- a/agent-deploy/b_middle/CmiiMySQLTemplate.go +++ b/agent-deploy/b_middle/CmiiMySQLTemplate.go @@ -311,7 +311,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/bitnami-shell:11-debian-11-r136 {{- else }} - image: {{ .HarborIP }}/cmii/bitnami-shell:11-debian-11-r136 + image: {{ .HarborIP }}bitnami-shell:11-debian-11-r136 {{- end }} imagePullPolicy: "Always" command: @@ -329,7 +329,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/mysql:8.1.0-debian-11-r42 {{- else }} - image: {{ .HarborIP }}/cmii/mysql:8.1.0-debian-11-r42 + image: {{ .HarborIP }}mysql:8.1.0-debian-11-r42 {{- end }} imagePullPolicy: "IfNotPresent" securityContext: diff --git a/agent-deploy/b_middle/CmiiNacosTemplate.go b/agent-deploy/b_middle/CmiiNacosTemplate.go index 0bc3f74..5790c5e 100644 --- a/agent-deploy/b_middle/CmiiNacosTemplate.go +++ b/agent-deploy/b_middle/CmiiNacosTemplate.go @@ -84,7 +84,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/nacos-server:v2.1.2 {{- else }} - image: {{ .HarborIP }}/cmii/nacos-server:v2.1.2 + image: {{ .HarborIP }}nacos-server:v2.1.2 {{- end }} ports: - containerPort: 8848 diff --git a/agent-deploy/b_middle/CmiiRabbitMQTemplate.go b/agent-deploy/b_middle/CmiiRabbitMQTemplate.go index fcca87e..032d373 100644 --- a/agent-deploy/b_middle/CmiiRabbitMQTemplate.go +++ b/agent-deploy/b_middle/CmiiRabbitMQTemplate.go @@ -195,7 +195,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/bitnami-shell:11-debian-11-r136 {{- else }} - image: {{ .HarborIP }}/cmii/bitnami-shell:11-debian-11-r136 + image: {{ .HarborIP }}bitnami-shell:11-debian-11-r136 {{- end }} imagePullPolicy: "Always" command: @@ -218,7 +218,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/rabbitmq:3.9.12-debian-10-r3 {{- else }} - image: {{ .HarborIP }}/cmii/rabbitmq:3.9.12-debian-10-r3 + image: {{ .HarborIP }}rabbitmq:3.9.12-debian-10-r3 {{- end }} imagePullPolicy: "Always" env: diff --git a/agent-deploy/b_middle/CmiiRedisTemplate.go b/agent-deploy/b_middle/CmiiRedisTemplate.go index e3e3d6f..95663b4 100644 --- a/agent-deploy/b_middle/CmiiRedisTemplate.go +++ b/agent-deploy/b_middle/CmiiRedisTemplate.go @@ -356,7 +356,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/redis:6.2.6-debian-10-r0 {{- else }} - image: {{ .HarborIP }}/cmii/redis:6.2.6-debian-10-r0 + image: {{ .HarborIP }}redis:6.2.6-debian-10-r0 {{- end }} imagePullPolicy: "Always" securityContext: @@ -494,7 +494,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/bitnami-shell:6.2.6-debian-10-r0 {{- else }} - image: {{ .HarborIP }}/cmii/bitnami-shell:6.2.6-debian-10-r0 + image: {{ .HarborIP }}bitnami-shell:6.2.6-debian-10-r0 {{- end }} imagePullPolicy: "Always" securityContext: diff --git a/agent-deploy/c_app/TemplateCmiiBackend.go b/agent-deploy/c_app/TemplateCmiiBackend.go index d8f7a70..2d65a4b 100644 --- a/agent-deploy/c_app/TemplateCmiiBackend.go +++ b/agent-deploy/c_app/TemplateCmiiBackend.go @@ -43,7 +43,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/{{ .AppName }}:{{ .ImageTag }} {{- else }} - image: {{ .HarborIP }}/cmii/{{ .AppName }}:{{ .ImageTag }} + image: {{ .HarborIP }}{{ .AppName }}:{{ .ImageTag }} {{- end }} imagePullPolicy: Always env: diff --git a/agent-deploy/c_app/TemplateCmiiFrontend.go b/agent-deploy/c_app/TemplateCmiiFrontend.go index 065876b..c21627f 100644 --- a/agent-deploy/c_app/TemplateCmiiFrontend.go +++ b/agent-deploy/c_app/TemplateCmiiFrontend.go @@ -33,7 +33,7 @@ spec: {{- if .HarborPort }} image: {{ .HarborIP }}:{{ .HarborPort }}/cmii/{{ .AppName }}:{{ .ImageTag }} {{- else }} - image: {{ .HarborIP }}/cmii/{{ .AppName }}:{{ .ImageTag }} + image: {{ .HarborIP }}{{ .AppName }}:{{ .ImageTag }} {{- end }} imagePullPolicy: Always env: diff --git a/agent-deploy/c_app/TemplateIngressConfigMap.go b/agent-deploy/c_app/TemplateIngressConfigMap.go index ca892b2..7e72daa 100644 --- a/agent-deploy/c_app/TemplateIngressConfigMap.go +++ b/agent-deploy/c_app/TemplateIngressConfigMap.go @@ -10,7 +10,11 @@ data: ingress-config.js: |- var __GlobalIngressConfig = { TenantEnvironment: "{{ .TenantEnv }}", + {{- if .WebPort }} CloudHOST: "{{ .WebIP }}:{{ .WebPort }}", + {{- else }} + CloudHOST: "{{ .WebIP }}", + {{- end }} {{- if eq .ShortName "pangu" }} ApplicationShortName: "", {{- else }} diff --git a/agent-operator/CmiiK8sOperator_test.go b/agent-operator/CmiiK8sOperator_test.go index 3822c2a..dd619c5 100644 --- a/agent-operator/CmiiK8sOperator_test.go +++ b/agent-operator/CmiiK8sOperator_test.go @@ -253,7 +253,7 @@ func TestUpdateCmiiDeploymentImageTag(t *testing.T) { // 计算20:00的时间 now := time.Now() - targetTime := time.Date(now.Year(), now.Month(), now.Day(), 13, 52, 00, 0, now.Location()) + targetTime := time.Date(now.Year(), now.Month(), now.Day(), 13, 40, 00, 0, now.Location()) duration := time.Duration(0) @@ -277,7 +277,7 @@ func TestUpdateCmiiDeploymentImageTag(t *testing.T) { appNameTagMap := map[string]string{ //"cmii-uav-multilink": "5.5.0", //"cmii-uav-process": "5.6.0-060601", - "cmii-uav-industrial-portfolio": "5.6.0-060601", + "cmii-uav-industrial-portfolio": "5.6.0-061201", } for appName, newTag := range appNameTagMap { diff --git a/agent-operator/log/cmii-update-log.txt b/agent-operator/log/cmii-update-log.txt index a415119..9aef43e 100644 --- a/agent-operator/log/cmii-update-log.txt +++ b/agent-operator/log/cmii-update-log.txt @@ -52,3 +52,6 @@ 2024-06-05-17-48-21 uavcloud-demo cmii-uav-industrial-portfolio 5.6.0-060301 5.6.0-060501 2024-06-06-13-53-12 uavcloud-demo cmii-uav-process 5.6.0 5.6.0-060601 2024-06-06-13-59-14 uavcloud-demo cmii-uav-industrial-portfolio 5.6.0-060501 5.6.0-060601 +2024-06-12-13-40-00 uavcloud-demo cmii-uav-industrial-portfolio 5.6.0-061101 5.6.0-061201 +2024-06-12-13-45-01 uavcloud-demo cmii-uav-industrial-portfolio 5.6.0-061201 5.6.0-061101 +2024-06-12-13-47-35 uavcloud-demo cmii-uav-industrial-portfolio 5.6.0-061101 5.6.0-061201