Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kyaml/fn/framework ensures the annotation output format matches the input #4297

Merged
merged 7 commits into from Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions kyaml/fn/framework/framework.go
Expand Up @@ -116,8 +116,21 @@ func Execute(p ResourceListProcessor, rlSource *kio.ByteReadWriter) error {
}
rl.FunctionConfig = rlSource.FunctionConfig

// We store the original
nodeAnnos, err := kio.StoreInternalAnnotations(rl.Items)
natasha41575 marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return err
}

retErr := p.Process(&rl)

// If either the internal annotations for path, index, and id OR the legacy
// annotations for path, index, and id are changed, we have to update the other.
err = kio.ReconcileInternalAnnotations(rl.Items, nodeAnnos)
if err != nil {
return err
}

// Write the results
// Set the ResourceList.results for validating functions
if len(rl.Results) > 0 {
Expand Down
3 changes: 0 additions & 3 deletions kyaml/kio/byteio_writer_test.go
Expand Up @@ -400,7 +400,6 @@ metadata:
"a": "a long string that would certainly see a newline introduced by the YAML marshaller abcd123",
"metadata": {
"annotations": {
"config.kubernetes.io/path": "test.json",
"internal.config.kubernetes.io/path": "test.json"
}
}
Expand Down Expand Up @@ -429,7 +428,6 @@ metadata:
"a": "a long string that would certainly see a newline introduced by the YAML marshaller abcd123",
"metadata": {
"annotations": {
"config.kubernetes.io/path": "test.json",
"internal.config.kubernetes.io/path": "test.json"
}
}
Expand All @@ -449,7 +447,6 @@ metadata:
"a": "b",
"metadata": {
"annotations": {
"config.kubernetes.io/path": "test.json",
"internal.config.kubernetes.io/path": "test.json"
}
}
Expand Down