fix: persist scheduler-k3s annotations and labels as JSON maps

Annotation and label values containing a newline previously round-tripped
as two adjacent `key: value` lines, and the second line then failed the
`SplitN(line, ": ", 2)` parse on read. Move the per-`(processType,
resourceType)` files to `PropertyMap*` storage so `\n` in values and `/`
in keys are preserved verbatim. An idempotent `TriggerInstall` migration
walks `--global` and every app, converting any legacy line-formatted file
in place by probing `PropertyMapGet` first and rewriting via
`PropertyListGet` only when the probe fails. Property names are
unchanged, so the annotations/labels report scanner and the
`reservedAnnotationPrefixes` filter keep working without modification.

Closes #8719.
This commit is contained in:
Jose Diaz-Gonzalez
2026-05-31 02:38:35 -04:00
parent 4ae48c6ea0
commit 21ed5fb738
7 changed files with 250 additions and 77 deletions

View File

@@ -86,3 +86,13 @@ teardown() {
assert_output_contains "app1-val"
assert_output_contains "app2-val"
}
@test "(scheduler-k3s:annotations:set) preserves multi-line values and / in keys" {
local value=$'line one\nline two\nline three'
run /bin/bash -c "dokku scheduler-k3s:annotations:set $TEST_APP --resource-type deployment prometheus.io/scrape \"$value\""
assert_success
run /bin/bash -c "dokku scheduler-k3s:annotations:report $TEST_APP --format json | jq -r '.\"global.deployment.prometheus.io/scrape\"'"
assert_success
assert_output "$value"
}

View File

@@ -86,3 +86,13 @@ teardown() {
assert_output_contains "app1-val"
assert_output_contains "app2-val"
}
@test "(scheduler-k3s:labels:set) preserves multi-line values and / in keys" {
local value=$'line one\nline two\nline three'
run /bin/bash -c "dokku scheduler-k3s:labels:set $TEST_APP --resource-type deployment app.kubernetes.io/part-of \"$value\""
assert_success
run /bin/bash -c "dokku scheduler-k3s:labels:report $TEST_APP --format json | jq -r '.\"global.deployment.app.kubernetes.io/part-of\"'"
assert_success
assert_output "$value"
}