Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions server/sandbox_run_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,17 +437,19 @@
}
sbox.SetRuntimeHandler(runtimeHandler)

if err := s.FilterDisallowedAnnotations(sbox.Config().Annotations, sbox.Config().Annotations, runtimeHandler); err != nil {
defaultAnnotations, err := s.Runtime().RuntimeDefaultAnnotations(runtimeHandler)
if err != nil {
return nil, err
}
kubeAnnotations := map[string]string{}
// Deep copy to prevent writing to the same map in the config
for k, v := range defaultAnnotations {
kubeAnnotations[k] = v
}

Check warning on line 448 in server/sandbox_run_linux.go

View check run for this annotation

Codecov / codecov/patch

server/sandbox_run_linux.go#L447-L448

Added lines #L447 - L448 were not covered by tests

kubeAnnotations, err := s.Runtime().RuntimeDefaultAnnotations(runtimeHandler)
if err != nil {
if err := s.FilterDisallowedAnnotations(sbox.Config().Annotations, sbox.Config().Annotations, runtimeHandler); err != nil {
return nil, err
}
if kubeAnnotations == nil {
kubeAnnotations = map[string]string{}
}

// override default annotations with pod spec specified ones
for k, v := range sbox.Config().Annotations {
Expand Down
4 changes: 4 additions & 0 deletions test/pod.bats
Original file line number Diff line number Diff line change
Expand Up @@ -554,4 +554,8 @@ EOF
grep hello <<< "$annotations"
# pod spec should override default annotations
grep -v "5678" <<< "$annotations"

# verify the internal crio configuration is unchanged
CONFIG=$(crio status -s "$CRIO_SOCKET" config)
jq '.annotations | keys[]' < "$TESTDATA"/sandbox_config.json | while read -r key; do ! echo "$CONFIG" | grep "$key"; done
}
Loading