From 9b2cd6717ee160684498ca0e767fa4673f99a455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E7=BE=8A=E7=BE=8A?= Date: Tue, 3 Mar 2020 10:37:40 +0800 Subject: [PATCH] fix wrong service type --- db/model/tenant.go | 12 ++++++------ worker/appm/conversion/service.go | 8 ++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/db/model/tenant.go b/db/model/tenant.go index 045c4f380..718647c6a 100644 --- a/db/model/tenant.go +++ b/db/model/tenant.go @@ -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 diff --git a/worker/appm/conversion/service.go b/worker/appm/conversion/service.go index 09f354a77..fb72a1bcc 100644 --- a/worker/appm/conversion/service.go +++ b/worker/appm/conversion/service.go @@ -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 }