[agent-operator] - update cmii update function
This commit is contained in:
@@ -193,7 +193,7 @@ func DownloadLoadTagUpload(downloadFromOss bool, ossUrlPrefix, ossFileName, loca
|
|||||||
|
|
||||||
// 支持单文件的形式
|
// 支持单文件的形式
|
||||||
if !utils.IsFileOrDir(localGzipFolderOrGzipFile) {
|
if !utils.IsFileOrDir(localGzipFolderOrGzipFile) {
|
||||||
// 单个压缩文件
|
// 单个压缩文件 肯定是离线的形式
|
||||||
if !strings.HasSuffix(localGzipFolderOrGzipFile, ".tar.gz") {
|
if !strings.HasSuffix(localGzipFolderOrGzipFile, ".tar.gz") {
|
||||||
log.ErrorF("local gzip file %s is not a .tar.gz file !", localGzipFolderOrGzipFile)
|
log.ErrorF("local gzip file %s is not a .tar.gz file !", localGzipFolderOrGzipFile)
|
||||||
return nil
|
return nil
|
||||||
@@ -201,8 +201,7 @@ func DownloadLoadTagUpload(downloadFromOss bool, ossUrlPrefix, ossFileName, loca
|
|||||||
|
|
||||||
// load
|
// load
|
||||||
image.LoadFromGzipFilePath(localGzipFolderOrGzipFile)
|
image.LoadFromGzipFilePath(localGzipFolderOrGzipFile)
|
||||||
}
|
} else {
|
||||||
|
|
||||||
separator := os.PathSeparator
|
separator := os.PathSeparator
|
||||||
if !strings.HasSuffix(localGzipFolderOrGzipFile, string(separator)) {
|
if !strings.HasSuffix(localGzipFolderOrGzipFile, string(separator)) {
|
||||||
localGzipFolderOrGzipFile += string(separator)
|
localGzipFolderOrGzipFile += string(separator)
|
||||||
@@ -215,8 +214,10 @@ func DownloadLoadTagUpload(downloadFromOss bool, ossUrlPrefix, ossFileName, loca
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// load
|
// load
|
||||||
loadAllGzipImageFromLocalFolder(localGzipFolderOrGzipFile)
|
loadAllGzipImageFromLocalFolder(localGzipFolderOrGzipFile)
|
||||||
|
}
|
||||||
|
|
||||||
// tag
|
// tag
|
||||||
// push
|
// push
|
||||||
|
|||||||
@@ -387,6 +387,7 @@ func (op *CmiiK8sOperator) DeploymentScale(cmiiEnv, appName string, scaleCount i
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
func (op *CmiiK8sOperator) DeploymentUpdateTagByImageFullName(cmiiEnv, imageFullName string) bool {
|
func (op *CmiiK8sOperator) DeploymentUpdateTagByImageFullName(cmiiEnv, imageFullName string) bool {
|
||||||
|
// todo
|
||||||
|
|
||||||
split := strings.Split(imageFullName, ":")
|
split := strings.Split(imageFullName, ":")
|
||||||
// harbor
|
// harbor
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ func UploadToHarbor(targetImageName string) (uploadOK bool) {
|
|||||||
fmt.Println()
|
fmt.Println()
|
||||||
log.InfoF("[UploadToHarbor] - upload %s success!", targetImageName)
|
log.InfoF("[UploadToHarbor] - upload %s success!", targetImageName)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// TagFromListAndPushToCHarbor 需要支持 harbor.cdcyy.cn ip:8033 rancher/rancher:v2.5.7 nginx:latest
|
// TagFromListAndPushToCHarbor 需要支持 harbor.cdcyy.cn ip:8033 rancher/rancher:v2.5.7 nginx:latest
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"wdd.io/agent-common/utils"
|
"wdd.io/agent-common/utils"
|
||||||
"wdd.io/agent-operator/real_project/bgtg"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var LocalKubeConfigFile = "/root/.kube/config"
|
var LocalKubeConfigFile = "/root/.kube/config"
|
||||||
@@ -16,7 +15,8 @@ var LocalKubeConfigFile = "/root/.kube/config"
|
|||||||
// C:\Users\wddsh\go\bin\gox.exe -osarch="linux/amd64" -output "build/agent-operator_{{.OS}}_{{.Arch}}"
|
// C:\Users\wddsh\go\bin\gox.exe -osarch="linux/amd64" -output "build/agent-operator_{{.OS}}_{{.Arch}}"
|
||||||
// C:\Users\wddsh\go\bin\gox.exe -osarch="linux/amd64 linux/arm64" -output "build/agent-operator_{{.OS}}_{{.Arch}}"
|
// C:\Users\wddsh\go\bin\gox.exe -osarch="linux/amd64 linux/arm64" -output "build/agent-operator_{{.OS}}_{{.Arch}}"
|
||||||
|
|
||||||
func RealProjectRunner() {
|
func BuildDefaultK8sOperator() {
|
||||||
|
|
||||||
// build from local LocalKubeConfigFile
|
// build from local LocalKubeConfigFile
|
||||||
if !utils.FileExists(LocalKubeConfigFile) {
|
if !utils.FileExists(LocalKubeConfigFile) {
|
||||||
log.ErrorF("%s not exits! error!", LocalKubeConfigFile)
|
log.ErrorF("%s not exits! error!", LocalKubeConfigFile)
|
||||||
@@ -29,18 +29,19 @@ func RealProjectRunner() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
realNamespace := "bjtg"
|
|
||||||
|
|
||||||
op := CmiiK8sOperator{}
|
op := CmiiK8sOperator{}
|
||||||
op.BuildCurrentClientFromConfig(readFile)
|
op.BuildCurrentClientFromConfig(readFile)
|
||||||
DefaultCmiiOperator = op
|
DefaultCmiiOperator = op
|
||||||
|
}
|
||||||
|
|
||||||
|
func RealProjectRunner() {
|
||||||
|
|
||||||
// ops
|
// ops
|
||||||
|
|
||||||
// update
|
// update
|
||||||
result := UpdateCmiiImageTagFromNameTagList(realNamespace, bgtg.AllCmiiImageTagList)
|
//result := UpdateCmiiImageTagFromNameTagList(realNamespace, bgtg.AllCmiiImageTagList)
|
||||||
//result := UpdateCmiiImageTagFromNameTagMap(realNamespace, xmyd.Real540ImageTagMap)
|
//result := UpdateCmiiImageTagFromNameTagMap(realNamespace, xmyd.Real540ImageTagMap)
|
||||||
utils.BeautifulPrint(result)
|
//utils.BeautifulPrint(result)
|
||||||
|
|
||||||
//for _, imageFullName := range xmyd.AllCmiiImageTagList {
|
//for _, imageFullName := range xmyd.AllCmiiImageTagList {
|
||||||
// appName := image.ImageFullNameToAppName(imageFullName)
|
// appName := image.ImageFullNameToAppName(imageFullName)
|
||||||
@@ -92,6 +93,8 @@ func main() {
|
|||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if mode == "image" {
|
if mode == "image" {
|
||||||
|
|
||||||
|
BuildDefaultK8sOperator()
|
||||||
// 堡垒机模式 的 镜像美容
|
// 堡垒机模式 的 镜像美容
|
||||||
// 初始化堡垒机模式
|
// 初始化堡垒机模式
|
||||||
for {
|
for {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class TestImageSyncScheduler {
|
|||||||
ArrayList<String> ImageFullNameList = new ArrayList<>(List.of(
|
ArrayList<String> ImageFullNameList = new ArrayList<>(List.of(
|
||||||
// "harbor.cdcyy.com.cn/cmii/cmii-live-operator:5.2.0",
|
// "harbor.cdcyy.com.cn/cmii/cmii-live-operator:5.2.0",
|
||||||
// "harbor.cdcyy.com.cn/cmii/cmii/srs:v5.0.195"
|
// "harbor.cdcyy.com.cn/cmii/cmii/srs:v5.0.195"
|
||||||
"harbor.cdcyy.com.cn/cmii/cmii-uav-platform:5.3.0-cqly-042601"
|
"harbor.cdcyy.com.cn/cmii/cmii-uav-developer:5.4.0-cqly-042801"
|
||||||
));
|
));
|
||||||
|
|
||||||
Boolean downloadAndCompressOnly = false;
|
Boolean downloadAndCompressOnly = false;
|
||||||
@@ -102,7 +102,7 @@ public class TestImageSyncScheduler {
|
|||||||
));
|
));
|
||||||
|
|
||||||
ArrayList<String> ImageFullNameList = new ArrayList<>(List.of(
|
ArrayList<String> ImageFullNameList = new ArrayList<>(List.of(
|
||||||
"harbor.cdcyy.com.cn/cmii/cmii-uav-industrial-portfolio:5.4.0-cqly-032802"
|
"harbor.cdcyy.com.cn/cmii/cmii-uav-industrial-portfolio:5.4.0-cqly-042801"
|
||||||
));
|
));
|
||||||
|
|
||||||
Boolean downloadAndCompressOnly = true;
|
Boolean downloadAndCompressOnly = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user