Skip to content

Commit

Permalink
Merge pull request kubevirt#560 from fabiand/noNodeSelectorsAndSepara…
Browse files Browse the repository at this point in the history
…teServices

No node selectors and separate services
  • Loading branch information
rmohr authored Nov 9, 2017
2 parents 904d20a + 62f0392 commit b079bc9
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 35 deletions.
9 changes: 8 additions & 1 deletion automation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions cluster/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
apiVersion: v1
kind: Service
metadata:
name: external-$NAME
spec:
externalIPs:
- "$master_ip"
ports:
- port: $PORT
targetPort: $PORT
selector:
app: $NAME
---
EOF
done
}

echo "Cleaning up ..."
# Work around https://github.com/kubernetes/kubernetes/issues/33517
cluster/kubectl.sh --core delete -f manifests/virt-handler.yaml --cascade=false --grace-period 0 2>/dev/null || :
Expand All @@ -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 || :
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion images/haproxy/haproxy.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions manifests/haproxy.yaml.in
Original file line number Diff line number Diff line change
@@ -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
---
Expand Down Expand Up @@ -44,5 +42,3 @@ spec:
periodSeconds: 20
securityContext:
runAsNonRoot: true
nodeSelector:
kubernetes.io/hostname: {{ primary_node_name }}
2 changes: 0 additions & 2 deletions manifests/iscsi-auth-demo-target.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,3 @@ spec:
- name: host
hostPath:
path: /
nodeSelector:
kubernetes.io/hostname: {{ primary_node_name }}
2 changes: 0 additions & 2 deletions manifests/iscsi-demo-target.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,3 @@ spec:
- name: host
hostPath:
path: /
nodeSelector:
kubernetes.io/hostname: {{ primary_node_name }}
4 changes: 0 additions & 4 deletions manifests/squid.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ spec:
ports:
- port: 3128
targetPort: spice-proxy
externalIPs:
- "{{ master_ip }}"
selector:
app: spice-proxy
---
Expand All @@ -31,5 +29,3 @@ spec:
protocol: "TCP"
securityContext:
runAsNonRoot: true
nodeSelector:
kubernetes.io/hostname: {{ primary_node_name }}
6 changes: 1 addition & 5 deletions manifests/virt-api.yaml.in
Original file line number Diff line number Diff line change
@@ -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
---
Expand Down Expand Up @@ -38,5 +36,3 @@ spec:
protocol: "TCP"
securityContext:
runAsNonRoot: true
nodeSelector:
kubernetes.io/hostname: {{ primary_node_name }}
6 changes: 1 addition & 5 deletions manifests/virt-controller.yaml.in
Original file line number Diff line number Diff line change
@@ -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
---
Expand Down Expand Up @@ -54,5 +52,3 @@ spec:
timeoutSeconds: 10
securityContext:
runAsNonRoot: true
nodeSelector:
kubernetes.io/hostname: {{ primary_node_name }}
6 changes: 1 addition & 5 deletions manifests/virt-manifest.yaml.in
Original file line number Diff line number Diff line change
@@ -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
---
Expand Down Expand Up @@ -64,5 +62,3 @@ spec:
volumes:
- name: libvirt-runtime
emptyDir: {}
nodeSelector:
kubernetes.io/hostname: {{ primary_node_name }}
2 changes: 1 addition & 1 deletion pkg/virt-controller/leaderelectionconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/registry_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/replicaset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/vm_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit b079bc9

Please sign in to comment.