fix generation bug (#2043)
This commit is contained in:
@@ -23,6 +23,8 @@ const (
|
||||
defaultAgentImage = "kubesphere/tower:v1.0"
|
||||
)
|
||||
|
||||
var ErrClusterConnectionIsNotProxy = fmt.Errorf("cluster is not using proxy connection")
|
||||
|
||||
type handler struct {
|
||||
serviceLister v1.ServiceLister
|
||||
clusterLister clusterlister.ClusterLister
|
||||
@@ -62,6 +64,11 @@ func (h *handler) GenerateAgentDeployment(request *restful.Request, response *re
|
||||
}
|
||||
}
|
||||
|
||||
if cluster.Spec.Connection.Type != v1alpha1.ConnectionTypeProxy {
|
||||
api.HandleNotFound(response, request, fmt.Errorf("cluster %s is not using proxy connection", cluster.Name))
|
||||
return
|
||||
}
|
||||
|
||||
// use service ingress address
|
||||
if len(h.proxyAddress) == 0 {
|
||||
err = h.populateProxyAddress()
|
||||
@@ -126,6 +133,10 @@ func (h *handler) populateProxyAddress() error {
|
||||
|
||||
func (h *handler) generateDefaultDeployment(cluster *v1alpha1.Cluster, w io.Writer) error {
|
||||
|
||||
if cluster.Spec.Connection.Type == v1alpha1.ConnectionTypeDirect {
|
||||
return ErrClusterConnectionIsNotProxy
|
||||
}
|
||||
|
||||
agent := appsv1.Deployment{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "Deployment",
|
||||
|
||||
Reference in New Issue
Block a user