Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 5ffcc3c

Browse files
authored
Merge pull request #34 from packethost/simplify-build
simplify manual install of a new cluster with make target
2 parents c29e9b9 + e8f4f46 commit 5ffcc3c

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
KUBEBUILDER_VERSION ?= 2.3.1
44
KUBEBUILDER ?= /usr/local/kubebuilder/bin/kubebuilder
55

6+
CERTMANAGER_URL ?= https://github.com/jetstack/cert-manager/releases/download/v0.14.1/cert-manager.yaml
7+
68
GIT_VERSION?=$(shell git log -1 --format="%h")
79
RELEASE_TAG ?= $(shell git tag --points-at HEAD)
810

@@ -56,6 +58,12 @@ else
5658
GOBIN=$(shell go env GOBIN)
5759
endif
5860

61+
# where we store downloaded core
62+
COREPATH ?= out/core
63+
CORE_VERSION ?= v0.3.5
64+
CORE_API ?= https://api.github.com/repos/kubernetes-sigs/cluster-api/releases
65+
CORE_URL ?= https://github.com/kubernetes-sigs/cluster-api/releases/download/$(CORE_VERSION)
66+
5967
# useful function
6068
word-dot = $(word $2,$(subst ., ,$1))
6169

@@ -222,3 +230,20 @@ $(MANAGERLESS_CLUSTERCTLYAML): $(MANAGERLESS_BASE)
222230
@cat $(CLUSTERCTL_TEMPLATE) | sed 's%URL%$(FULL_MANAGERLESS_MANIFEST)%g' > $@
223231
@echo "managerless ready, command-line is:"
224232
@echo " clusterctl --config=$@ <commands>"
233+
234+
$(COREPATH):
235+
mkdir -p $@
236+
237+
$(COREPATH)/%:
238+
curl -s -L -o $@ $(CORE_URL)/$*
239+
240+
core: $(COREPATH)
241+
# download from core
242+
@$(eval YAMLS := $(shell curl -s -L $(CORE_API) | jq -r '[.[] | select(.tag_name == "$(CORE_VERSION)").assets[] | select(.name | contains("yaml")) | .name] | join(" ")'))
243+
@if [ -n "$(YAMLS)" ]; then $(MAKE) $(addprefix $(COREPATH)/,$(YAMLS)); fi
244+
245+
cluster-init: core managerless
246+
kubectl apply --validate=false -f $(CERTMANAGER_URL)
247+
# because of dependencies, this is allowed to fail once or twice
248+
kubectl apply -f $(COREPATH) || kubectl apply -f $(COREPATH) || kubectl apply -f $(COREPATH)
249+
kubectl apply -f $(FULL_MANAGERLESS_MANIFEST)

docs/BUILD.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ You now should have a functional manager in [bin/](./bin/) named `manager-<os>-<
4242

4343
### Deploy the core cluster-api provider
4444

45-
This can be done in one of two ways:
45+
This can be done in one of three ways:
4646

47-
* Manually:
47+
* Manually: This generally is not recommended, but is good for seeing the various parts that make up a manager cluster, understanding how they work together, and debugging issues.
4848
* apply the cert manager as `kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.14.1/cert-manager.yaml`
4949
* download the components from the [official cluster-api releases page](https://github.com/kubernetes-sigs/cluster-api/releases); you will need all of the `.yaml` files in a release. Then run `kubectl apply -f <dir>` to whatever directory you downloaded it. The order _does_ matter, and the CRDs have to exist, so you might need to
5050
`kubectl apply` multiple times until it all is accepted.
51+
* Make target: This just wraps the above manual steps: `make cluster-init`
5152
* CLI: use the `clusterctl` binary from the [official cluster-api releases page](https://github.com/kubernetes-sigs/cluster-api/releases) to deploy to your cluster. This will download the yaml files, apply them and ensure that CRDs are in place before applying the rest.
5253

5354
### Generate the Packet infrastructure provider yaml

0 commit comments

Comments
 (0)