未验证 提交 97b61945 编写于 作者: Z zryfish 提交者: GitHub

change error message when there is no proxy address (#2372)

上级 f187f97c
......@@ -120,7 +120,7 @@ func (h *handler) populateProxyAddress() error {
}
if len(service.Spec.Ports) == 0 {
return fmt.Errorf("there are no ports in proxy service spec")
return fmt.Errorf("there are no ports in proxy service %s spec", h.proxyService)
}
port := service.Spec.Ports[0].Port
......@@ -137,7 +137,9 @@ func (h *handler) populateProxyAddress() error {
}
if len(serviceAddress) == 0 {
return fmt.Errorf("service ingress is empty")
return fmt.Errorf("cannot generate agent deployment yaml for member cluster "+
" because %s service has no public address, please check %s status, or set address "+
" mannually in ClusterConfiguration", h.proxyService, h.proxyService)
}
h.proxyAddress = serviceAddress
......@@ -150,6 +152,11 @@ func (h *handler) populateProxyAddress() error {
// TODO(jeff): load template from configmap
func (h *handler) generateDefaultDeployment(cluster *v1alpha1.Cluster, w io.Writer) error {
_, err := url.Parse(h.proxyAddress)
if err != nil {
return fmt.Errorf("invalid proxy address %s, should format like http[s]://1.2.3.4:123", h.proxyAddress)
}
if cluster.Spec.Connection.Type == v1alpha1.ConnectionTypeDirect {
return errClusterConnectionIsNotProxy
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册