Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify manual install of a new cluster with make target #34

Merged
merged 1 commit into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
KUBEBUILDER_VERSION ?= 2.3.1
KUBEBUILDER ?= /usr/local/kubebuilder/bin/kubebuilder

CERTMANAGER_URL ?= https://github.com/jetstack/cert-manager/releases/download/v0.14.1/cert-manager.yaml

GIT_VERSION?=$(shell git log -1 --format="%h")
RELEASE_TAG ?= $(shell git tag --points-at HEAD)

Expand Down Expand Up @@ -56,6 +58,12 @@ else
GOBIN=$(shell go env GOBIN)
endif

# where we store downloaded core
COREPATH ?= out/core
CORE_VERSION ?= v0.3.5
CORE_API ?= https://api.github.com/repos/kubernetes-sigs/cluster-api/releases
CORE_URL ?= https://github.com/kubernetes-sigs/cluster-api/releases/download/$(CORE_VERSION)

# useful function
word-dot = $(word $2,$(subst ., ,$1))

Expand Down Expand Up @@ -222,3 +230,20 @@ $(MANAGERLESS_CLUSTERCTLYAML): $(MANAGERLESS_BASE)
@cat $(CLUSTERCTL_TEMPLATE) | sed 's%URL%$(FULL_MANAGERLESS_MANIFEST)%g' > $@
@echo "managerless ready, command-line is:"
@echo " clusterctl --config=$@ <commands>"

$(COREPATH):
mkdir -p $@

$(COREPATH)/%:
curl -s -L -o $@ $(CORE_URL)/$*

core: $(COREPATH)
# download from core
@$(eval YAMLS := $(shell curl -s -L $(CORE_API) | jq -r '[.[] | select(.tag_name == "$(CORE_VERSION)").assets[] | select(.name | contains("yaml")) | .name] | join(" ")'))
@if [ -n "$(YAMLS)" ]; then $(MAKE) $(addprefix $(COREPATH)/,$(YAMLS)); fi

cluster-init: core managerless
kubectl apply --validate=false -f $(CERTMANAGER_URL)
# because of dependencies, this is allowed to fail once or twice
kubectl apply -f $(COREPATH) || kubectl apply -f $(COREPATH) || kubectl apply -f $(COREPATH)
kubectl apply -f $(FULL_MANAGERLESS_MANIFEST)
5 changes: 3 additions & 2 deletions docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ You now should have a functional manager in [bin/](./bin/) named `manager-<os>-<

### Deploy the core cluster-api provider

This can be done in one of two ways:
This can be done in one of three ways:

* Manually:
* 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.
* apply the cert manager as `kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.14.1/cert-manager.yaml`
* 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
`kubectl apply` multiple times until it all is accepted.
* Make target: This just wraps the above manual steps: `make cluster-init`
* 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.

### Generate the Packet infrastructure provider yaml
Expand Down