feat: enforce shared application resource quotas across namespaces
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/config"
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/storage/mysql"
|
||||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -22,12 +23,17 @@ func main() {
|
||||
}
|
||||
func run() error {
|
||||
if len(os.Args) < 2 || os.Args[1] != "bootstrap" {
|
||||
return errors.New("usage: orbit-admin bootstrap --application NAME --namespace NAME --environment NAME --queue NAME --output NEW_FILE")
|
||||
return errors.New("usage: orbit-admin bootstrap (--application NAME | --application-id ID) --namespace NAME --environment NAME --queue NAME --output NEW_FILE")
|
||||
}
|
||||
flags := flag.NewFlagSet("bootstrap", flag.ContinueOnError)
|
||||
var in mysql.BootstrapInput
|
||||
var output string
|
||||
flags.StringVar(&in.Application, "application", "", "new application name")
|
||||
flags.Func("application-id", "existing application id; mutually exclusive with --application", func(v string) error {
|
||||
in.ExistingApplicationID = core.ID(v)
|
||||
return in.ExistingApplicationID.Validate()
|
||||
})
|
||||
flags.BoolVar(&in.ResourceAccess, "resource-access", false, "grant application-wide resource read and manage actions")
|
||||
flags.StringVar(&in.Namespace, "namespace", "", "new namespace name")
|
||||
flags.StringVar(&in.Environment, "environment", "", "environment name")
|
||||
flags.StringVar(&in.Queue, "queue", "", "initial queue name")
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/storage/mysql"
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/transport/httpserver"
|
||||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||||
"git.yuntuo.hk/k2safe/orbit/platform/resources"
|
||||
"git.yuntuo.hk/k2safe/orbit/pulse/schedule"
|
||||
"git.yuntuo.hk/k2safe/orbit/pulse/service"
|
||||
"git.yuntuo.hk/k2safe/orbit/pulse/worker"
|
||||
@@ -52,6 +53,7 @@ func run() error {
|
||||
}
|
||||
return mysql.CheckSchema(ctx, db)
|
||||
}, service.New(mysql.NewTaskStore(db)))
|
||||
httpserver.RegisterApplicationResources(server, resources.New(mysql.NewTaskStore(db)))
|
||||
node, err := core.NewID()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user