File tree Expand file tree Collapse file tree 1 file changed +33
-2
lines changed Expand file tree Collapse file tree 1 file changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package types
18
18
19
19
import (
20
20
"fmt"
21
+ "os"
21
22
"sort"
22
23
"strconv"
23
24
"strings"
@@ -38,12 +39,42 @@ const (
38
39
ContainerdService = "containerd"
39
40
KubeProxyComponent = "kube-proxy"
40
41
42
+ LogPatternFlagSeparator = ":"
43
+
44
+ nodeEnvKey = "HOST_IP"
45
+ kubeletPort = "KUBELET_PORT"
46
+ kubeProxyPort = "KUBEPROXY_PORT"
47
+ )
48
+
49
+ var (
41
50
KubeletHealthCheckEndpoint = "http://127.0.0.1:10248/healthz"
42
51
KubeProxyHealthCheckEndpoint = "http://127.0.0.1:10256/healthz"
43
-
44
- LogPatternFlagSeparator = ":"
45
52
)
46
53
54
+ func init () {
55
+ var o string
56
+
57
+ hostIP := "127.0.0.1"
58
+ kubeletPort := "10248"
59
+ kubeProxyPort := "10256"
60
+
61
+ o = os .Getenv (nodeEnvKey )
62
+ if o != "" {
63
+ hostIP = o
64
+ }
65
+ o = os .Getenv (kubeletPort )
66
+ if o != "" {
67
+ kubeletPort = o
68
+ }
69
+ o = os .Getenv (kubeProxyPort )
70
+ if o != "" {
71
+ kubeProxyPort = o
72
+ }
73
+
74
+ KubeletHealthCheckEndpoint = fmt .Sprintf ("http://%s:%s/healthz" , hostIP , kubeletPort )
75
+ KubeProxyHealthCheckEndpoint = fmt .Sprintf ("http://%s:%s/healthz" , hostIP , kubeProxyPort )
76
+ }
77
+
47
78
type HealthChecker interface {
48
79
CheckHealth () (bool , error )
49
80
}
You can’t perform that action at this time.
0 commit comments