[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 !strings.HasSuffix(localGzipFolderOrGzipFile, ".tar.gz") {
|
||||
log.ErrorF("local gzip file %s is not a .tar.gz file !", localGzipFolderOrGzipFile)
|
||||
return nil
|
||||
@@ -201,22 +201,23 @@ func DownloadLoadTagUpload(downloadFromOss bool, ossUrlPrefix, ossFileName, loca
|
||||
|
||||
// load
|
||||
image.LoadFromGzipFilePath(localGzipFolderOrGzipFile)
|
||||
}
|
||||
|
||||
separator := os.PathSeparator
|
||||
if !strings.HasSuffix(localGzipFolderOrGzipFile, string(separator)) {
|
||||
localGzipFolderOrGzipFile += string(separator)
|
||||
}
|
||||
|
||||
// download
|
||||
if downloadFromOss {
|
||||
if !parseAndDownloadFromOss(ossUrlPrefix, ossFileName, localGzipFolderOrGzipFile) {
|
||||
log.ErrorF("download from oss error !")
|
||||
return nil
|
||||
} else {
|
||||
separator := os.PathSeparator
|
||||
if !strings.HasSuffix(localGzipFolderOrGzipFile, string(separator)) {
|
||||
localGzipFolderOrGzipFile += string(separator)
|
||||
}
|
||||
|
||||
// download
|
||||
if downloadFromOss {
|
||||
if !parseAndDownloadFromOss(ossUrlPrefix, ossFileName, localGzipFolderOrGzipFile) {
|
||||
log.ErrorF("download from oss error !")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// load
|
||||
loadAllGzipImageFromLocalFolder(localGzipFolderOrGzipFile)
|
||||
}
|
||||
// load
|
||||
loadAllGzipImageFromLocalFolder(localGzipFolderOrGzipFile)
|
||||
|
||||
// tag
|
||||
// push
|
||||
|
||||
@@ -387,6 +387,7 @@ func (op *CmiiK8sOperator) DeploymentScale(cmiiEnv, appName string, scaleCount i
|
||||
return true
|
||||
}
|
||||
func (op *CmiiK8sOperator) DeploymentUpdateTagByImageFullName(cmiiEnv, imageFullName string) bool {
|
||||
// todo
|
||||
|
||||
split := strings.Split(imageFullName, ":")
|
||||
// harbor
|
||||
|
||||
@@ -211,6 +211,7 @@ func UploadToHarbor(targetImageName string) (uploadOK bool) {
|
||||
fmt.Println()
|
||||
log.InfoF("[UploadToHarbor] - upload %s success!", targetImageName)
|
||||
fmt.Println()
|
||||
return true
|
||||
}
|
||||
|
||||
// TagFromListAndPushToCHarbor 需要支持 harbor.cdcyy.cn ip:8033 rancher/rancher:v2.5.7 nginx:latest
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
"wdd.io/agent-common/utils"
|
||||
"wdd.io/agent-operator/real_project/bgtg"
|
||||
)
|
||||
|
||||
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 linux/arm64" -output "build/agent-operator_{{.OS}}_{{.Arch}}"
|
||||
|
||||
func RealProjectRunner() {
|
||||
func BuildDefaultK8sOperator() {
|
||||
|
||||
// build from local LocalKubeConfigFile
|
||||
if !utils.FileExists(LocalKubeConfigFile) {
|
||||
log.ErrorF("%s not exits! error!", LocalKubeConfigFile)
|
||||
@@ -29,18 +29,19 @@ func RealProjectRunner() {
|
||||
return
|
||||
}
|
||||
|
||||
realNamespace := "bjtg"
|
||||
|
||||
op := CmiiK8sOperator{}
|
||||
op.BuildCurrentClientFromConfig(readFile)
|
||||
DefaultCmiiOperator = op
|
||||
}
|
||||
|
||||
func RealProjectRunner() {
|
||||
|
||||
// ops
|
||||
|
||||
// update
|
||||
result := UpdateCmiiImageTagFromNameTagList(realNamespace, bgtg.AllCmiiImageTagList)
|
||||
//result := UpdateCmiiImageTagFromNameTagList(realNamespace, bgtg.AllCmiiImageTagList)
|
||||
//result := UpdateCmiiImageTagFromNameTagMap(realNamespace, xmyd.Real540ImageTagMap)
|
||||
utils.BeautifulPrint(result)
|
||||
//utils.BeautifulPrint(result)
|
||||
|
||||
//for _, imageFullName := range xmyd.AllCmiiImageTagList {
|
||||
// appName := image.ImageFullNameToAppName(imageFullName)
|
||||
@@ -92,6 +93,8 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
if mode == "image" {
|
||||
|
||||
BuildDefaultK8sOperator()
|
||||
// 堡垒机模式 的 镜像美容
|
||||
// 初始化堡垒机模式
|
||||
for {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class TestImageSyncScheduler {
|
||||
ArrayList<String> ImageFullNameList = new ArrayList<>(List.of(
|
||||
// "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-uav-platform:5.3.0-cqly-042601"
|
||||
"harbor.cdcyy.com.cn/cmii/cmii-uav-developer:5.4.0-cqly-042801"
|
||||
));
|
||||
|
||||
Boolean downloadAndCompressOnly = false;
|
||||
@@ -102,7 +102,7 @@ public class TestImageSyncScheduler {
|
||||
));
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user