Skip to content

Commit 54dbf46

Browse files
authored
Merge pull request #44 from BetaCat0/fix/http-tunnel-cluster-mode
fix: http tunnel in cluster mode
2 parents d7695c5 + 7ff1791 commit 54dbf46

5 files changed

Lines changed: 14 additions & 8 deletions

File tree

cmd/module-controller/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ func main() {
8686

8787
// Get configuration from environment variables
8888
clientID := utils.GetEnv(model.EnvKeyOfClientID, uuid.New().String())
89+
if _, ok := os.LookupEnv(model.EnvKeyOfClientID); !ok {
90+
log.L.Infof("Randomly generated client ID: %s", clientID)
91+
}
8992
env := utils.GetEnv("ENV", "dev")
9093

9194
zlogger := zaplogger.GetLogger()

common/utils/utils.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package utils
33
import (
44
"context"
55
"fmt"
6-
"github.com/koupleless/module_controller/common/zaplogger"
76
"strconv"
87
"strings"
98
"time"
109

10+
"github.com/koupleless/module_controller/common/zaplogger"
11+
1112
"github.com/koupleless/arkctl/common/fileutil"
1213
"github.com/koupleless/arkctl/v1/service/ark"
1314
"github.com/koupleless/module_controller/common/model"
@@ -112,6 +113,7 @@ func ConvertHealthDataToNodeStatus(data ark.HealthData) vkModel.NodeStatusData {
112113
resourceMap[corev1.ResourceMemory] = memory
113114
return vkModel.NodeStatusData{
114115
Resources: resourceMap,
116+
NodeState: vkModel.NodeState(strings.ToUpper(data.MasterBizInfo.BizState)),
115117
}
116118
}
117119

@@ -133,7 +135,7 @@ func TranslateBizInfosToContainerStatuses(data []ark.ArkBizInfo, changeTimestamp
133135
Key: GetBizIdentity(bizInfo.BizName, bizInfo.BizVersion),
134136
Name: bizInfo.BizName,
135137
// fille PodKey when using
136-
//PodKey: vkModel.PodKeyAll,
138+
// PodKey: vkModel.PodKeyAll,
137139
State: bizInfo.BizState,
138140
// TODO: 需要使用实际 bizState 变化的时间,而非心跳时间
139141
ChangeTime: time.UnixMilli(changeTimestamp),

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/go-resty/resty/v2 v2.11.0
1111
github.com/google/uuid v1.6.0
1212
github.com/koupleless/arkctl v0.2.4-0.20250106035535-5ed5cb871995
13-
github.com/koupleless/virtual-kubelet v0.3.9
13+
github.com/koupleless/virtual-kubelet v0.3.10
1414
github.com/onsi/ginkgo/v2 v2.19.0
1515
github.com/onsi/gomega v1.33.1
1616
github.com/sirupsen/logrus v1.9.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2
102102
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
103103
github.com/koupleless/arkctl v0.2.4-0.20250106035535-5ed5cb871995 h1:dkBdI/WczkOJ4LaoZteX3uz8r+WKxBqYQjpzwyVDvyw=
104104
github.com/koupleless/arkctl v0.2.4-0.20250106035535-5ed5cb871995/go.mod h1:nbnAiPEv7x/ZDQ+QsjFWkqwxMDofGmqnFPHa3XpXHyE=
105-
github.com/koupleless/virtual-kubelet v0.3.9 h1:7O+unpomhxiLvgF4R856p4YUVr10rtz27zhxRylgJuM=
106-
github.com/koupleless/virtual-kubelet v0.3.9/go.mod h1:V/RjXRvoSNr55I9KMV+tgtOp6duxxBMcwyDTH04XiX0=
105+
github.com/koupleless/virtual-kubelet v0.3.10 h1:2hCYTHrsfQRe8jTwYGvFz+Ag4kpEn2wkcxfT4tLpoPg=
106+
github.com/koupleless/virtual-kubelet v0.3.10/go.mod h1:V/RjXRvoSNr55I9KMV+tgtOp6duxxBMcwyDTH04XiX0=
107107
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
108108
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
109109
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=

module_tunnels/koupleless_http_tunnel/http_tunnel.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7-
"github.com/koupleless/module_controller/common/zaplogger"
8-
"github.com/koupleless/module_controller/controller/module_deployment_controller"
9-
utils2 "github.com/koupleless/virtual-kubelet/common/utils"
107
"net/http"
118
"sync"
129
"time"
1310

1411
"errors"
1512

13+
"github.com/koupleless/module_controller/common/zaplogger"
14+
"github.com/koupleless/module_controller/controller/module_deployment_controller"
15+
utils2 "github.com/koupleless/virtual-kubelet/common/utils"
16+
1617
"github.com/koupleless/arkctl/v1/service/ark"
1718
"github.com/koupleless/module_controller/common/model"
1819
"github.com/koupleless/module_controller/common/utils"

0 commit comments

Comments
 (0)