提交 addf11c3 编写于 作者: J Jeff 提交者: zryfish

fix nodeport router

上级 dd963c0b
......@@ -144,9 +144,8 @@ func parseParameter(router Router) (routerType v1.ServiceType, annotationMap map
routerType = v1.ServiceTypeNodePort
if strings.Compare(strings.ToLower(router.RouterType), "loadbalancer") == 0 {
return v1.ServiceTypeLoadBalancer, router.Annotations, nil
} else {
return v1.ServiceTypeNodePort, make(map[string]string, 0), nil
routerType = v1.ServiceTypeLoadBalancer
}
return routerType, router.Annotations, nil
}
......@@ -20,16 +20,18 @@ package constants
const (
APIVersion = "v1alpha1"
KubeSystemNamespace = "kube-system"
OpenPitrixNamespace = "openpitrix-system"
IstioNamespace = "istio-system"
KubeSphereNamespace = "kubesphere-system"
KubeSphereControlNamespace = "kubesphere-controls-system"
IngressControllerNamespace = KubeSphereControlNamespace
AdminUserName = "admin"
DataHome = "/etc/kubesphere"
IngressControllerFolder = DataHome + "/ingress-controller"
IngressControllerPrefix = "kubesphere-router-"
KubeSystemNamespace = "kube-system"
OpenPitrixNamespace = "openpitrix-system"
IstioNamespace = "istio-system"
KubeSphereMonitoringNamespace = "kubesphere-monitoring-system"
KubeSphereLoggingNamespace = "kubesphere-logging-system"
KubeSphereNamespace = "kubesphere-system"
KubeSphereControlNamespace = "kubesphere-controls-system"
IngressControllerNamespace = KubeSphereControlNamespace
AdminUserName = "admin"
DataHome = "/etc/kubesphere"
IngressControllerFolder = DataHome + "/ingress-controller"
IngressControllerPrefix = "kubesphere-router-"
WorkspaceLabelKey = "kubesphere.io/workspace"
DisplayNameAnnotationKey = "displayName"
......@@ -47,5 +49,5 @@ const (
var (
WorkSpaceRoles = []string{WorkspaceAdmin, WorkspaceRegular, WorkspaceViewer}
SystemNamespaces = []string{KubeSphereNamespace, OpenPitrixNamespace, KubeSystemNamespace}
SystemNamespaces = []string{KubeSphereNamespace, KubeSphereLoggingNamespace, KubeSphereMonitoringNamespace, OpenPitrixNamespace, KubeSystemNamespace, IstioNamespace}
)
......@@ -18,6 +18,7 @@
package components
import (
"fmt"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"kubesphere.io/kubesphere/pkg/models"
"kubesphere.io/kubesphere/pkg/simple/client/k8s"
......@@ -49,6 +50,10 @@ func GetComponentStatus(name string) (interface{}, error) {
return nil, err
}
if len(service.Spec.Selector) == 0 {
return nil, fmt.Errorf("component %s has no selector", name)
}
podLister := informers.SharedInformerFactory().Core().V1().Pods().Lister()
pods, err := podLister.Pods(service.Namespace).List(labels.SelectorFromValidatedSet(service.Spec.Selector))
......@@ -148,6 +153,12 @@ func GetAllComponentsStatus() (map[string]interface{}, error) {
}
for _, service := range services {
// skip services without a selector
if len(service.Spec.Selector) == 0 {
continue
}
component := models.Component{
Name: service.Name,
Namespace: service.Namespace,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册