From 83531904da6e3fbf1593ca3c77b14058e8707a58 Mon Sep 17 00:00:00 2001 From: Peter Hunt Date: Fri, 28 Aug 2020 17:18:01 -0400 Subject: play kube: handle Socket HostPath type as well as add test cases for it and the other HostPath types we currently support Signed-off-by: Peter Hunt --- pkg/domain/infra/abi/play.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'pkg/domain') diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go index 4ebc37cda..729cd143c 100644 --- a/pkg/domain/infra/abi/play.go +++ b/pkg/domain/infra/abi/play.go @@ -250,13 +250,22 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY if err := libpod.LabelVolumePath(hostPath.Path); err != nil { return nil, errors.Wrapf(err, "Error giving %s a label", hostPath.Path) } + case v1.HostPathSocket: + st, err := os.Stat(hostPath.Path) + if err != nil { + return nil, errors.Wrapf(err, "Error checking HostPathSocket") + } + if st.Mode()&os.ModeSocket != os.ModeSocket { + return nil, errors.Errorf("Error checking HostPathSocket: path %s is not a socket", hostPath.Path) + } + case v1.HostPathDirectory: case v1.HostPathFile: case v1.HostPathUnset: // do nothing here because we will verify the path exists in validateVolumeHostDir break default: - return nil, errors.Errorf("Directories are the only supported HostPath type") + return nil, errors.Errorf("Invalid HostPath type %v", hostPath.Type) } } -- cgit v1.2.3-54-g00ecf