Merge pull request #431 from virtual-kubelet/pires/e2e_vk_auto_deploy

test: deploy vk when running e2e
This commit is contained in:
Jeremy Rickard
2018-12-05 13:06:32 -07:00
committed by GitHub
3 changed files with 38 additions and 32 deletions

View File

@@ -86,10 +86,6 @@ jobs:
until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do
sleep 1; sleep 1;
done done
- run:
name: Deploy virtual-kubelet
command: |
make skaffold MODE=run
- run: - run:
name: Run the end-to-end test suite name: Run the end-to-end test suite
command: | command: |

View File

@@ -136,17 +136,18 @@ skaffold:
-p $(PROFILE) -p $(PROFILE)
# e2e runs the end-to-end test suite against the Kubernetes cluster targeted by the current kubeconfig. # e2e runs the end-to-end test suite against the Kubernetes cluster targeted by the current kubeconfig.
# It is assumed that the virtual-kubelet node to be tested is running as a pod called NODE_NAME inside this Kubernetes cluster. # It automatically deploys the virtual-kubelet with the mock provider by running "make skaffold MODE=run".
# It is also assumed that this virtual-kubelet node has been started with the "--node-name" flag set to NODE_NAME. # It is the caller's responsibility to cleanup the deployment after running this target (e.g. by running "make skaffold MODE=delete").
# Finally, running the e2e suite is not guaranteed to succeed against a provider other than "mock".
.PHONY: e2e .PHONY: e2e
e2e: KUBECONFIG ?= $(HOME)/.kube/config e2e: KUBECONFIG ?= $(HOME)/.kube/config
e2e: NAMESPACE ?= default e2e: NAMESPACE := default
e2e: NODE_NAME ?= vkubelet-mock-0 e2e: NODE_NAME := vkubelet-mock-0
e2e: TAINT_KEY ?= virtual-kubelet.io/provider e2e: TAINT_KEY := virtual-kubelet.io/provider
e2e: TAINT_VALUE ?= mock e2e: TAINT_VALUE := mock
e2e: TAINT_EFFECT ?= NoSchedule e2e: TAINT_EFFECT := NoSchedule
e2e: e2e:
@$(MAKE) skaffold MODE=delete && kubectl delete --ignore-not-found node $(NODE_NAME)
@$(MAKE) skaffold MODE=run
@cd $(PWD)/test/e2e && go test -v -tags e2e ./... \ @cd $(PWD)/test/e2e && go test -v -tags e2e ./... \
-kubeconfig=$(KUBECONFIG) \ -kubeconfig=$(KUBECONFIG) \
-namespace=$(NAMESPACE) \ -namespace=$(NAMESPACE) \

View File

@@ -43,6 +43,8 @@ The diagram below illustrates how Virtual-Kubelet works.
Deploy a Kubernetes cluster and make sure it's reachable. Deploy a Kubernetes cluster and make sure it's reachable.
### Outside the Kubernetes cluster
Run the binary with your chosen provider: Run the binary with your chosen provider:
```bash ```bash
@@ -52,6 +54,31 @@ Run the binary with your chosen provider:
Now that the virtual-kubelet is deployed run `kubectl get nodes` and you should see Now that the virtual-kubelet is deployed run `kubectl get nodes` and you should see
a `virtual-kubelet` node. a `virtual-kubelet` node.
### Inside the Kubernetes cluster (Minikube or Docker for Desktop)
It is possible to run the Virtual Kubelet as a Kubernetes pod inside a Minikube or Docker for Desktop cluster.
As of this writing, automation of this deployment is supported only for the mock provider, and is primarily intended at testing.
In order to deploy the Virtual Kubelet, you need to [install `skaffold`](https://github.com/GoogleContainerTools/skaffold#installation).
You also need to make sure that your current context is either `minikube` or `docker-for-desktop`.
In order to deploy the Virtual Kubelet, run the following command after the prerequisites have been met:
```console
$ make skaffold
```
By default, this will run `skaffold` in [_development_ mode](https://github.com/GoogleContainerTools/skaffold#skaffold-dev).
This will make `skaffold` watch `hack/skaffold/virtual-kubelet/Dockerfile` and its dependencies for changes and re-deploy the Virtual Kubelet when said changes happen.
It will also make `skaffold` stream logs from the Virtual Kubelet pod.
As an alternative, and if you are not concerned about continuous deployment and log streaming, you can run the following command instead:
```console
$ make skaffold MODE=run
```
This will build and deploy the Virtual Kubelet, and return.
## Current Features ## Current Features
- create, delete and update pods - create, delete and update pods
@@ -263,27 +290,9 @@ $ minikube start
``` ```
The e2e suite requires Virtual Kubelet to be running as a pod inside the Kubernetes cluster. The e2e suite requires Virtual Kubelet to be running as a pod inside the Kubernetes cluster.
To make the deployment process easier, the build toolchain leverages on `skaffold`. In order to make the testing process easier, the build toolchain leverages on `skaffold` to automatically deploy the Virtual Kubelet to the Kubernetes cluster using the mock provider.
In order to deploy the Virtual Kubelet, run the following command after [installing `skaffold`](https://github.com/GoogleContainerTools/skaffold#installation): To run the e2e test suite, you can run the following command:
```console
$ make skaffold
```
By default, this will run `skaffold` in [_development_ mode](https://github.com/GoogleContainerTools/skaffold#skaffold-dev).
This will make `skaffold` watch `hack/skaffold/virtual-kubelet/Dockerfile` and its dependencies for changes and re-deploy the Virtual Kubelet when said changes happen.
It will also make `skaffold` stream logs from the Virtual Kubelet pod.
As an alternative, and if you are not concerned about continuous deployment and log streaming, you can run the following command instead:
```console
$ make skaffold MODE=run
```
This will build and deploy the Virtual Kubelet, and return.
To run the e2e test suite, you can now run the following command:
```console ```console
$ make e2e $ make e2e