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
@@ -124,26 +124,69 @@ func CommandAutoscalingAuthSet(appName string, trigger string, metadata map[stri
|
||||
}
|
||||
|
||||
// CommandAutoscalingAuthReport displays a scheduler-k3s autoscaling keda trigger authentication report for one or more apps
|
||||
func CommandAutoscalingAuthReport(appName string, format string, global bool, includeMetadata bool) error {
|
||||
if len(appName) == 0 && !global {
|
||||
return fmt.Errorf("Missing required app name or --global flag")
|
||||
}
|
||||
|
||||
if len(appName) > 0 && global {
|
||||
return fmt.Errorf("Cannot specify both app name and --global flag")
|
||||
}
|
||||
|
||||
if !global {
|
||||
if err := common.VerifyAppName(appName); err != nil {
|
||||
func CommandAutoscalingAuthReport(appName string, format string, includeMetadata bool) error {
|
||||
if len(appName) == 0 {
|
||||
apps, err := common.DokkuApps()
|
||||
if err != nil {
|
||||
if errors.Is(err, common.NoAppsExist) {
|
||||
common.LogWarn(err.Error())
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
for _, app := range apps {
|
||||
if err := ReportAutoscalingAuthSingleApp(app, format, includeMetadata); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(appName) > 0 {
|
||||
return ReportAutoscalingAuthSingleApp(appName, format, includeMetadata)
|
||||
return ReportAutoscalingAuthSingleApp(appName, format, includeMetadata)
|
||||
}
|
||||
|
||||
// CommandAnnotationsReport displays a scheduler-k3s annotations report for one or more apps
|
||||
func CommandAnnotationsReport(appName string, format string, processType string, resourceType string, infoFlag string) error {
|
||||
if len(appName) == 0 {
|
||||
apps, err := common.DokkuApps()
|
||||
if err != nil {
|
||||
if errors.Is(err, common.NoAppsExist) {
|
||||
common.LogWarn(err.Error())
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
for _, app := range apps {
|
||||
if err := ReportAnnotationsSingleApp(app, format, processType, resourceType, infoFlag); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
return ReportAutoscalingAuthSingleApp("--global", format, includeMetadata)
|
||||
return ReportAnnotationsSingleApp(appName, format, processType, resourceType, infoFlag)
|
||||
}
|
||||
|
||||
// CommandLabelsReport displays a scheduler-k3s labels report for one or more apps
|
||||
func CommandLabelsReport(appName string, format string, processType string, resourceType string, infoFlag string) error {
|
||||
if len(appName) == 0 {
|
||||
apps, err := common.DokkuApps()
|
||||
if err != nil {
|
||||
if errors.Is(err, common.NoAppsExist) {
|
||||
common.LogWarn(err.Error())
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
for _, app := range apps {
|
||||
if err := ReportLabelsSingleApp(app, format, processType, resourceType, infoFlag); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
return ReportLabelsSingleApp(appName, format, processType, resourceType, infoFlag)
|
||||
}
|
||||
|
||||
// CommandInitialize initializes a k3s cluster on the local server
|
||||
|
||||
Reference in new issue
Block a user