[ Cmii ] [ Octopus ] - 实际项目

This commit is contained in:
zeaslity
2024-03-20 11:28:19 +08:00
committed by zeaslity
parent 6b4616690c
commit 8e6f09d522
34 changed files with 350 additions and 537 deletions

View File

@@ -1,4 +1,4 @@
package agent_operator
package main
import (
"bytes"
@@ -82,6 +82,11 @@ func (op *CmiiK8sOperator) changeOperatorEnv(cmiiEnv string) {
// ok
op.checkAndBuildCmiiK8sOperator()
// speed up
if op.CurrentNamespace == cmiiEnv {
return
}
// first key
op.CurrentNamespace = ""
@@ -131,9 +136,9 @@ func (op *CmiiK8sOperator) changeOperatorEnv(cmiiEnv string) {
log.InfoF("[k8s env] - current env is => %s", op.CurrentNamespace)
}
func (op *CmiiK8sOperator) BuildCurrentClientFromConfig(realClientConfig string) {
func (op *CmiiK8sOperator) BuildCurrentClientFromConfig(realClientConfig []byte) {
log.InfoF("[BuildCurrentClientFromConfig] - build real k8s operator client !")
realEnvConfig, err := clientcmd.RESTConfigFromKubeConfig([]byte(realClientConfig))
realEnvConfig, err := clientcmd.RESTConfigFromKubeConfig(realClientConfig)
if err != nil {
msg := "[BuildCurrentClientFromConfig] - build real k8s operator error !"
log.Error(msg)