Skip to content

Commit

Permalink
Merge pull request kubevirt#618 from davidvossel/kill-haproxy-v2
Browse files Browse the repository at this point in the history
Kill HAProxy,Virt-Handler,Spice-Proxy and Redesign of VNC/Console
  • Loading branch information
rmohr authored Jan 4, 2018
2 parents 26f8085 + c395771 commit 41b8f3c
Show file tree
Hide file tree
Showing 64 changed files with 727 additions and 2,137 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ vagrant-sync-optional:
./cluster/vagrant/sync_build.sh 'build optional'

vagrant-deploy: vagrant-sync-config vagrant-sync-build
export KUBECTL="cluster/kubectl.sh --core" && ./cluster/deploy.sh
export KUBECTL="cluster/kubectl.sh" && ./cluster/deploy.sh

.release-functest:
make functest > .release-functest 2>&1
Expand Down
100 changes: 0 additions & 100 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1176,80 +1176,6 @@
}
}
},
"/apis/kubevirt.io/v1alpha1/namespaces/{namespace}/virtualmachines/{name}/console": {
"get": {
"description": "Open a websocket connection to a serial console on the specified VM.",
"summary": "Open a websocket connection to a serial console on the specified VM.",
"operationId": "console",
"parameters": [
{
"type": "string",
"description": "Name of the serial console to connect to",
"name": "console",
"in": "query"
},
{
"pattern": "[a-z0-9][a-z0-9\\-]*",
"type": "string",
"description": "Object name and auth scope, such as for teams and projects",
"name": "namespace",
"in": "path",
"required": true
},
{
"pattern": "[a-z0-9][a-z0-9\\-]*",
"type": "string",
"description": "Name of the resource",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/apis/kubevirt.io/v1alpha1/namespaces/{namespace}/virtualmachines/{name}/spice": {
"get": {
"description": "Returns a remote-viewer configuration file. Run `man 1 remote-viewer` to learn more about the configuration format.",
"produces": [
"text/plain",
"application/json",
"application/yaml"
],
"summary": "Returns a remote-viewer configuration file. Run `man 1 remote-viewer` to learn more about the configuration format.",
"operationId": "spice",
"parameters": [
{
"pattern": "[a-z0-9][a-z0-9\\-]*",
"type": "string",
"description": "Object name and auth scope, such as for teams and projects",
"name": "namespace",
"in": "path",
"required": true
},
{
"pattern": "[a-z0-9][a-z0-9\\-]*",
"type": "string",
"description": "Name of the resource",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "remote-viewer configuration file"
},
"default": {
"description": "remote-viewer configuration file"
}
}
}
},
"/apis/kubevirt.io/v1alpha1/virtualmachinereplicasets": {
"get": {
"description": "Get a list of all VirtualMachineReplicaSet objects.",
Expand Down Expand Up @@ -2985,25 +2911,6 @@
}
}
},
"v1.VirtualMachineGraphics": {
"required": [
"type",
"host",
"port"
],
"properties": {
"host": {
"type": "string"
},
"port": {
"type": "integer",
"format": "int32"
},
"type": {
"type": "string"
}
}
},
"v1.VirtualMachineList": {
"description": "VirtualMachineList is a list of VirtualMachines\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object",
"required": [
Expand Down Expand Up @@ -3120,13 +3027,6 @@
"$ref": "#/definitions/v1.VirtualMachineCondition"
}
},
"graphics": {
"description": "Graphics represent the details of available graphical consoles.",
"type": "array",
"items": {
"$ref": "#/definitions/v1.VirtualMachineGraphics"
}
},
"migrationNodeName": {
"description": "MigrationNodeName is the node where the VM is live migrating to.",
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion automation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

set -ex

kubectl() { cluster/kubectl.sh --core "$@"; }
kubectl() { cluster/kubectl.sh "$@"; }

if [ "$TARGET" = "vagrant-dev" ]; then
cat > hack/config-local.sh <<EOF
Expand Down
20 changes: 0 additions & 20 deletions cluster/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ KUBECTL=${KUBECTL:-kubectl}

source hack/config.sh

spiceProxy() {
cat <<EOF
spec:
template:
spec:
containers:
- name: virt-api
env:
- name: SPICE_PROXY
value: "http://${master_ip}:3128"
---
EOF
}

echo "Cleaning up ..."
# Work around https://github.com/kubernetes/kubernetes/issues/33517
$KUBECTL delete ds -l "kubevirt.io" -n kube-system --cascade=false --grace-period 0 2>/dev/null || :
Expand All @@ -58,14 +44,8 @@ if [ -z "$TARGET" ] || [ "$TARGET" = "vagrant-dev" ]; then
$KUBECTL create -f manifests/dev -R $i
elif [ "$TARGET" = "vagrant-release" ]; then
$KUBECTL create -f manifests/release -R $i
## Tell virt-api where to look for the spice proxy
spiceProxy | $KUBECTL patch deployment virt-api -n kube-system --patch "$(cat -)"
fi

## Expose common services
$KUBECTL expose deployment haproxy --port 8184 -l 'kubevirt.io=haproxy' -n kube-system --external-ip $master_ip
$KUBECTL expose deployment spice-proxy --port 3128 -l 'kubevirt.io=spice-proxy' -n kube-system --external-ip $master_ip

# Deploy additional infra for testing
$KUBECTL create -f manifests/testing -R $i

Expand Down
11 changes: 1 addition & 10 deletions cluster/kubectl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,14 @@ then
exit
fi

if [ "$1" == "console" ] || [ "$1" == "spice" ]; then
cmd/virtctl/virtctl "$@" -s http://${master_ip}:8184
exit
fi

# Print usage from virtctl and kubectl
if [ "$1" == "--help" ] || [ "$1" == "-h" ] ; then
cmd/virtctl/virtctl "$@"
fi

if [ -e ${KUBEVIRT_PATH}cluster/vagrant/.kubeconfig ] &&
[ -e ${KUBEVIRT_PATH}cluster/vagrant/.kubectl ] &&
[ "x$1" == "x--core" ]; then
shift
[ -e ${KUBEVIRT_PATH}cluster/vagrant/.kubectl ]; then
${KUBEVIRT_PATH}cluster/vagrant/.kubectl --kubeconfig=${KUBEVIRT_PATH}cluster/vagrant/.kubeconfig "$@"
elif [ -e ${KUBEVIRT_PATH}cluster/vagrant/.kubectl ];then
${KUBEVIRT_PATH}cluster/vagrant/.kubectl -s http://${master_ip}:8184 "$@"
else
echo "Did you already run '$SYNC_CONFIG' to deploy kubevirt?"
fi
2 changes: 1 addition & 1 deletion cluster/vm-isolation-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ then
exit 1
fi

NODE=$(cluster/kubectl.sh --core get pods -o json -l kubevirt.io/domain=${VM_NAME} | jq '.items[].spec.nodeName' -r)
NODE=$(cluster/kubectl.sh get pods -o json -l kubevirt.io/domain=${VM_NAME} | jq '.items[].spec.nodeName' -r)

if [ -z $NODE ]; then
echo "Could not detect the VM."
Expand Down
38 changes: 0 additions & 38 deletions cmd/virt-api/Dockerfile

This file was deleted.

36 changes: 0 additions & 36 deletions cmd/virt-api/virt-api.go

This file was deleted.

3 changes: 0 additions & 3 deletions cmd/virt-handler/virt-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,8 @@ func (app *virtHandlerApp) Run() {

// TODO add a http handler which provides health check

// Add websocket route to access consoles remotely
console := rest.NewConsoleResource(domainConn)
migrationHostInfo := rest.NewMigrationHostInfo(isolation.NewSocketBasedIsolationDetector(app.VirtShareDir))
ws := new(restful.WebService)
ws.Route(ws.GET("/api/v1/namespaces/{namespace}/virtualmachines/{name}/console").To(console.Console))
ws.Route(ws.GET("/api/v1/namespaces/{namespace}/virtualmachines/{name}/migrationHostInfo").To(migrationHostInfo.MigrationHostInfo))
restful.DefaultContainer.Add(ws)
server := &http.Server{Addr: app.Address(), Handler: restful.DefaultContainer}
Expand Down
6 changes: 6 additions & 0 deletions cmd/virt-launcher/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ FROM fedora:26

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

RUN dnf -y install socat && \
groupadd --gid 107 qemu && \
useradd --uid 107 --gid 107 qemu && \
dnf -y clean all

COPY sock-connector /sock-connector
COPY virt-launcher /virt-launcher

ENTRYPOINT [ "/virt-launcher" ]
4 changes: 4 additions & 0 deletions cmd/virt-launcher/sock-connector
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
stty -echo
SOCKET=$1
socat unix-connect:/$SOCKET stdio,cfmakeraw
5 changes: 5 additions & 0 deletions cmd/virt-launcher/virt-launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func main() {
panic(err)
}

err = virtlauncher.InitializePrivateDirectories(filepath.Join("/var/run/kubevirt-private", *namespace, *name))
if err != nil {
panic(err)
}

watchdogFile := watchdog.WatchdogFileFromNamespaceName(*virtShareDir, *namespace, *name)
err = watchdog.WatchdogFileUpdate(watchdogFile)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions cmd/virtctl/virtctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

"kubevirt.io/kubevirt/pkg/virtctl"
"kubevirt.io/kubevirt/pkg/virtctl/console"
"kubevirt.io/kubevirt/pkg/virtctl/spice"
"kubevirt.io/kubevirt/pkg/virtctl/vnc"
)

func main() {
Expand All @@ -40,7 +40,7 @@ func main() {
registry := map[string]virtctl.App{
"console": &console.Console{},
"options": &virtctl.Options{},
"spice": &spice.Spice{},
"vnc": &vnc.VNC{},
}

if len(os.Args) > 1 {
Expand Down Expand Up @@ -82,7 +82,7 @@ func Usage() {
Basic Commands:
console Connect to a serial console on a VM
spice Connect to a SPICE display of a VM
vnc Connect to a VNC display of a VM
Use "virtctl <command> --help" for more information about a given command.
Use "virtctl options" for a list of global command-line options (applies to all commands).
Expand Down
14 changes: 0 additions & 14 deletions docs/debugging.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
# Debugging

When debugging KubeVirt in the development environment, you have to be aware
that we have a proxy for ThirdPartyResource related preprocessing in front of
the apiserver. By default the `cluster/kubectl.sh` script assumes that you want
to talk to the cluster through that proxy. So if

```bash
cluster/kubectl.sh version
```

is run, `cluster/kubectl.sh` connects to the proxy. However when something is
not right with the proxy, or KubeVirt is not even yet deployed, it is possible
to connect to the apiserver directly by adding `--core` as the first argument.
So

```bash
cluster/kubectl.sh --core version
```

will try to connect to the apiserver.

## Retrieving Logs
Expand Down
2 changes: 1 addition & 1 deletion hack/build-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if [ $# -eq 0 ]; then
if [ "${target}" = "test" ]; then
(cd pkg; go ${target} -v ./...)
elif [ "${target}" = "functest" ]; then
(cd tests; go test -master=http://${master_ip}:${master_port} -timeout 30m ${FUNC_TEST_ARGS})
(cd tests; go test -kubeconfig=../cluster/vagrant/.kubeconfig -timeout 30m ${FUNC_TEST_ARGS})
exit
else
(cd pkg; go $target ./...)
Expand Down
5 changes: 2 additions & 3 deletions hack/config-default.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
binaries="cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virt-api cmd/virtctl cmd/fake-qemu-process cmd/virt-dhcp cmd/fake-dnsmasq-process"
docker_images="cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virt-api images/haproxy images/iscsi-demo-target-tgtd images/vm-killer images/libvirt-kubevirt images/spice-proxy cmd/virt-migrator cmd/registry-disk-v1alpha images/cirros-registry-disk-demo cmd/virt-dhcp"
binaries="cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virtctl cmd/fake-qemu-process cmd/virt-dhcp cmd/fake-dnsmasq-process"
docker_images="cmd/virt-controller cmd/virt-launcher cmd/virt-handler images/iscsi-demo-target-tgtd images/vm-killer images/libvirt-kubevirt cmd/virt-migrator cmd/registry-disk-v1alpha images/cirros-registry-disk-demo cmd/virt-dhcp"
optional_docker_images="cmd/registry-disk-v1alpha images/fedora-atomic-registry-disk-demo"
docker_prefix=kubevirt
docker_tag=${DOCKER_TAG:-latest}
master_ip=192.168.200.2
master_port=8184
network_provider=weave
Loading

0 comments on commit 41b8f3c

Please sign in to comment.