feat: add a whole-set form and clear for chart overrides

The `scheduler-k3s:charts:set` command only changed one chart override at a time, so matching a chart's stored overrides to a declared set meant reading the report, computing the difference in both directions and issuing one command per added, changed and removed property, with a failure partway through leaving a mixture of the two sets. A `--replace` flag on `scheduler-k3s:charts:set` now takes a chart name followed by `property=value` pairs and writes the declared map for that chart in a single call. Every pair is parsed before anything is written, so a rejected pair leaves the stored overrides untouched, and a pair ending in `=` stores an empty value, which the per-property form cannot express. An empty pair list is rejected rather than treated as a request to remove everything, and the new `scheduler-k3s:charts:clear` command handles that case by removing every override for a chart.
This commit is contained in:
Jose Diaz-Gonzalez committed 2026-10-24 19:34:13 -04:00
1 parent be291f3928
commit 00c3e48cf4
10 files changed
+278 -42

No files matched your search

@@ -24,8 +24,10 @@ Additional commands:`
scheduler-k3s:autoscaling-auth:set <app|--global> <trigger> [<--metadata key=value>...], Set or clear a scheduler-k3s autoscaling keda trigger authentication resource for an app
scheduler-k3s:autoscaling-auth:set --replace <app|--global> <trigger> <--metadata key=value> [<--metadata key=value>...], Replace the entire metadata map for a scheduler-k3s autoscaling keda trigger authentication resource
scheduler-k3s:autoscaling-auth:report [<app>|--global] [--format stdout|json] [--include-metadata], Displays a scheduler-k3s autoscaling auth report for one or more apps
scheduler-k3s:charts:clear <chart>, Clear all chart-specific helm values for a chart
scheduler-k3s:charts:report [<chart>] [--format stdout|json], Displays a scheduler-k3s chart override report
scheduler-k3s:charts:set <chart-name.property> (<value>), Set or clear a chart-specific helm value
scheduler-k3s:charts:set --replace <chart> <property=value> [<property=value> ...], Replace the entire helm value override map for a chart
scheduler-k3s:cluster:add [--profile PROFILE] [--role ROLE] [--insecure-allow-unknown-hosts] [--server-ip SERVER_IP] [--taint-scheduling] [--kubelet-args KUBELET_ARGS] <ssh://user@host:port>, Adds a server node to a Dokku-managed cluster
scheduler-k3s:cluster:list [--format json|stdout], Lists all nodes in a Dokku-managed cluster
scheduler-k3s:cluster:remove [node-id], Removes client node to a Dokku-managed cluster
@@ -108,12 +108,28 @@ func main() {
appName = "--global"
}
err = scheduler_k3s.CommandAutoscalingAuthReport(appName, *format, *includeMetadata, infoFlag)
case "charts:clear":
args := flag.NewFlagSet("scheduler-k3s:charts:clear", flag.ExitOnError)
args.Parse(os.Args[2:])
chartName := args.Arg(0)
err = scheduler_k3s.CommandChartsClear(chartName)
case "charts:set":
args := flag.NewFlagSet("scheduler-k3s:charts:set", flag.ExitOnError)
replace := args.Bool("replace", false, "--replace: replace the entire override map for the chart")
args.Parse(os.Args[2:])
property := args.Arg(0)
value := args.Arg(1)
err = scheduler_k3s.CommandChartsSet(property, value)
input := scheduler_k3s.ChartsSetInput{
Replace: *replace,
}
if *replace {
input.ChartName = args.Arg(0)
input.Pairs = common.VarArgs(args.Args(), 1)
} else {
input.Property = args.Arg(0)
input.Value = args.Arg(1)
}
err = scheduler_k3s.CommandChartsSet(input)
case "charts:report":
args := flag.NewFlagSet("scheduler-k3s:charts:report", flag.ExitOnError)
format := args.String("format", "stdout", "format: [ stdout | json ]")