use uft8mb4 in DB, fix stateful name error

This commit is contained in:
yangk 2021-12-03 10:47:41 +08:00
parent c9f1377b88
commit 52c8bb538f
4 changed files with 5 additions and 12 deletions

View File

@ -117,7 +117,7 @@ func (s *slugBuild) writeRunDockerfile(sourceDir, packageName string, envs map[s
//buildRunnerImage Wrap slug in the runner image //buildRunnerImage Wrap slug in the runner image
func (s *slugBuild) buildRunnerImage(slugPackage string) (string, error) { func (s *slugBuild) buildRunnerImage(slugPackage string) (string, error) {
imageName := fmt.Sprintf("%s/%s:%s", builder.REGISTRYDOMAIN, s.re.ServiceID, s.re.DeployVersion) imageName := CreateImageName(s.re.ServiceID, s.re.DeployVersion)
cacheDir := path.Join(path.Dir(slugPackage), "."+s.re.DeployVersion) cacheDir := path.Join(path.Dir(slugPackage), "."+s.re.DeployVersion)
if err := util.CheckAndCreateDir(cacheDir); err != nil { if err := util.CheckAndCreateDir(cacheDir); err != nil {
return "", fmt.Errorf("create cache package dir failure %s", err.Error()) return "", fmt.Errorf("create cache package dir failure %s", err.Error())

View File

@ -44,7 +44,7 @@ func CreateManager(config config.Config) (*Manager, error) {
var db *gorm.DB var db *gorm.DB
if config.DBType == "mysql" { if config.DBType == "mysql" {
var err error var err error
db, err = gorm.Open("mysql", config.MysqlConnectionInfo+"?charset=utf8&parseTime=True&loc=Local") db, err = gorm.Open("mysql", config.MysqlConnectionInfo+"?charset=utf8mb4&parseTime=True&loc=Local")
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -495,11 +495,8 @@ func (a *AppServiceBuild) createOuterService(port *model.TenantServicesPort) *co
func (a *AppServiceBuild) createStatefulService(ports []*model.TenantServicesPort) *corev1.Service { func (a *AppServiceBuild) createStatefulService(ports []*model.TenantServicesPort) *corev1.Service {
var service corev1.Service var service corev1.Service
service.Name = a.service.ServiceName
service.Namespace = a.appService.GetNamespace()
if service.Name == "" {
service.Name = a.appService.GetK8sWorkloadName() service.Name = a.appService.GetK8sWorkloadName()
} service.Namespace = a.appService.GetNamespace()
service.Labels = a.appService.GetCommonLabels(map[string]string{ service.Labels = a.appService.GetCommonLabels(map[string]string{
"service_type": "stateful", "service_type": "stateful",
"name": a.service.ServiceAlias + "ServiceStateful", "name": a.service.ServiceAlias + "ServiceStateful",

View File

@ -175,12 +175,8 @@ func initBaseStatefulSet(as *v1.AppService, service *dbmodel.TenantServices) {
stateful.Spec.Selector = &metav1.LabelSelector{} stateful.Spec.Selector = &metav1.LabelSelector{}
} }
initSelector(stateful.Spec.Selector, service) initSelector(stateful.Spec.Selector, service)
stateful.Spec.ServiceName = service.ServiceName
stateful.Name = service.ServiceName
if stateful.Spec.ServiceName == "" {
stateful.Spec.ServiceName = as.GetK8sWorkloadName()
stateful.Name = as.GetK8sWorkloadName() stateful.Name = as.GetK8sWorkloadName()
} stateful.Spec.ServiceName = as.GetK8sWorkloadName()
stateful.GenerateName = service.ServiceAlias stateful.GenerateName = service.ServiceAlias
injectLabels := getInjectLabels(as) injectLabels := getInjectLabels(as)
stateful.Labels = as.GetCommonLabels(stateful.Labels, map[string]string{ stateful.Labels = as.GetCommonLabels(stateful.Labels, map[string]string{