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 authored and mheon committed Oct 19, 2021
1 parent b470de0 commit 3082ba8
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 3082ba8

Please sign in to comment.