diff --git a/cmd/module-controller/main.go b/cmd/module-controller/main.go index 720f442..eeaf010 100644 --- a/cmd/module-controller/main.go +++ b/cmd/module-controller/main.go @@ -86,6 +86,9 @@ func main() { // Get configuration from environment variables clientID := utils.GetEnv(model.EnvKeyOfClientID, uuid.New().String()) + if _, ok := os.LookupEnv(model.EnvKeyOfClientID); !ok { + log.L.Infof("Randomly generated client ID: %s", clientID) + } env := utils.GetEnv("ENV", "dev") zlogger := zaplogger.GetLogger() diff --git a/common/utils/utils.go b/common/utils/utils.go index f60d28a..cc17249 100644 --- a/common/utils/utils.go +++ b/common/utils/utils.go @@ -3,11 +3,12 @@ package utils import ( "context" "fmt" - "github.com/koupleless/module_controller/common/zaplogger" "strconv" "strings" "time" + "github.com/koupleless/module_controller/common/zaplogger" + "github.com/koupleless/arkctl/common/fileutil" "github.com/koupleless/arkctl/v1/service/ark" "github.com/koupleless/module_controller/common/model" @@ -112,6 +113,7 @@ func ConvertHealthDataToNodeStatus(data ark.HealthData) vkModel.NodeStatusData { resourceMap[corev1.ResourceMemory] = memory return vkModel.NodeStatusData{ Resources: resourceMap, + NodeState: vkModel.NodeState(strings.ToUpper(data.MasterBizInfo.BizState)), } } @@ -133,7 +135,7 @@ func TranslateBizInfosToContainerStatuses(data []ark.ArkBizInfo, changeTimestamp Key: GetBizIdentity(bizInfo.BizName, bizInfo.BizVersion), Name: bizInfo.BizName, // fille PodKey when using - //PodKey: vkModel.PodKeyAll, + // PodKey: vkModel.PodKeyAll, State: bizInfo.BizState, // TODO: 需要使用实际 bizState 变化的时间,而非心跳时间 ChangeTime: time.UnixMilli(changeTimestamp), diff --git a/go.mod b/go.mod index 08cad0c..ee405a2 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/go-resty/resty/v2 v2.11.0 github.com/google/uuid v1.6.0 github.com/koupleless/arkctl v0.2.4-0.20250106035535-5ed5cb871995 - github.com/koupleless/virtual-kubelet v0.3.9 + github.com/koupleless/virtual-kubelet v0.3.10 github.com/onsi/ginkgo/v2 v2.19.0 github.com/onsi/gomega v1.33.1 github.com/sirupsen/logrus v1.9.3 diff --git a/go.sum b/go.sum index 4cc90f1..8ec6b1f 100644 --- a/go.sum +++ b/go.sum @@ -102,8 +102,8 @@ github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2 github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/koupleless/arkctl v0.2.4-0.20250106035535-5ed5cb871995 h1:dkBdI/WczkOJ4LaoZteX3uz8r+WKxBqYQjpzwyVDvyw= github.com/koupleless/arkctl v0.2.4-0.20250106035535-5ed5cb871995/go.mod h1:nbnAiPEv7x/ZDQ+QsjFWkqwxMDofGmqnFPHa3XpXHyE= -github.com/koupleless/virtual-kubelet v0.3.9 h1:7O+unpomhxiLvgF4R856p4YUVr10rtz27zhxRylgJuM= -github.com/koupleless/virtual-kubelet v0.3.9/go.mod h1:V/RjXRvoSNr55I9KMV+tgtOp6duxxBMcwyDTH04XiX0= +github.com/koupleless/virtual-kubelet v0.3.10 h1:2hCYTHrsfQRe8jTwYGvFz+Ag4kpEn2wkcxfT4tLpoPg= +github.com/koupleless/virtual-kubelet v0.3.10/go.mod h1:V/RjXRvoSNr55I9KMV+tgtOp6duxxBMcwyDTH04XiX0= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= diff --git a/module_tunnels/koupleless_http_tunnel/http_tunnel.go b/module_tunnels/koupleless_http_tunnel/http_tunnel.go index b8dd371..2368fb1 100644 --- a/module_tunnels/koupleless_http_tunnel/http_tunnel.go +++ b/module_tunnels/koupleless_http_tunnel/http_tunnel.go @@ -4,15 +4,16 @@ import ( "context" "encoding/json" "fmt" - "github.com/koupleless/module_controller/common/zaplogger" - "github.com/koupleless/module_controller/controller/module_deployment_controller" - utils2 "github.com/koupleless/virtual-kubelet/common/utils" "net/http" "sync" "time" "errors" + "github.com/koupleless/module_controller/common/zaplogger" + "github.com/koupleless/module_controller/controller/module_deployment_controller" + utils2 "github.com/koupleless/virtual-kubelet/common/utils" + "github.com/koupleless/arkctl/v1/service/ark" "github.com/koupleless/module_controller/common/model" "github.com/koupleless/module_controller/common/utils"