fix wrong service type

This commit is contained in:
凡羊羊 2020-03-03 10:37:40 +08:00
parent e76aa6952e
commit 9b2cd6717e
2 changed files with 8 additions and 12 deletions

View File

@ -117,19 +117,19 @@ func (s ServiceType) IsSingleton() bool {
// TODO fanyangyang 根据组件简单判断是否是有状态
// IsState is state service or stateless service
func (ts TenantServices) IsState() bool {
if ts.ServiceType == "" {
func (ts *TenantServices) IsState() bool {
if ts.ExtendMethod == "" {
return false
}
return ServiceType(ts.ServiceType).IsState()
return ServiceType(ts.ExtendMethod).IsState()
}
// IsSingleton is singleton or multiple service
func (ts TenantServices) IsSingleton() bool {
if ts.ServiceType == "" {
func (ts *TenantServices) IsSingleton() bool {
if ts.ExtendMethod == "" {
return false
}
return ServiceType(ts.ServiceType).IsSingleton()
return ServiceType(ts.ExtendMethod).IsSingleton()
}
// ServiceTypeUnknown unknown

View File

@ -111,19 +111,15 @@ func TenantServiceBase(as *v1.AppService, dbmanager db.Manager) error {
return nil
}
//TODO fanyangyang 根据组件类型确定是否支持
serviceInfo, err := dbmanager.TenantServiceDao().GetServiceTypeById(as.ServiceID)
if err != nil {
return fmt.Errorf("get service type info failure %s", err.Error())
}
label, err := dbmanager.TenantServiceLabelDao().GetLabelByNodeSelectorKey(as.ServiceID, "windows")
if label != nil {
as.IsWindowsService = true
}
if serviceInfo == nil || !serviceInfo.IsState() {
if tenantService == nil || !tenantService.IsState() {
initBaseDeployment(as, tenantService)
return nil
}
if serviceInfo.IsState() {
if tenantService.IsState() {
initBaseStatefulSet(as, tenantService)
return nil
}