diff --git a/Makefile b/Makefile index f218cab..51158d5 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ help: ## Display this help. ##@ Binaries OS=$(shell uname | tr A-Z a-z) -ifeq ($(shell uname -m),'x86_64') +ifeq ($(shell uname -m),x86_64) ARCH=amd64 else ARCH=arm64 @@ -73,10 +73,11 @@ $(LOCALBIN)/%: $(LOCALBIN) # checks if the binary exists in the PATH and installs it locally otherwise .check-binary-%: - @if ! builtin type -P "$(binary)" $ > /dev/null; then\ - echo "Can't find the $(binary) in path, installing it locally";\ - make $(LOCALBIN)/$(binary);\ - fi; + @(which "$(binary)" $ > /dev/null || test -f $(LOCALBIN)/$(binary)) \ + || (echo "Can't find the $(binary) in path, installing it locally" && make $(LOCALBIN)/$(binary)) + +.check-binary-docker: + @which docker $ > /dev/null || (echo "Please install docker before proceeding" && exit 1) %kind: binary = kind %kind: url = "https://kind.sigs.k8s.io/dl/v$(KIND_VERSION)/kind-$(OS)-$(ARCH)" @@ -119,13 +120,13 @@ $(LOCALBIN)/helm: | $(LOCALBIN) ##@ Bootstrap and setup kubernetes management cluster .PHONY: bootstrap-kind-cluster -bootstrap-kind-cluster: .check-binary-kind .check-binary-kubectl ## Provision local kind cluster +bootstrap-kind-cluster: .check-binary-docker .check-binary-kind .check-binary-kubectl ## Provision local kind cluster @if $(KIND) get clusters | grep -q $(KIND_CLUSTER_NAME); then\ echo "$(KIND_CLUSTER_NAME) kind cluster already installed";\ else\ $(KIND) create cluster --name=$(KIND_CLUSTER_NAME);\ fi - @PATH=$(KUBECTL) config use-context kind-$(KIND_CLUSTER_NAME) + @$(KUBECTL) config use-context kind-$(KIND_CLUSTER_NAME) .PHONY: deploy-2a deploy-2a: .check-binary-helm ## Deploy 2A to the management cluster diff --git a/README.md b/README.md index f8db278..a24ec44 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ All demos in here provide their own complete ClusterTemplates and ServiceTemplat The Setup part for Demos is assumed to be created once before an actual demo is given. +Please make sure that docker is installed on your machine! It's required to run local kind cluster. + ### General Setup 1. Create a 2A Management cluster with kind: @@ -26,9 +28,9 @@ The Setup part for Demos is assumed to be created once before an actual demo is ``` The Demos in this repo require at least 2A v0.0.5 or newer. You can change the version of the 2A by specifying the -3. Monitor the installation of 2A: +3. Monitor the installation of 2A (you probably will need to install `jq` to execute this command): ``` - kubectl get management hmc -o json | jq -r '.status.components | to_entries[] | "\(.key): \(.value.success // .value.error)"' + PATH=$PATH:./bin kubectl get management hmc -o json | jq -r '.status.components | to_entries[] | "\(.key): \(.value.success // .value.error)"' ``` @TODO: document what the output should look like