diff --git a/pkg/build/controller/strategy/docker_test.go b/pkg/build/controller/strategy/docker_test.go index 499524c20461..41b127f62b9c 100644 --- a/pkg/build/controller/strategy/docker_test.go +++ b/pkg/build/controller/strategy/docker_test.go @@ -5,6 +5,8 @@ import ( "strings" "testing" + "github.com/google/cadvisor/container/crio" + "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -71,9 +73,7 @@ func TestDockerCreateBuildPod(t *testing.T) { if *actual.Spec.ActiveDeadlineSeconds != 60 { t.Errorf("Expected ActiveDeadlineSeconds 60, got %d", *actual.Spec.ActiveDeadlineSeconds) } - //for i, expected := range []string{buildutil.BuildWorkDirMount, dockerSocketPath, crio.CrioSocket, DockerPushSecretMountPath, DockerPullSecretMountPath} { - // TODO cadvisor and crio disagree. One says '/var/run/crio/crio.sock', the other says "/var/run/crio.sock" - for i, expected := range []string{buildutil.BuildWorkDirMount, dockerSocketPath, "/var/run/crio.sock", DockerPushSecretMountPath, DockerPullSecretMountPath} { + for i, expected := range []string{buildutil.BuildWorkDirMount, dockerSocketPath, crio.CrioSocket, DockerPushSecretMountPath, DockerPullSecretMountPath} { if container.VolumeMounts[i].MountPath != expected { t.Fatalf("Expected %s in VolumeMount[%d], got %s", expected, i, container.VolumeMounts[i].MountPath) } diff --git a/pkg/build/controller/strategy/sti_test.go b/pkg/build/controller/strategy/sti_test.go index a9385795182f..11119c06f91f 100644 --- a/pkg/build/controller/strategy/sti_test.go +++ b/pkg/build/controller/strategy/sti_test.go @@ -5,6 +5,8 @@ import ( "strings" "testing" + "github.com/google/cadvisor/container/crio" + "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -107,9 +109,7 @@ func testSTICreateBuildPod(t *testing.T, rootAllowed bool) { if len(container.VolumeMounts) != 5 { t.Fatalf("Expected 5 volumes in container, got %d", len(container.VolumeMounts)) } - //for i, expected := range []string{buildutil.BuildWorkDirMount, dockerSocketPath, crio.CrioSocket, DockerPushSecretMountPath, DockerPullSecretMountPath} { - // TODO cadvisor and crio disagree. One says '/var/run/crio/crio.sock', the other says "/var/run/crio.sock" - for i, expected := range []string{buildutil.BuildWorkDirMount, dockerSocketPath, "/var/run/crio.sock", DockerPushSecretMountPath, DockerPullSecretMountPath} { + for i, expected := range []string{buildutil.BuildWorkDirMount, dockerSocketPath, crio.CrioSocket, DockerPushSecretMountPath, DockerPullSecretMountPath} { if container.VolumeMounts[i].MountPath != expected { t.Fatalf("Expected %s in VolumeMount[%d], got %s", expected, i, container.VolumeMounts[i].MountPath) } diff --git a/pkg/build/controller/strategy/util.go b/pkg/build/controller/strategy/util.go index a507c261a831..2df3fedb7a13 100644 --- a/pkg/build/controller/strategy/util.go +++ b/pkg/build/controller/strategy/util.go @@ -8,6 +8,8 @@ import ( "github.com/golang/glog" + "github.com/google/cadvisor/container/crio" + "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kvalidation "k8s.io/apimachinery/pkg/util/validation" @@ -23,7 +25,6 @@ import ( const ( // dockerSocketPath is the default path for the Docker socket inside the builder container dockerSocketPath = "/var/run/docker.sock" - crioSocketPath = "/var/run/crio.sock" sourceSecretMountPath = "/var/run/secrets/openshift.io/source" DockerPushSecretMountPath = "/var/run/secrets/openshift.io/push" @@ -98,14 +99,14 @@ func setupCrioSocket(pod *v1.Pod) { Name: "crio-socket", VolumeSource: v1.VolumeSource{ HostPath: &v1.HostPathVolumeSource{ - Path: crioSocketPath, + Path: crio.CrioSocket, }, }, } crioSocketVolumeMount := v1.VolumeMount{ Name: "crio-socket", - MountPath: crioSocketPath, + MountPath: crio.CrioSocket, } pod.Spec.Volumes = append(pod.Spec.Volumes,