Skip to content

Commit

Permalink
No space in kube annotations for bind mounts
Browse files Browse the repository at this point in the history
Kubernetes fails to deal with an annotation that has a space in it.
Trim these strings to remove spaces.

Fixes: containers#11929

Signed-off-by: Brent Baude <[email protected]>

[NO TESTS NEEDED]
  • Loading branch information
baude committed Oct 12, 2021
1 parent 2905bc3 commit ab0e663
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libpod/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func (p *Pod) podWithContainers(ctx context.Context, containers []*Container, po
return nil, err
}
for k, v := range annotations {
podAnnotations[define.BindMountPrefix+k] = v
podAnnotations[define.BindMountPrefix+k] = strings.TrimSpace(v)
}
// Since port bindings for the pod are handled by the
// infra container, wipe them here.
Expand Down Expand Up @@ -366,7 +366,7 @@ func simplePodWithV1Containers(ctx context.Context, ctrs []*Container) (*v1.Pod,
return nil, err
}
for k, v := range annotations {
kubeAnnotations[define.BindMountPrefix+k] = v
kubeAnnotations[define.BindMountPrefix+k] = strings.TrimSpace(v)
}
if isInit {
kubeInitCtrs = append(kubeInitCtrs, kubeCtr)
Expand Down

0 comments on commit ab0e663

Please sign in to comment.