Skip to content

Commit

Permalink
Merge pull request kubevirt#1210 from rthallisey/move-to-usr-bin
Browse files Browse the repository at this point in the history
Move binaries to /usr/bin
  • Loading branch information
Artyom Lukianov authored Jun 25, 2018
2 parents f38377a + e82efdf commit a50dc71
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 32 deletions.
4 changes: 2 additions & 2 deletions cmd/virt-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ RUN useradd -u 1001 --create-home -s /bin/bash virt-api
WORKDIR /home/virt-api
USER 1001

COPY virt-api /virt-api
COPY virt-api /usr/bin/virt-api

ENTRYPOINT [ "/virt-api" ]
ENTRYPOINT [ "/usr/bin/virt-api" ]
4 changes: 2 additions & 2 deletions cmd/virt-controller/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ MAINTAINER "The KubeVirt Project" <[email protected]>
RUN useradd -u 1001 --create-home -s /bin/bash virt-controller
WORKDIR /home/virt-controller
USER 1001
COPY virt-controller /virt-controller
COPY virt-controller /usr/bin/virt-controller

ENTRYPOINT [ "/virt-controller" ]
ENTRYPOINT [ "/usr/bin/virt-controller" ]
4 changes: 2 additions & 2 deletions cmd/virt-handler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ FROM fedora:27

MAINTAINER "The KubeVirt Project" <[email protected]>

COPY virt-handler /virt-handler
COPY virt-handler /usr/bin/virt-handler

ENTRYPOINT [ "/virt-handler" ]
ENTRYPOINT [ "/usr/bin/virt-handler" ]
15 changes: 4 additions & 11 deletions cmd/virt-launcher/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,14 @@ RUN dnf -y install \
sudo && dnf -y clean all && \
test $(id -u qemu) = 107 # make sure that the qemu user really is 107

COPY sock-connector /sock-connector
COPY sh.sh /sh.sh
COPY virt-launcher /virt-launcher

COPY virt-launcher /usr/bin/virt-launcher
COPY kubevirt-sudo /etc/sudoers.d/kubevirt
RUN chmod 0640 /etc/sudoers.d/kubevirt

# Allow qemu to bind privileged ports
RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/qemu-system-x86_64

# libvirtd.sh in this image differs from upstream
RUN rm -f /libvirtd.sh
COPY libvirtd.sh /libvirtd.sh
RUN chmod a+x /libvirtd.sh

COPY entrypoint.sh /entrypoint.sh
RUN mkdir -p /usr/share/kubevirt/virt-launcher
COPY entrypoint.sh libvirtd.sh sh.sh sock-connector /usr/share/kubevirt/virt-launcher/

ENTRYPOINT [ "/entrypoint.sh" ]
ENTRYPOINT [ "/usr/share/kubevirt/virt-launcher/entrypoint.sh" ]
4 changes: 2 additions & 2 deletions cmd/virt-launcher/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ chmod 660 /dev/kvm

# Cockpit/OCP hack to all shoing the vm terminal
mv /usr/bin/sh /usr/bin/sh.orig
mv /sh.sh /usr/bin/sh
mv /usr/share/kubevirt/virt-launcher/sh.sh /usr/bin/sh
chmod +x /usr/bin/sh

./virt-launcher $@ &
virt-launcher $@ &
virt_launcher_pid=$!
while true; do
if ! [ -d /proc/$virt_launcher_pid ]; then
Expand Down
2 changes: 1 addition & 1 deletion cmd/virt-launcher/sh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ args="$@"
if [ "$args" = "-i -c TERM=xterm /bin/sh" ] ; then
namespace="$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)"
name="$(ls /var/run/kubevirt-private/${namespace}/)"
exec /usr/bin/sh.orig -c "/sock-connector /var/run/kubevirt-private/${namespace}/${name}/virt-serial0"
exec /usr/bin/sh.orig -c "/usr/share/kubevirt/virt-launcher/sock-connector /var/run/kubevirt-private/${namespace}/${name}/virt-serial0"
else
exec /usr/bin/sh.orig "$@"
fi
2 changes: 1 addition & 1 deletion manifests/dev/virt-api.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
image: {{.DockerPrefix}}/virt-api:{{.DockerTag}}
imagePullPolicy: IfNotPresent
command:
- "/virt-api"
- "virt-api"
- "--port"
- "8443"
- "--subresources-only"
Expand Down
2 changes: 1 addition & 1 deletion manifests/dev/virt-controller.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
image: {{.DockerPrefix}}/virt-controller:{{.DockerTag}}
imagePullPolicy: IfNotPresent
command:
- "/virt-controller"
- "virt-controller"
- "--launcher-image"
- "{{.DockerPrefix}}/virt-launcher:{{.DockerTag}}"
- "--port"
Expand Down
2 changes: 1 addition & 1 deletion manifests/dev/virt-handler.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
image: {{.DockerPrefix}}/virt-handler:{{.DockerTag}}
imagePullPolicy: IfNotPresent
command:
- "/virt-handler"
- "virt-handler"
- "-v"
- "3"
- "--hostname-override"
Expand Down
6 changes: 3 additions & 3 deletions manifests/release/kubevirt.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ spec:
image: {{.DockerPrefix}}/virt-api:{{.DockerTag}}
imagePullPolicy: IfNotPresent
command:
- "/virt-api"
- "virt-api"
- "--port"
- "8443"
- "--subresources-only"
Expand Down Expand Up @@ -438,7 +438,7 @@ spec:
image: {{.DockerPrefix}}/virt-controller:{{.DockerTag}}
imagePullPolicy: IfNotPresent
command:
- "/virt-controller"
- "virt-controller"
- "--launcher-image"
- "{{.DockerPrefix}}/virt-launcher:{{.DockerTag}}"
- "--port"
Expand Down Expand Up @@ -499,7 +499,7 @@ spec:
image: {{.DockerPrefix}}/virt-handler:{{.DockerTag}}
imagePullPolicy: IfNotPresent
command:
- "/virt-handler"
- "virt-handler"
- "-v"
- "3"
- "--hostname-override"
Expand Down
4 changes: 2 additions & 2 deletions pkg/virt-api/rest/subresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ func (app *SubresourceAPIApp) VNCRequestHandler(request *restful.Request, respon
vmiName := request.PathParameter("name")
namespace := request.PathParameter("namespace")

cmd := []string{"/sock-connector", fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-%s", namespace, vmiName, "vnc")}
cmd := []string{"/usr/share/kubevirt/virt-launcher/sock-connector", fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-%s", namespace, vmiName, "vnc")}
app.requestHandler(request, response, cmd)
}

func (app *SubresourceAPIApp) ConsoleRequestHandler(request *restful.Request, response *restful.Response) {
vmiName := request.PathParameter("name")
namespace := request.PathParameter("namespace")

cmd := []string{"/sock-connector", fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-%s", namespace, vmiName, "serial0")}
cmd := []string{"/usr/share/kubevirt/virt-launcher/sock-connector", fmt.Sprintf("/var/run/kubevirt-private/%s/%s/virt-%s", namespace, vmiName, "serial0")}

app.requestHandler(request, response, cmd)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/virt-controller/services/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (t *templateService) RenderLaunchManifest(vmi *v1.VirtualMachineInstance) (
}
}

command := []string{"/entrypoint.sh",
command := []string{"/usr/share/kubevirt/virt-launcher/entrypoint.sh",
"--qemu-timeout", "5m",
"--name", domain,
"--namespace", namespace,
Expand Down
4 changes: 2 additions & 2 deletions pkg/virt-controller/services/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var _ = Describe("Template", func() {
Expect(pod.Spec.NodeSelector).To(Equal(map[string]string{
v1.NodeSchedulable: "true",
}))
Expect(pod.Spec.Containers[0].Command).To(Equal([]string{"/entrypoint.sh",
Expect(pod.Spec.Containers[0].Command).To(Equal([]string{"/usr/share/kubevirt/virt-launcher/entrypoint.sh",
"--qemu-timeout", "5m",
"--name", "testvmi",
"--namespace", "testns",
Expand Down Expand Up @@ -99,7 +99,7 @@ var _ = Describe("Template", func() {
"kubernetes.io/hostname": "master",
v1.NodeSchedulable: "true",
}))
Expect(pod.Spec.Containers[0].Command).To(Equal([]string{"/entrypoint.sh",
Expect(pod.Spec.Containers[0].Command).To(Equal([]string{"/usr/share/kubevirt/virt-launcher/entrypoint.sh",
"--qemu-timeout", "5m",
"--name", "testvmi",
"--namespace", "default",
Expand Down
2 changes: 1 addition & 1 deletion pkg/virt-launcher/virtwrap/util/libvirt_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func StartLibvirt(stopChan chan struct{}) {
go func() {
for {
exitChan := make(chan struct{})
cmd := exec.Command("/libvirtd.sh")
cmd := exec.Command("/usr/share/kubevirt/virt-launcher/libvirtd.sh")

err := cmd.Start()
if err != nil {
Expand Down

0 comments on commit a50dc71

Please sign in to comment.