Skip to content

Commit

Permalink
Merge pull request #3 from Algeran/iivchenkov/fix-binary-installations
Browse files Browse the repository at this point in the history
fixed binary checks
  • Loading branch information
Schnitzel authored Dec 20, 2024
2 parents bf80b9a + e8ce80b commit 299f0a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 299f0a6

Please sign in to comment.