[ Agent ] [ CMII ] - 新增版本更新的模式;新增部署模板;新增消息推送模块
This commit is contained in:
45
agent-go/k8s_exec/CmiiAppDeploy.go
Normal file
45
agent-go/k8s_exec/CmiiAppDeploy.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package k8s_exec
|
||||
|
||||
import (
|
||||
"agent-go/utils"
|
||||
"bytes"
|
||||
v1 "k8s.io/api/apps/v1"
|
||||
appsv1 "k8s.io/client-go/applyconfigurations/apps/v1"
|
||||
"sigs.k8s.io/yaml"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
type CmiiBackendDeploymentConfig struct {
|
||||
Namespace string
|
||||
AppName string
|
||||
ImageTag string
|
||||
TagVersion string
|
||||
Replicas string
|
||||
}
|
||||
|
||||
func (backend CmiiBackendDeploymentConfig) ParseToApplyConf() *appsv1.DeploymentApplyConfiguration {
|
||||
|
||||
// 解析模板
|
||||
tmpl, err := template.New("cmiiBackendDeploymentTemplate").Parse(cmiiBackendDeploymentTemplate)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// 应用数据并打印结果
|
||||
var result bytes.Buffer
|
||||
err = tmpl.Execute(&result, backend)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// 创建Deployment对象
|
||||
deployment := v1.Deployment{}
|
||||
err = yaml.Unmarshal(result.Bytes(), &deployment)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
utils.BeautifulPrint(&deployment)
|
||||
|
||||
return nil
|
||||
}
|
||||
120
agent-go/k8s_exec/CmiiAppDeployTemplate.go
Normal file
120
agent-go/k8s_exec/CmiiAppDeployTemplate.go
Normal file
@@ -0,0 +1,120 @@
|
||||
package k8s_exec
|
||||
|
||||
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/control
|
||||
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:
|
||||
- demo
|
||||
imagePullSecrets:
|
||||
- name: harborsecret
|
||||
containers:
|
||||
- name: {{ .AppName }}
|
||||
image: "harbor.cdcyy.com.cn/cmii/{{ .AppName }}:{{ .ImageTag }}"
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: K8S_NAMESPACE
|
||||
value: "{{ .Namespace }}"
|
||||
- name: APPLICATION_NAME
|
||||
value: "{{ .AppName }}"
|
||||
- name: CUST_JAVA_OPTS
|
||||
value: "-Xms500m -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"
|
||||
ports:
|
||||
- name: pod-port
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
resources:
|
||||
limits:
|
||||
memory: 2Gi
|
||||
cpu: 2
|
||||
requests:
|
||||
memory: 1Gi
|
||||
cpu: 200m
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /cmii/ping
|
||||
port: pod-port
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 60
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 20
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /cmii/ping
|
||||
port: pod-port
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 60
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 20
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /cmii/ping
|
||||
port: pod-port
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 60
|
||||
timeoutSeconds: 3
|
||||
periodSeconds: 20
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
volumeMounts:
|
||||
- name: glusterfs-backend-log-volume
|
||||
mountPath: /cmii/logs
|
||||
readOnly: false
|
||||
subPath: {{ .Namespace }}/{{ .AppName }}
|
||||
volumes:
|
||||
- name: glusterfs-backend-log-volume
|
||||
persistentVolumeClaim:
|
||||
claimName: glusterfs-backend-log-pvc
|
||||
`
|
||||
17
agent-go/k8s_exec/CmiiAppDeploy_test.go
Normal file
17
agent-go/k8s_exec/CmiiAppDeploy_test.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package k8s_exec
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestCmiiBackendDeploymentConfig_ParseToApplyConf(t *testing.T) {
|
||||
|
||||
deploymentConfig := CmiiBackendDeploymentConfig{
|
||||
Namespace: "uavcloud-dev",
|
||||
AppName: "cmii-uav-gateway",
|
||||
ImageTag: "5.2.0-123",
|
||||
TagVersion: "5.2.0",
|
||||
Replicas: "2",
|
||||
}
|
||||
|
||||
deploymentConfig.ParseToApplyConf()
|
||||
|
||||
}
|
||||
@@ -65,7 +65,7 @@ var CmiiBackendAppMap = map[string]string{
|
||||
}
|
||||
|
||||
var CmiiFrontendAppMap = map[string]string{
|
||||
"cmii-suav-platform-supervision": "5 .2.0",
|
||||
"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",
|
||||
@@ -93,6 +93,14 @@ var CmiiFrontendAppMap = map[string]string{
|
||||
"cmii-uav-platform-visualization": "5.2.0",
|
||||
}
|
||||
|
||||
var CmiiMiddlewareNameMap = map[string]string{
|
||||
"helm-nacos": "single",
|
||||
"helm-emqxs": "single",
|
||||
"helm-mysql": "single",
|
||||
"helm-redis": "replication",
|
||||
"helm-rabbitmq": "single",
|
||||
}
|
||||
|
||||
var CmiiBackendAppName = []string{
|
||||
"cmii-uav-gateway",
|
||||
"cmii-uav-oauth",
|
||||
|
||||
@@ -139,6 +139,21 @@ func FindPodNotHealthy(cmiiEnv string) (podList []CmiiPodInterface) {
|
||||
return podList
|
||||
}
|
||||
|
||||
func FindCmiiMiddlewarePodInterface(cmiiEnv string) (podList []CmiiPodInterface) {
|
||||
|
||||
cmiiPodInterfaces := CmiiOperator.PodAllInterface(cmiiEnv)
|
||||
|
||||
for _, podInterface := range cmiiPodInterfaces {
|
||||
for key, _ := range CmiiMiddlewareNameMap {
|
||||
if strings.Contains(podInterface.Name, key) {
|
||||
podList = append(podList, podInterface)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return podList
|
||||
}
|
||||
|
||||
func RestartDeploymentFromList(deploymentList []CmiiDeploymentInterface) bool {
|
||||
|
||||
result := true
|
||||
@@ -207,7 +222,13 @@ func UpdateCmiiDeploymentImageTag(cmiiEnv, appName, newTag string) bool {
|
||||
// check if need to update
|
||||
if cmiiDeploymentInterface.ImageTag == newTag {
|
||||
log.DebugF("[UpdateCmiiDeploymentImageTag] - [%s] [%s] image tag are the same ! no need to update !", cmiiEnv, appName)
|
||||
return true
|
||||
|
||||
// restart
|
||||
if CmiiOperator.DeploymentRestart(cmiiEnv, appName) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
content := executor.BasicWordSpaceCompletion(utils.TimeSplitFormatString()+" "+cmiiDeploymentInterface.Namespace, 45)
|
||||
@@ -240,6 +261,22 @@ func UpdateCmiiDeploymentImageTag(cmiiEnv, appName, newTag string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func UpdateCmiiImageTagFromNameTagMap(cmiiEnv string, nameTagMap map[string]string) (result map[string]string) {
|
||||
|
||||
result = make(map[string]string, len(nameTagMap))
|
||||
for appName, newTag := range nameTagMap {
|
||||
if AppNameBelongsToCmiiImage(appName) {
|
||||
if UpdateCmiiDeploymentImageTag(cmiiEnv, appName, newTag) {
|
||||
result[appName] = newTag
|
||||
} else {
|
||||
result[appName] = "false"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func RollBackCmiiDeploymentFromUpdateLog(updateLog string) bool {
|
||||
|
||||
if !executor.BasicFindContentInFile(updateLog, updateLogPath) {
|
||||
@@ -449,3 +486,37 @@ func FilterAllCmiiPodSoft(podList []CmiiPodInterface) (result []CmiiPodInterface
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func FilterAllCmiiNodeSoft(nodeList []CmiiNodeInterface) (result []CmiiNodeInterface) {
|
||||
|
||||
for _, nodeInterface := range nodeList {
|
||||
|
||||
if strings.HasPrefix(nodeInterface.Name, "ai") {
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.HasPrefix(nodeInterface.Name, "35") {
|
||||
continue
|
||||
}
|
||||
|
||||
result = append(result, nodeInterface)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func AppNameBelongsToCmiiImage(appName string) bool {
|
||||
_, ok := CmiiBackendAppMap[appName]
|
||||
if !ok {
|
||||
_, ok = CmiiFrontendAppMap[appName]
|
||||
if !ok {
|
||||
log.WarnF("[AppNameBelongsToCmiiImage] - [%s] not cmii app !", appName)
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,12 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var CmiiDevNamespaceList = []string{
|
||||
"uavcloud-dev",
|
||||
"uavcloud-devflight",
|
||||
"uavcloud-devoperation",
|
||||
}
|
||||
|
||||
func TestFindAppNotHealthyOrRestartCountGreaterThanN(t *testing.T) {
|
||||
|
||||
deploymentRestartCountGreaterThanN := FindAppNotHealthyOrRestartCountGreaterThanN("devflight", 10)
|
||||
@@ -33,9 +39,19 @@ func TestFindDeploymentReplicasSmallerThanN(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
func TestGetCmiiAllDeploymentFromEnv(t *testing.T) {
|
||||
func TestFindCmiiMiddlewarePodInterface(t *testing.T) {
|
||||
middlewarePodInterface := FindCmiiMiddlewarePodInterface(devFlight)
|
||||
|
||||
BackupAllDeploymentFromEnv("uavms")
|
||||
for _, middlePod := range middlewarePodInterface {
|
||||
println()
|
||||
utils.BeautifulPrint(middlePod)
|
||||
println()
|
||||
}
|
||||
}
|
||||
|
||||
func TestBackupAllDeploymentFromEnv(t *testing.T) {
|
||||
|
||||
BackupAllDeploymentFromEnv("demo")
|
||||
|
||||
}
|
||||
|
||||
@@ -47,20 +63,6 @@ func TestBackupAllCmiiDeploymentToMap(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
func TestUpdateCmiiDeploymentImageTag(t *testing.T) {
|
||||
|
||||
cmiiEnv := "demo"
|
||||
appName := "cmii-uav-platform"
|
||||
newTag := "5.2.0-011201"
|
||||
|
||||
tag := UpdateCmiiDeploymentImageTag(cmiiEnv, appName, newTag)
|
||||
assert.Equal(t, tag, true, "update image tag failed !")
|
||||
|
||||
check := CmiiOperator.DeploymentStatusCheck(cmiiEnv, appName, 180)
|
||||
assert.Equal(t, check, true, "deployment run failed!")
|
||||
|
||||
}
|
||||
|
||||
func TestRollBackCmiiDeploymentFromUpdateLog(t *testing.T) {
|
||||
updateLog := RollBackCmiiDeploymentFromUpdateLog("2024-01-10-14-37-07 uavcloud-devflight cmii-uav-depotautoreturn 12345678 123sdsa45678")
|
||||
|
||||
@@ -69,19 +71,21 @@ func TestRollBackCmiiDeploymentFromUpdateLog(t *testing.T) {
|
||||
|
||||
func TestRestartCmiiBackendDeployment(t *testing.T) {
|
||||
|
||||
RestartCmiiBackendDeployment("test")
|
||||
RestartCmiiBackendDeployment("dev")
|
||||
}
|
||||
|
||||
func TestRestartCmiiFrontendDeployment(t *testing.T) {
|
||||
RestartCmiiFrontendDeployment("devflight")
|
||||
RestartCmiiFrontendDeployment("dev")
|
||||
}
|
||||
|
||||
func TestFindDeploymentNotHealthy(t *testing.T) {
|
||||
notHealthy := FindDeploymentNotHealthy("devflight")
|
||||
|
||||
notHealthy = FilterAllCmiiAppSoft(notHealthy)
|
||||
for _, deploymentInterface := range notHealthy {
|
||||
utils.BeautifulPrint(deploymentInterface)
|
||||
for _, devNamespace := range CmiiDevNamespaceList {
|
||||
notHealthy := FindDeploymentNotHealthy(devNamespace)
|
||||
notHealthy = FilterAllCmiiAppSoft(notHealthy)
|
||||
for _, deploymentInterface := range notHealthy {
|
||||
utils.BeautifulPrint(deploymentInterface)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +95,10 @@ func TestFindAllNodeNotHealthy(t *testing.T) {
|
||||
elapsed := time.Since(start).Milliseconds()
|
||||
fmt.Printf("执行耗时: %d ms\n", elapsed)
|
||||
|
||||
allNodeNotHealthy = FilterAllCmiiNodeSoft(allNodeNotHealthy)
|
||||
|
||||
assert.Equal(t, len(allNodeNotHealthy), 0, "have unhealthy pod !")
|
||||
|
||||
for _, nodeInterface := range allNodeNotHealthy {
|
||||
println()
|
||||
utils.BeautifulPrint(nodeInterface)
|
||||
@@ -100,7 +108,8 @@ func TestFindAllNodeNotHealthy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFindPodNotHealthy(t *testing.T) {
|
||||
podNotHealthy := FindPodNotHealthy("valida")
|
||||
|
||||
podNotHealthy := FindPodNotHealthy("devfl")
|
||||
podNotHealthy = FilterAllCmiiPodSoft(podNotHealthy)
|
||||
|
||||
for _, podInterface := range podNotHealthy {
|
||||
@@ -109,7 +118,7 @@ func TestFindPodNotHealthy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFindPodNotHealthy_And_Delete(t *testing.T) {
|
||||
podNotHealthy := FindPodNotHealthy("uavms")
|
||||
podNotHealthy := FindPodNotHealthy("devf")
|
||||
podNotHealthy = FilterAllCmiiPodSoft(podNotHealthy)
|
||||
|
||||
for _, podInterface := range podNotHealthy {
|
||||
@@ -133,3 +142,89 @@ func TestRestartDeploymentFromList(t *testing.T) {
|
||||
RestartDeploymentFromList(allInterface)
|
||||
|
||||
}
|
||||
|
||||
func TestUpdateCmiiImageTagFromNameTagMap(t *testing.T) {
|
||||
|
||||
cmii530BackendMap := map[string]string{
|
||||
"cmii-admin-data": "5.3.0",
|
||||
"cmii-admin-gateway": "5.3.0",
|
||||
"cmii-admin-user": "5.3.0",
|
||||
"cmii-open-gateway": "5.3.0",
|
||||
"cmii-suav-supervision": "5.3.0",
|
||||
"cmii-uav-airspace": "5.3.0",
|
||||
"cmii-uav-alarm": "5.3.0",
|
||||
"cmii-uav-brain": "5.3.0",
|
||||
"cmii-uav-cloud-live": "5.3.0",
|
||||
"cmii-uav-cms": "5.3.0",
|
||||
"cmii-uav-data-post-process": "5.3.0",
|
||||
"cmii-uav-developer": "5.3.0",
|
||||
"cmii-uav-device": "5.3.0",
|
||||
"cmii-uav-emergency": "5.3.0",
|
||||
"cmii-uav-gateway": "5.3.0",
|
||||
"cmii-uav-gis-server": "5.3.0",
|
||||
"cmii-uav-industrial-portfolio": "5.3.0",
|
||||
"cmii-uav-integration": "5.3.0",
|
||||
"cmii-uav-logger": "5.3.0",
|
||||
"cmii-uav-material-warehouse": "5.3.0",
|
||||
"cmii-uav-mission": "5.3.0",
|
||||
"cmii-uav-mqtthandler": "5.3.0",
|
||||
"cmii-uav-notice": "5.3.0",
|
||||
"cmii-uav-oauth": "5.3.0",
|
||||
"cmii-uav-process": "5.3.0",
|
||||
"cmii-uav-surveillance": "5.3.0",
|
||||
"cmii-uav-threedsimulation": "5.3.0",
|
||||
"cmii-uav-tower": "5.3.0",
|
||||
"cmii-uav-user": "5.3.0",
|
||||
"cmii-uav-waypoint": "5.3.0",
|
||||
//"cmii-uav-grid-datasource": "5.2.0-24810",
|
||||
//"cmii-uav-grid-engine": "5.1.0",
|
||||
//"cmii-uav-grid-manage": "5.1.0",
|
||||
}
|
||||
|
||||
cmii530FrontendMap := map[string]string{
|
||||
"cmii-suav-platform-supervision": "5.3.0",
|
||||
"cmii-suav-platform-supervisionh5": "5.3.0",
|
||||
"cmii-uav-platform": "5.3.0",
|
||||
"cmii-uav-platform-ai-brain": "5.3.0",
|
||||
"cmii-uav-platform-armypeople": "5.3.0",
|
||||
"cmii-uav-platform-base": "5.3.0",
|
||||
"cmii-uav-platform-cms-portal": "5.3.0",
|
||||
"cmii-uav-platform-detection": "5.3.0",
|
||||
"cmii-uav-platform-emergency-rescue": "5.3.0",
|
||||
"cmii-uav-platform-logistics": "5.3.0",
|
||||
"cmii-uav-platform-media": "5.3.0",
|
||||
"cmii-uav-platform-multiterminal": "5.3.0",
|
||||
"cmii-uav-platform-mws": "5.3.0",
|
||||
"cmii-uav-platform-oms": "5.3.0",
|
||||
"cmii-uav-platform-open": "5.3.0",
|
||||
"cmii-uav-platform-securityh5": "5.3.0",
|
||||
"cmii-uav-platform-seniclive": "5.3.0",
|
||||
"cmii-uav-platform-share": "5.3.0",
|
||||
"cmii-uav-platform-splice": "5.3.0",
|
||||
"cmii-uav-platform-threedsimulation": "5.3.0",
|
||||
"cmii-uav-platform-visualization": "5.3.0",
|
||||
//"cmii-uav-platform-security": "4.1.6",
|
||||
}
|
||||
|
||||
result := UpdateCmiiImageTagFromNameTagMap("demo", cmii530BackendMap)
|
||||
utils.BeautifulPrint(result)
|
||||
|
||||
result = UpdateCmiiImageTagFromNameTagMap("demo", cmii530FrontendMap)
|
||||
utils.BeautifulPrint(result)
|
||||
|
||||
}
|
||||
|
||||
func TestUpdateCmiiDeploymentImageTag(t *testing.T) {
|
||||
|
||||
cmiiEnv := "test"
|
||||
appName := "cmii-suav-supervision"
|
||||
newTag := "5.2.0-0117"
|
||||
|
||||
tag := UpdateCmiiDeploymentImageTag(cmiiEnv, appName, newTag)
|
||||
assert.Equal(t, tag, true, "update image tag failed !")
|
||||
utils.SplitLinePrint()
|
||||
|
||||
check := CmiiOperator.DeploymentStatusCheck(cmiiEnv, appName, 180)
|
||||
assert.Equal(t, check, true, "deployment run failed!")
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"agent-go/logger"
|
||||
"agent-go/utils"
|
||||
"context"
|
||||
"k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/apps/v1"
|
||||
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -82,9 +82,9 @@ func (op *CmiiK8sOperator) changeOperatorEnv(cmiiEnv string) {
|
||||
}
|
||||
|
||||
if strings.Contains(cmiiEnv, "dev") {
|
||||
if strings.Contains(cmiiEnv, "f") {
|
||||
if strings.Contains(cmiiEnv, "devf") {
|
||||
op.CurrentNamespace = devFlight
|
||||
} else if strings.Contains(cmiiEnv, "o") {
|
||||
} else if strings.Contains(cmiiEnv, "devo") {
|
||||
op.CurrentNamespace = devOperation
|
||||
} else {
|
||||
op.CurrentNamespace = dev
|
||||
@@ -419,6 +419,15 @@ func (op *CmiiK8sOperator) DeploymentRestartByKill(cmiiEnv, appName string) bool
|
||||
return true
|
||||
}
|
||||
|
||||
func (op *CmiiK8sOperator) DeploymentNew(cmiiEnv, appName string, waitTimeOut int) bool {
|
||||
|
||||
op.changeOperatorEnv(cmiiEnv)
|
||||
//op.CurrentClient.AppsV1().Deployments(op.CurrentNamespace).Apply()
|
||||
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
func (op *CmiiK8sOperator) DeploymentStatusCheck(cmiiEnv, appName string, waitTimeOut int) bool {
|
||||
|
||||
op.changeOperatorEnv(cmiiEnv)
|
||||
|
||||
@@ -93,12 +93,17 @@ func TestCmiiK8sOperator_DeploymentRestart(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCmiiK8sOperator_DeploymentRestartByKill(t *testing.T) {
|
||||
cmiiEnv := "int"
|
||||
appName := "cmii-suav-supervision"
|
||||
cmiiEnv := "demo"
|
||||
appName := "cmii-uav-platform"
|
||||
|
||||
kill := CmiiOperator.DeploymentRestartByKill(cmiiEnv, appName)
|
||||
assert.Equal(t, kill, true, "deployment restart by kill failed !")
|
||||
|
||||
utils.SplitLinePrint()
|
||||
|
||||
check := CmiiOperator.DeploymentStatusCheck(cmiiEnv, appName, 180)
|
||||
assert.Equal(t, check, true, "deployment run failed!")
|
||||
|
||||
}
|
||||
|
||||
func TestCmiiK8sOperator_DeploymentOneInterface(t *testing.T) {
|
||||
|
||||
@@ -16,3 +16,10 @@
|
||||
2024-01-12-12-09-59 uavcloud-uavms uavms-lowaltitude-platform 5.2.0-011201 5.2.0-011202
|
||||
2024-01-12-17-13-32 uavcloud-test cmii-suav-supervision 5.2.0-011001 5.2.0-011201
|
||||
2024-01-12-17-22-47 uavcloud-demo cmii-uav-platform 5.2.0-011102 5.2.0-011201
|
||||
2024-01-15-11-56-33 uavcloud-test cmii-suav-supervision 5.2.0-011201 5.2.0-011501
|
||||
2024-01-16-10-22-02 uavcloud-test cmii-suav-supervision 5.2.0-011501 5.2.0-011601
|
||||
2024-01-16-11-40-31 uavcloud-uavms uavms-lowaltitude-platform 5.2.0-011202 5.2.0-snapshot
|
||||
2024-01-16-11-58-30 uavcloud-test cmii-suav-supervision 5.2.0-011601 5.2.0-011602
|
||||
2024-01-16-13-55-32 uavcloud-test cmii-suav-supervision 5.2.0-011602 5.2.0-011603
|
||||
2024-01-16-14-51-05 uavcloud-test cmii-suav-supervision 5.2.0-011603 5.2.0-011604
|
||||
2024-01-17-16-13-39 uavcloud-test cmii-suav-supervision 5.2.0-011604 5.2.0-0117
|
||||
|
||||
Reference in New Issue
Block a user