未验证 提交 f6ebaa88 编写于 作者: M Medya Ghazizadeh 提交者: GitHub

Merge pull request #8820 from Dean-Coakley/fix-minikube-ip-errhandle

Fix handling of parseIP error
...@@ -17,6 +17,7 @@ limitations under the License. ...@@ -17,6 +17,7 @@ limitations under the License.
package driver package driver
import ( import (
"fmt"
"net" "net"
"k8s.io/minikube/pkg/drivers/kic/oci" "k8s.io/minikube/pkg/drivers/kic/oci"
...@@ -30,6 +31,9 @@ func ControlPlaneEndpoint(cc *config.ClusterConfig, cp *config.Node, driverName ...@@ -30,6 +31,9 @@ func ControlPlaneEndpoint(cc *config.ClusterConfig, cp *config.Node, driverName
port, err := oci.ForwardedPort(cc.Driver, cc.Name, cp.Port) port, err := oci.ForwardedPort(cc.Driver, cc.Name, cp.Port)
hostname := oci.DefaultBindIPV4 hostname := oci.DefaultBindIPV4
ip := net.ParseIP(hostname) ip := net.ParseIP(hostname)
if ip == nil {
return hostname, ip, port, fmt.Errorf("failed to parse ip for %q", hostname)
}
// https://github.com/kubernetes/minikube/issues/3878 // https://github.com/kubernetes/minikube/issues/3878
if cc.KubernetesConfig.APIServerName != constants.APIServerName { if cc.KubernetesConfig.APIServerName != constants.APIServerName {
...@@ -43,5 +47,9 @@ func ControlPlaneEndpoint(cc *config.ClusterConfig, cp *config.Node, driverName ...@@ -43,5 +47,9 @@ func ControlPlaneEndpoint(cc *config.ClusterConfig, cp *config.Node, driverName
if cc.KubernetesConfig.APIServerName != constants.APIServerName { if cc.KubernetesConfig.APIServerName != constants.APIServerName {
hostname = cc.KubernetesConfig.APIServerName hostname = cc.KubernetesConfig.APIServerName
} }
return hostname, net.ParseIP(cp.IP), cp.Port, nil ip := net.ParseIP(cp.IP)
if ip == nil {
return hostname, ip, cp.Port, fmt.Errorf("failed to parse ip for %q", cp.IP)
}
return hostname, ip, cp.Port, nil
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册