[FIX] fix bug: cant not convert in Deployment and StatefulSet

This commit is contained in:
GLYASAI 2018-12-17 18:50:36 +08:00
parent 7ba3e8d94e
commit 2d8fcaf64f

View File

@ -21,6 +21,7 @@ package store
import (
"context"
"fmt"
"github.com/goodrain/rainbond/util"
"sync"
"time"
@ -468,6 +469,15 @@ func (a *appRuntimeStore) GetAppService(serviceID string) *v1.AppService {
app, ok := a.appServices.Load(key)
if ok {
appService := app.(*v1.AppService)
serviceType, err := a.dbmanager.TenantServiceLabelDao().GetTenantServiceTypeLabel(serviceID)
if err != nil {
logrus.Warningf("error getting TenantServiceTypeLabel(serviceID=%s): %v", serviceID, serviceType)
}
if serviceType == nil || serviceType.LabelValue == util.StatelessServiceType {
appService.SetStatefulSet(nil)
} else if serviceType.LabelValue == util.StatefulServiceType {
appService.SetDeployment(nil)
}
return appService
}
return nil