You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kube-apisvr addr in configmap yurt-static-set-yurt-hub will be set to https://1.2.3.4:6443, then if we join edge node with yurtadm join {{https://external_ip:6443}}, will not change kube-apisvr-addr from 1.2.3.4:6443 to external_ip:6443
// useRealServerAddr check if the server-addr from yurthubTemplate is default value: 127.0.0.1:6443
// if yes, we should use the real server addr
func useRealServerAddr(yurthubTemplate string, kubernetesServerAddrs string) (string, error) {
scanner := bufio.NewScanner(bytes.NewReader([]byte(yurthubTemplate)))
var buffer bytes.Buffer
target := fmt.Sprintf("%v=%v", constants.ServerAddr, constants.DefaultServerAddr)
for scanner.Scan() {
line := scanner.Text()
if strings.Contains(line, target) {
line = strings.Replace(line, constants.DefaultServerAddr, kubernetesServerAddrs, -1)
}
buffer.WriteString(line + "\n")
}
What you expected to happen:
in my POV, we install yurthub in cloud node first(usually by internal ip like 172.0.0.11), then we join cloud node by yurtadm join {internal_ip}, last we join edge node by yurtadm join {external_ip}, so ip should always be overwritten since it will not be 127.0.0.1 by helm install by 172.0.0.11
here is my solution:
func useRealServerAddr(yurthubTemplate string, kubernetesServerAddrs string) (string, error) {
scanner := bufio.NewScanner(bytes.NewReader([]byte(yurthubTemplate)))
var buffer bytes.Buffer
// compile ipv4 regex
ipRegex := regexp.MustCompile(`https?://(?:[0-9]{1,3}\.){3}[0-9]{1,3}:\d+`)
// scan template and replace setAddr
for scanner.Scan() {
line := scanner.Text()
if strings.Contains(line, fmt.Sprintf("- --%s=", constants.ServerAddr)) {
// replace kubernetesServerAddrs by new addr
line = ipRegex.ReplaceAllString(line, kubernetesServerAddrs)
}
buffer.WriteString(line + "\n")
}
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
OpenYurt version: 1.5.0
Kubernetes version (use kubectl version): 1.31
OS (e.g: cat /etc/os-release): debian12
Kernel (e.g. uname -a): 6.1.119-1 (2024-11-22)
Install tools:
Others:
others
/kind bug
The text was updated successfully, but these errors were encountered:
What happened:
by installing yurthub by doc: https://openyurt.io/zh/docs/installation/manually-setup#32-%E5%AE%89%E8%A3%85-yurthub-%E7%9B%B8%E5%85%B3%E9%85%8D%E7%BD%AE
helm upgrade --install yurt-hub -n kube-system --set kubernetesServerAddr=https://1.2.3.4:6443 openyurt/yurthub
kube-apisvr addr in configmap
yurt-static-set-yurt-hub
will be set to https://1.2.3.4:6443, then if we join edge node withyurtadm join {{https://external_ip:6443}}
, will not change kube-apisvr-addr from 1.2.3.4:6443 to external_ip:6443according to the func
useRealServerAddr
, only https://127.0.0.1:6443(constants.DefaultServerAddr) will be overwrite by yurtadm join command, if we set it before(by helm install), nothing will changedWhat you expected to happen:
in my POV, we install yurthub in cloud node first(usually by internal ip like 172.0.0.11), then we join cloud node by
yurtadm join {internal_ip}
, last we join edge node byyurtadm join {external_ip}
, so ip should always be overwritten since it will not be127.0.0.1
by helm install by172.0.0.11
here is my solution:
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
kubectl version
): 1.31cat /etc/os-release
): debian12uname -a
): 6.1.119-1 (2024-11-22)others
/kind bug
The text was updated successfully, but these errors were encountered: