K8s: Move standalone apiserver CLI to enterprise (#93799)

This commit is contained in:
Ryan McKinley
2024-09-27 09:04:35 +03:00
committed by GitHub
parent e672796632
commit 87c81825b7
24 changed files with 63 additions and 924 deletions

View File

@ -13,6 +13,7 @@ import (
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/metrics"
"github.com/grafana/grafana/pkg/server"
"github.com/grafana/grafana/pkg/services/apiserver/standalone"
"github.com/grafana/grafana/pkg/setting"
)
@ -22,18 +23,17 @@ func TargetCommand(version, commit, buildBranch, buildstamp string) *cli.Command
Usage: "target specific grafana dskit services",
Flags: commonFlags,
Action: func(context *cli.Context) error {
return RunTargetServer(ServerOptions{
return RunTargetServer(standalone.BuildInfo{
Version: version,
Commit: commit,
BuildBranch: buildBranch,
BuildStamp: buildstamp,
Context: context,
})
}, context)
},
}
}
func RunTargetServer(opts ServerOptions) error {
func RunTargetServer(opts standalone.BuildInfo, cli *cli.Context) error {
if Version || VerboseVersion {
fmt.Printf("Version %s (commit: %s, branch: %s)\n", opts.Version, opts.Commit, opts.BuildBranch)
if VerboseVersion {
@ -83,7 +83,7 @@ func RunTargetServer(opts ServerOptions) error {
Config: ConfigFile,
HomePath: HomePath,
// tailing arguments have precedence over the options string
Args: append(configOptions, opts.Context.Args().Slice()...),
Args: append(configOptions, cli.Args().Slice()...),
})
if err != nil {
return err