add workspace api

This commit is contained in:
hongming
2018-10-16 18:52:10 +08:00
parent 85b3da3dcd
commit a8d5f552a0
11 changed files with 1822 additions and 183 deletions

View File

@@ -43,6 +43,7 @@ import (
"kubesphere.io/kubesphere/pkg/constants"
"kubesphere.io/kubesphere/pkg/models"
"kubesphere.io/kubesphere/pkg/models/controllers"
"kubesphere.io/kubesphere/pkg/models/workspaces"
"kubesphere.io/kubesphere/pkg/options"
)
@@ -92,6 +93,16 @@ func preCheck() error {
models.CreateKubectlDeploy(constants.AdminUserName)
return nil
}
db := client.NewSharedDBClient()
defer db.Close()
if !db.HasTable(&workspaces.WorkspaceNSBinding{}) {
db.CreateTable(&workspaces.WorkspaceNSBinding{})
}
if !db.HasTable(&workspaces.WorkspaceDPBinding{}) {
db.CreateTable(&workspaces.WorkspaceDPBinding{})
}
return err
}