package main import ( "os" "wdd.io/agent-common/utils" ) var LocalKubeConfigFile = "/root/.kube/config" // build for offline usage // 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 main() { // build from local LocalKubeConfigFile if !utils.FileExists(LocalKubeConfigFile) { log.ErrorF("%s not exits! error!") return } readFile, err := os.ReadFile(LocalKubeConfigFile) if err != nil { log.ErrorF("error reading %s, error %s", LocalKubeConfigFile, err.Error()) return } realNamespace := "xmyd" op := CmiiK8sOperator{} op.BuildCurrentClientFromConfig(readFile) // ops // update //for _, imageFullName := range xmyd.AllCmiiImageTagList { // appName := image.ImageFullNameToAppName(imageFullName) // if appName == "" { // log.InfoF("can't update %s", imageFullName) // continue // } // exists := op.DeploymentExist(realNamespace, appName) // if exists == nil { // log.InfoF("app of %s not eixts", appName) // continue // } // // _ = op.DeploymentUpdateTag(realNamespace, appName, image.ImageFullNameToImageTag(imageFullName)) // //} // scale deployment CmiiOperator = op ScaleCmiiFrontendDeploymentToDesiredReplicas(realNamespace, 1) ScaleCmiiBackendDeploymentToDesiredReplicas(realNamespace, 1) }