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 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/images/haproxy/haproxy.cfg b/images/haproxy/haproxy.cfg index dc986291f832..e04aa7318e29 100644 --- a/images/haproxy/haproxy.cfg +++ b/images/haproxy/haproxy.cfg @@ -25,7 +25,7 @@ backend srvs_kubevirt timeout connect 10s timeout server 1m balance roundrobin - server host1 virt-api-service:8183 resolvers kubernetes + server host1 virt-api:8183 resolvers kubernetes backend srvs_apiserver mode http diff --git a/manifests/haproxy.yaml.in b/manifests/haproxy.yaml.in index 602cdfd3032e..af2b47c6b59c 100644 --- a/manifests/haproxy.yaml.in +++ b/manifests/haproxy.yaml.in @@ -1,13 +1,11 @@ apiVersion: v1 kind: Service metadata: - name: haproxy-service + name: haproxy spec: ports: - port: 8184 targetPort: haproxy - externalIPs : - - "{{ master_ip }}" selector: app: haproxy --- @@ -44,5 +42,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..f93d4ba1babe 100644 --- a/manifests/squid.yaml.in +++ b/manifests/squid.yaml.in @@ -6,8 +6,6 @@ spec: ports: - port: 3128 targetPort: spice-proxy - externalIPs: - - "{{ master_ip }}" selector: app: spice-proxy --- @@ -31,5 +29,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..000e732d4134 100644 --- a/manifests/virt-api.yaml.in +++ b/manifests/virt-api.yaml.in @@ -1,13 +1,11 @@ apiVersion: v1 kind: Service metadata: - name: virt-api-service + name: virt-api spec: ports: - port: 8183 targetPort: virt-api - externalIPs : - - "{{ master_ip }}" selector: app: virt-api --- @@ -38,5 +36,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..b29eced8702c 100644 --- a/manifests/virt-controller.yaml.in +++ b/manifests/virt-controller.yaml.in @@ -1,13 +1,11 @@ apiVersion: v1 kind: Service metadata: - name: virt-controller-service + name: virt-controller spec: ports: - port: 8182 targetPort: virt-controller - externalIPs: - - "{{ master_ip }}" selector: app: virt-controller --- @@ -54,5 +52,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..dfa4a5946abf 100644 --- a/manifests/virt-manifest.yaml.in +++ b/manifests/virt-manifest.yaml.in @@ -1,13 +1,11 @@ apiVersion: v1 kind: Service metadata: - name: virt-manifest-service + name: virt-manifest spec: ports: - port: 8186 targetPort: virt-manifest - externalIPs: - - "{{ master_ip }}" selector: app: virt-manifest --- @@ -64,5 +62,3 @@ spec: volumes: - name: libvirt-runtime emptyDir: {} - nodeSelector: - kubernetes.io/hostname: {{ primary_node_name }} diff --git a/pkg/virt-controller/leaderelectionconfig/config.go b/pkg/virt-controller/leaderelectionconfig/config.go index dfe287eacf9d..129b1111dfc3 100644 --- a/pkg/virt-controller/leaderelectionconfig/config.go +++ b/pkg/virt-controller/leaderelectionconfig/config.go @@ -32,7 +32,7 @@ const ( DefaultRenewDeadline = 10 * time.Second DefaultRetryPeriod = 2 * time.Second DefaultNamespace = "default" - DefaultEndpointName = "virt-controller-service" + DefaultEndpointName = "virt-controller" ) func DefaultLeaderElectionConfiguration() Configuration { 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() {