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:
Jose Diaz-Gonzalez committed 2026-05-30 20:12:00 -04:00
1 parent 4346a18194
commit 5dbb2951bb
10 files changed
+712 -19

No files matched your search

+48
View File
@@ -52,6 +52,54 @@ const KubeConfigPath = "/etc/rancher/k3s/k3s.yaml"
const DefaultKubeContext = ""
const TriggerAuthPropertyPrefix = "trigger-auth."
// AnnotationResourceTypes lists the kubernetes resource types that scheduler-k3s
// supports user-provided annotations for. The order here is also the iteration order
// used when rendering reports.
var AnnotationResourceTypes = []string{
"certificate",
"cronjob",
"deployment",
"ingress",
"job",
"keda_scaled_object",
"keda_secret",
"keda_trigger_authentication",
"pod",
"secret",
"service",
"serviceaccount",
"traefik_ingressroute",
"traefik_middleware",
}
// LabelResourceTypes lists the kubernetes resource types that scheduler-k3s
// supports user-provided labels for. Differs from AnnotationResourceTypes because
// keda resources do not currently flow user labels through.
var LabelResourceTypes = []string{
"certificate",
"cronjob",
"deployment",
"ingress",
"job",
"pod",
"secret",
"service",
"serviceaccount",
"traefik_ingressroute",
"traefik_middleware",
}
// reservedAnnotationPrefixes lists property name prefixes that are not annotations
// even though their trailing segment may collide with an AnnotationResourceTypes value
// (e.g. "chart.cert-manager.deployment"). The annotations report uses this list to
// exclude such properties when scanning the property store.
var reservedAnnotationPrefixes = []string{
"chart.",
"labels.",
"node-profile-",
TriggerAuthPropertyPrefix,
}
var (
runtimeScheme = runtime.NewScheme()
codecs = serializer.NewCodecFactory(runtimeScheme)