@@ -275,7 +275,7 @@ func printResources(namespace corev1.Namespace, clientset *kubernetes.Clientset,
275275 for _ , v := range daemonset .Spec .Template .Spec .Volumes {
276276 if v .VolumeSource .HostPath != nil {
277277 // fmt.Printf("testing %s\n", v.VolumeSource.HostPath.Path)
278- if strings . Contains (v .VolumeSource .HostPath .Path , "docker.sock" ) {
278+ if containsDockerSock (v .VolumeSource .HostPath .Path ) {
279279 fmt .Fprintf (w , "%s\t %s\t %s\t %s\t \n " , namespaceName , "daemonset" , daemonset .Name , "mounted" )
280280 break
281281 }
@@ -312,13 +312,21 @@ func printResources(namespace corev1.Namespace, clientset *kubernetes.Clientset,
312312 }
313313}
314314
315+ func containsDockerSock (s string ) bool {
316+ if strings .Contains (s , "docker.sock" ) || strings .Contains (s , "dockershim.sock" ) {
317+ return true
318+ } else {
319+ return false
320+ }
321+ }
322+
315323func printVolumes (w * tabwriter.Writer , volumes []corev1.Volume , namespace , resType , resName string , verbose bool ) bool {
316324 // initialize sockFound to use for exit code
317325 sockFound := false
318326 for _ , v := range volumes {
319327 if v .VolumeSource .HostPath != nil {
320328 mounted := "not-mounted"
321- if strings . Contains (v .VolumeSource .HostPath .Path , "docker.sock" ) {
329+ if containsDockerSock (v .VolumeSource .HostPath .Path ) {
322330 mounted = "mounted"
323331 sockFound = true
324332 }
@@ -365,7 +373,7 @@ func searchFile(path string) (int, error) {
365373
366374 line := 1
367375 for scanner .Scan () {
368- if strings . Contains (scanner .Text (), "docker.sock" ) {
376+ if containsDockerSock (scanner .Text ()) {
369377 return line , nil
370378 }
371379
0 commit comments