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:
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user