From d853ae0536352db13dc851d6d076385b7f71cc76 Mon Sep 17 00:00:00 2001 From: Fabian Deutsch Date: Wed, 8 Nov 2017 13:20:11 +0100 Subject: [PATCH 1/5] manifests: Drop nodeSelectors Signed-off-by: Fabian Deutsch --- manifests/haproxy.yaml.in | 2 -- manifests/iscsi-auth-demo-target.yaml.in | 2 -- manifests/iscsi-demo-target.yaml.in | 2 -- manifests/squid.yaml.in | 2 -- manifests/virt-api.yaml.in | 2 -- manifests/virt-controller.yaml.in | 2 -- manifests/virt-manifest.yaml.in | 2 -- 7 files changed, 14 deletions(-) diff --git a/manifests/haproxy.yaml.in b/manifests/haproxy.yaml.in index 602cdfd3032e..7a45a18cce73 100644 --- a/manifests/haproxy.yaml.in +++ b/manifests/haproxy.yaml.in @@ -44,5 +44,3 @@ spec: periodSeconds: 20 securityContext: runAsNonRoot: true - nodeSelector: - kubernetes.io/hostname: {{ primary_node_name }} diff --git a/manifests/iscsi-auth-demo-target.yaml.in b/manifests/iscsi-auth-demo-target.yaml.in index cb0b176c4fc4..8fddd35e63ef 100644 --- a/manifests/iscsi-auth-demo-target.yaml.in +++ b/manifests/iscsi-auth-demo-target.yaml.in @@ -50,5 +50,3 @@ spec: - name: host hostPath: path: / - nodeSelector: - kubernetes.io/hostname: {{ primary_node_name }} diff --git a/manifests/iscsi-demo-target.yaml.in b/manifests/iscsi-demo-target.yaml.in index 868ea041f75f..fd34a73d9eb7 100644 --- a/manifests/iscsi-demo-target.yaml.in +++ b/manifests/iscsi-demo-target.yaml.in @@ -133,5 +133,3 @@ spec: - name: host hostPath: path: / - nodeSelector: - kubernetes.io/hostname: {{ primary_node_name }} diff --git a/manifests/squid.yaml.in b/manifests/squid.yaml.in index db6560e93676..eac5bab1089d 100644 --- a/manifests/squid.yaml.in +++ b/manifests/squid.yaml.in @@ -31,5 +31,3 @@ spec: protocol: "TCP" securityContext: runAsNonRoot: true - nodeSelector: - kubernetes.io/hostname: {{ primary_node_name }} diff --git a/manifests/virt-api.yaml.in b/manifests/virt-api.yaml.in index 7185bff5bef9..e3bce8f2d1fa 100644 --- a/manifests/virt-api.yaml.in +++ b/manifests/virt-api.yaml.in @@ -38,5 +38,3 @@ spec: protocol: "TCP" securityContext: runAsNonRoot: true - nodeSelector: - kubernetes.io/hostname: {{ primary_node_name }} diff --git a/manifests/virt-controller.yaml.in b/manifests/virt-controller.yaml.in index a88dadb8352b..c900e47a6a63 100644 --- a/manifests/virt-controller.yaml.in +++ b/manifests/virt-controller.yaml.in @@ -54,5 +54,3 @@ spec: timeoutSeconds: 10 securityContext: runAsNonRoot: true - nodeSelector: - kubernetes.io/hostname: {{ primary_node_name }} diff --git a/manifests/virt-manifest.yaml.in b/manifests/virt-manifest.yaml.in index dacc749e90a4..8965f7c9f866 100644 --- a/manifests/virt-manifest.yaml.in +++ b/manifests/virt-manifest.yaml.in @@ -64,5 +64,3 @@ spec: volumes: - name: libvirt-runtime emptyDir: {} - nodeSelector: - kubernetes.io/hostname: {{ primary_node_name }} From d51f1eb5b723bf3115a56678a2157683929b3c85 Mon Sep 17 00:00:00 2001 From: Fabian Deutsch Date: Wed, 8 Nov 2017 13:21:29 +0100 Subject: [PATCH 2/5] manifests: Drop externalIP and use separate service for external exposure Signed-off-by: Fabian Deutsch --- cluster/vagrant/setup_kubernetes_master.sh | 26 +++++++++++++++++++ images/haproxy/haproxy.cfg | 2 +- manifests/haproxy.yaml.in | 4 +-- manifests/squid.yaml.in | 2 -- manifests/virt-api.yaml.in | 4 +-- manifests/virt-controller.yaml.in | 4 +-- manifests/virt-manifest.yaml.in | 4 +-- .../leaderelectionconfig/config.go | 2 +- 8 files changed, 32 insertions(+), 16 deletions(-) diff --git a/cluster/vagrant/setup_kubernetes_master.sh b/cluster/vagrant/setup_kubernetes_master.sh index df51832cb38d..f2ad07d19372 100755 --- a/cluster/vagrant/setup_kubernetes_master.sh +++ b/cluster/vagrant/setup_kubernetes_master.sh @@ -50,6 +50,32 @@ else kubectl create -f kube-$NETWORK_PROVIDER.yaml fi +{ + pushd /vagrant + source hack/config.sh + popd + + # Pretty much equivalent to `kubectl expose service ...` + for SVC in spice-proxy:3128 virt-controller:8182 virt-api:8182 haproxy:8184 virt-manifest:8186; + do + IFS=: read NAME PORT <<<$SVC + kubectl apply -f - < Date: Thu, 2 Nov 2017 11:04:01 +0100 Subject: [PATCH 3/5] tests: Wait for all pods to be running before starting functional tests Signed-off-by: Fabian Deutsch --- automation/test.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/automation/test.sh b/automation/test.sh index 7288c923070d..485d2b600a75 100644 --- a/automation/test.sh +++ b/automation/test.sh @@ -124,7 +124,14 @@ while [ "$(kubectl get pods -o'custom-columns=status:status.containerStatuses[*] sleep 10 done -kubectl get pods +# Wait until all pods are running +while [ -n "$(kubectl get pods --no-headers --all-namespaces | grep -v Running)" ]; do + echo "Waiting for pods in all namespaces to enter the Running state ..." + kubectl get pods --no-headers --all-namespaces | >&2 grep -v Running || true + sleep 5 +done + +kubectl get pods --all-namespaces kubectl version # Disable proxy configuration since it causes test issues From f3140f2eef9866b0c247121b4133888349b582cd Mon Sep 17 00:00:00 2001 From: Fabian Deutsch Date: Thu, 2 Nov 2017 22:04:42 +0100 Subject: [PATCH 4/5] tests: Increase timeouts To prevent timeouts on slower hardware Signed-off-by: Fabian Deutsch --- tests/registry_disk_test.go | 2 +- tests/replicaset_test.go | 2 +- tests/utils.go | 2 +- tests/vm_migration_test.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/registry_disk_test.go b/tests/registry_disk_test.go index 13c53cae6ef0..0e950a70e8de 100644 --- a/tests/registry_disk_test.go +++ b/tests/registry_disk_test.go @@ -85,7 +85,7 @@ var _ = Describe("RegistryDisk", func() { for i := 0; i < num; i++ { obj, err := virtClient.RestClient().Post().Resource("virtualmachines").Namespace(tests.NamespaceTestDefault).Body(vm).Do().Get() Expect(err).To(BeNil()) - tests.WaitForSuccessfulVMStartWithTimeout(obj, 120) + tests.WaitForSuccessfulVMStartWithTimeout(obj, 180) _, err = virtClient.RestClient().Delete().Resource("virtualmachines").Namespace(vm.GetObjectMeta().GetNamespace()).Name(vm.GetObjectMeta().GetName()).Do().Get() Expect(err).To(BeNil()) tests.NewObjectEventWatcher(obj).SinceWatchedObjectResourceVersion().WaitFor(tests.NormalEvent, v1.Deleted) diff --git a/tests/replicaset_test.go b/tests/replicaset_test.go index 27364f4c37e3..4b1f8db60691 100644 --- a/tests/replicaset_test.go +++ b/tests/replicaset_test.go @@ -105,7 +105,7 @@ var _ = Describe("VirtualMachineReplicaSet", func() { rs, err := virtClient.ReplicaSet(tests.NamespaceTestDefault).Get(newRS.ObjectMeta.Name, v12.GetOptions{}) Expect(err).ToNot(HaveOccurred()) return int(rs.Status.ReadyReplicas) - }, 60*time.Second, 1*time.Second).Should(Equal(2)) + }, 120*time.Second, 1*time.Second).Should(Equal(2)) }) It("should not scale when paused and scale when resume", func() { diff --git a/tests/utils.go b/tests/utils.go index 0092ad3a7fac..7f99e4b2cae7 100644 --- a/tests/utils.go +++ b/tests/utils.go @@ -752,7 +752,7 @@ func WaitForSuccessfulVMStartWithTimeout(vm runtime.Object, seconds int) (nodeNa } func WaitForSuccessfulVMStart(vm runtime.Object) string { - return WaitForSuccessfulVMStartWithTimeout(vm, 5) + return WaitForSuccessfulVMStartWithTimeout(vm, 30) } func GetReadyNodes() []k8sv1.Node { diff --git a/tests/vm_migration_test.go b/tests/vm_migration_test.go index 94ddbeba47b4..b8629a744427 100644 --- a/tests/vm_migration_test.go +++ b/tests/vm_migration_test.go @@ -45,7 +45,7 @@ var _ = Describe("VmMigration", func() { var sourceVM *v1.VirtualMachine - var TIMEOUT float64 = 10.0 + var TIMEOUT float64 = 60.0 var POLLING_INTERVAL float64 = 0.1 BeforeEach(func() { From 62f0392e21de1f9a01a03566f9548508ea1061bd Mon Sep 17 00:00:00 2001 From: Fabian Deutsch Date: Wed, 8 Nov 2017 20:42:36 +0100 Subject: [PATCH 5/5] Move external service creation to deployment script Signed-off-by: Fabian Deutsch --- cluster/deploy.sh | 31 ++++++++++++++++++++++ cluster/vagrant/setup_kubernetes_master.sh | 26 ------------------ 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/cluster/deploy.sh b/cluster/deploy.sh index 6d3d3af28faf..b637e4227c51 100755 --- a/cluster/deploy.sh +++ b/cluster/deploy.sh @@ -21,6 +21,32 @@ set -ex KUBECTL=${KUBECTL:-kubectl} +externalServiceManifests() +{ + source hack/config.sh + + # Pretty much equivalent to `kubectl expose service ...` + for SVC in spice-proxy:3128 virt-api:8182 haproxy:8184 virt-manifest:8186; + do + IFS=: read NAME PORT <<<$SVC + cat </dev/null || : @@ -35,6 +61,9 @@ cluster/kubectl.sh --core delete thirdpartyresources --all || : # Make sure that the vms CRD is deleted, we use virtualmachines now cluster/kubectl.sh --core delete customresourcedefinitions vms.kubevirt.io || : +# Remove all external facing services +externalServiceManifests | cluster/kubectl.sh --core delete -f - || : + # Delete everything else for i in `ls manifests/*.yaml`; do $KUBECTL delete -f $i --grace-period 0 2>/dev/null || : @@ -43,6 +72,8 @@ done sleep 2 echo "Deploying ..." +externalServiceManifests | cluster/kubectl.sh --core apply -f - + for i in `ls manifests/*.yaml`; do $KUBECTL create -f $i done diff --git a/cluster/vagrant/setup_kubernetes_master.sh b/cluster/vagrant/setup_kubernetes_master.sh index f2ad07d19372..df51832cb38d 100755 --- a/cluster/vagrant/setup_kubernetes_master.sh +++ b/cluster/vagrant/setup_kubernetes_master.sh @@ -50,32 +50,6 @@ else kubectl create -f kube-$NETWORK_PROVIDER.yaml fi -{ - pushd /vagrant - source hack/config.sh - popd - - # Pretty much equivalent to `kubectl expose service ...` - for SVC in spice-proxy:3128 virt-controller:8182 virt-api:8182 haproxy:8184 virt-manifest:8186; - do - IFS=: read NAME PORT <<<$SVC - kubectl apply -f - <