diff --git a/.circleci/config.yml b/.circleci/config.yml index 3ca5b50b1..d8f93ac81 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -86,10 +86,6 @@ jobs: until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done - - run: - name: Deploy virtual-kubelet - command: | - make skaffold MODE=run - run: name: Run the end-to-end test suite command: | diff --git a/Makefile b/Makefile index 622bbb129..981b7c920 100644 --- a/Makefile +++ b/Makefile @@ -136,17 +136,18 @@ skaffold: -p $(PROFILE) # 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 is also assumed that this virtual-kubelet node has been started with the "--node-name" flag set to NODE_NAME. -# Finally, running the e2e suite is not guaranteed to succeed against a provider other than "mock". +# It automatically deploys the virtual-kubelet with the mock provider by running "make skaffold MODE=run". +# It is the caller's responsibility to cleanup the deployment after running this target (e.g. by running "make skaffold MODE=delete"). .PHONY: e2e e2e: KUBECONFIG ?= $(HOME)/.kube/config -e2e: NAMESPACE ?= default -e2e: NODE_NAME ?= vkubelet-mock-0 -e2e: TAINT_KEY ?= virtual-kubelet.io/provider -e2e: TAINT_VALUE ?= mock -e2e: TAINT_EFFECT ?= NoSchedule +e2e: NAMESPACE := default +e2e: NODE_NAME := vkubelet-mock-0 +e2e: TAINT_KEY := virtual-kubelet.io/provider +e2e: TAINT_VALUE := mock +e2e: TAINT_EFFECT := NoSchedule 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 ./... \ -kubeconfig=$(KUBECONFIG) \ -namespace=$(NAMESPACE) \ diff --git a/README.md b/README.md index 1242045cf..e7aa9384e 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ The diagram below illustrates how Virtual-Kubelet works. Deploy a Kubernetes cluster and make sure it's reachable. +### Outside the Kubernetes cluster + Run the binary with your chosen provider: ```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 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 - 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. -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): - -```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: +To run the e2e test suite, you can run the following command: ```console $ make e2e