feat: add scheduler-k3s annotations:report and labels:report
The scheduler-k3s plugin exposes `annotations:set` and `labels:set` but no matching report subcommands, so scripts could not inspect the configured state for idempotent management without reading the property files directly. The new `scheduler-k3s:annotations:report` and `scheduler-k3s:labels:report` surface the configured entries with stdout, JSON, single-flag query, and `--process-type` / `--resource-type` filtering, mirroring the recently added `scheduler-k3s:charts:report`. The literal `GlobalProcessType` value `--global` is rendered as `global` in report keys to avoid leading dashes. The `scheduler-k3s:autoscaling-auth:report` command is updated alongside to loop over every app when no app and no `--global` flag is provided, matching the convention used by `scheduler-k3s:report`.
This commit is contained in:
10 files changed
+712
-19
No files matched your search
@@ -34,6 +34,23 @@ func main() {
|
||||
}
|
||||
|
||||
err = scheduler_k3s.CommandAnnotationsSet(appName, *processType, *resourceType, property, value)
|
||||
case "annotations:report":
|
||||
args := flag.NewFlagSet("scheduler-k3s:annotations:report", flag.ExitOnError)
|
||||
global := args.Bool("global", false, "--global: show the global report")
|
||||
format := args.String("format", "stdout", "format: [ stdout | json ]")
|
||||
processType := args.String("process-type", "", "--process-type: filter by process-type")
|
||||
resourceType := args.String("resource-type", "", "--resource-type: filter by resource-type")
|
||||
passthroughArgs, infoFlag, flagErr := scheduler_k3s.ExtractReportInfoFlag("--scheduler-k3s-annotations.", os.Args[2:])
|
||||
if flagErr != nil {
|
||||
err = flagErr
|
||||
break
|
||||
}
|
||||
args.Parse(passthroughArgs)
|
||||
appName := args.Arg(0)
|
||||
if *global {
|
||||
appName = "--global"
|
||||
}
|
||||
err = scheduler_k3s.CommandAnnotationsReport(appName, *format, *processType, *resourceType, infoFlag)
|
||||
case "autoscaling-auth:set":
|
||||
args := flag.NewFlagSet("scheduler-k3s:autoscaling-auth:set", flag.ExitOnError)
|
||||
global := args.Bool("global", false, "--global: set a global property")
|
||||
@@ -48,12 +65,15 @@ func main() {
|
||||
err = scheduler_k3s.CommandAutoscalingAuthSet(appName, trigger, *metadata, *global)
|
||||
case "autoscaling-auth:report":
|
||||
args := flag.NewFlagSet("scheduler-k3s:autoscaling-auth:report", flag.ExitOnError)
|
||||
global := args.Bool("global", false, "--global: show a global report")
|
||||
global := args.Bool("global", false, "--global: show the global report")
|
||||
includeMetadata := args.Bool("include-metadata", false, "--include-metadata: include metadata in the report")
|
||||
format := args.String("format", "stdout", "format: [ stdout | json ]")
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
err = scheduler_k3s.CommandAutoscalingAuthReport(appName, *format, *global, *includeMetadata)
|
||||
if *global {
|
||||
appName = "--global"
|
||||
}
|
||||
err = scheduler_k3s.CommandAutoscalingAuthReport(appName, *format, *includeMetadata)
|
||||
case "charts:set":
|
||||
args := flag.NewFlagSet("scheduler-k3s:charts:set", flag.ExitOnError)
|
||||
args.Parse(os.Args[2:])
|
||||
@@ -121,6 +141,23 @@ func main() {
|
||||
}
|
||||
|
||||
err = scheduler_k3s.CommandLabelsSet(appName, *processType, *resourceType, property, value)
|
||||
case "labels:report":
|
||||
args := flag.NewFlagSet("scheduler-k3s:labels:report", flag.ExitOnError)
|
||||
global := args.Bool("global", false, "--global: show the global report")
|
||||
format := args.String("format", "stdout", "format: [ stdout | json ]")
|
||||
processType := args.String("process-type", "", "--process-type: filter by process-type")
|
||||
resourceType := args.String("resource-type", "", "--resource-type: filter by resource-type")
|
||||
passthroughArgs, infoFlag, flagErr := scheduler_k3s.ExtractReportInfoFlag("--scheduler-k3s-labels.", os.Args[2:])
|
||||
if flagErr != nil {
|
||||
err = flagErr
|
||||
break
|
||||
}
|
||||
args.Parse(passthroughArgs)
|
||||
appName := args.Arg(0)
|
||||
if *global {
|
||||
appName = "--global"
|
||||
}
|
||||
err = scheduler_k3s.CommandLabelsReport(appName, *format, *processType, *resourceType, infoFlag)
|
||||
case "profiles:add":
|
||||
args := flag.NewFlagSet("scheduler-k3s:profiles:add", flag.ExitOnError)
|
||||
role := args.String("role", "worker", "role: [ server | worker ]")
|
||||
|
||||
Reference in new issue
Block a user