8000 Add make target to install required CLIs by eromanova · Pull Request #75 · k0rdent/kcm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add make target to install required CLIs #75

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

Merged
merged 1 commit into from
Jul 2, 2024
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
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ IMG ?= hmc/controller:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.29.0

os = $(shell uname|tr DL dl)
OS := $(strip ${os})

ARCH := $(shell uname -m)

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
Expand Down Expand Up @@ -303,6 +308,9 @@ dev-aws-apply:
dev-aws-destroy:
$(KUBECTL) -n $(NAMESPACE) delete -f config/dev/deployment.yaml

.PHONY: cli-install
cli-install: clusterawsadm clusterctl

##@ Dependencies

## Location to install dependencies to
Expand Down Expand Up @@ -330,6 +338,8 @@ HELM ?= $(LOCALBIN)/helm-$(HELM_VERSION)
HELMIFY ?= $(LOCALBIN)/helmify-$(HELMIFY_VERSION)
KIND ?= $(LOCALBIN)/kind-$(KIND_VERSION)
YQ ?= $(LOCALBIN)/yq-$(YQ_VERSION)
CLUSTERAWSADM ?= $(LOCALBIN)/clusterawsadm
CLUSTERCTL ?= $(LOCALBIN)/clusterctl

FLUX_CHART_REPOSITORY ?= oci://ghcr.io/fluxcd-community/charts/flux2
FLUX_CHART_VERSION ?= 2.13.0
Expand All @@ -344,6 +354,8 @@ HELM_VERSION ?= v3.15.1
HELMIFY_VERSION ?= v0.4.13
KIND_VERSION ?= v0.23.0
YQ_VERSION ?= v4.44.2
CLUSTERAWSADM_VERSION ?= v2.5.2
CLUSTERCTL_VERSION ?= v1.7.3

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand Down Expand Up @@ -387,6 +399,17 @@ yq: $(YQ) ## Download yq locally if necessary.
$(YQ): | $(LOCALBIN)
$(call go-install-tool,$(YQ),github.com/mikefarah/yq/v4,${YQ_VERSION})

.PHONY: clusterawsadm
clusterawsadm: $(CLUSTERAWSADM) ## Download clusterawsadm locally if necessary.
$(CLUSTERAWSADM): | $(LOCALBIN)
curl -sL https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/download/$(CLUSTERAWSADM_VERSION)/clusterawsadm_$(CLUSTERAWSADM_VERSION)_$(OS)_$(ARCH) -o $(CLUSTERAWSADM)
chmod +x $(CLUSTERAWSADM)

.PHONY: clusterctl
clusterctl: $(CLUSTERCTL) ## Download clusterctl locally if necessary.
$(CLUSTERCTL): | $(LOCALBIN)
$(call go-install-tool,$(CLUSTERCTL),sigs.k8s.io/cluster-api/cmd/clusterctl,${CLUSTERCTL_VERSION})

$(FLUX_HELM_CRD): | $(EXTERNAL_CRD_DIR)
rm -f $(FLUX_HELM_CRD)
curl -s https://raw.githubusercontent.com/fluxcd/helm-controller/$(FLUX_HELM_VERSION)/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml > $(FLUX_HELM_CRD)
Expand Down
50 changes: 15 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,18 @@ The kind cluster acts as management in this example.

### Prerequisites

#### Install `clusterawsadm`
#### Clone HMC repository

1. Download the latest release of `clusterawsadm` binary:

Linux:
```
curl -L https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/download/v0.0.0/clusterawsadm-linux-amd64 -o clusterawsadm
```

macOS:
git clone https://github.com/Mirantis/hmc.git && cd hmc
```
curl -L https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/download/v0.0.0/clusterawsadm-darwin-amd64 -o clusterawsadm

```
or if your Mac has an M1 CPU (”Apple Silicon”):
```
curl -L https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/download/v0.0.0/clusterawsadm-darwin-arm64 -o clusterawsadm
```
#### Install required CLIs

2. Make it executable, move to a directory present in your PATH and check version:
Run:

```
chmod +x clusterawsadm
sudo mv clusterawsadm /usr/local/bin
clusterawsadm version
make cli-install
```

#### AWS IAM setup
Expand All @@ -53,7 +40,7 @@ export AWS_SESSION_TOKEN=<session-token> # Optional. If you are using Multi-Fact
2. After these are set run this command to create IAM cloud formation stack:

```
clusterawsadm bootstrap iam create-cloudformation-stack
./bin/clusterawsadm bootstrap iam create-cloudformation-stack
```

#### Configure AWS credentials for the bootstrap
Expand All @@ -77,37 +64,30 @@ export AWS_SESSION_TOKEN=<session-token> # Optional. If you are using Multi-Fact
encodes them in a value to be stored in a Kubernetes Secret.

```
export AWS_B64ENCODED_CREDENTIALS=$(clusterawsadm bootstrap credentials encode-as-profile)
export AWS_B64ENCODED_CREDENTIALS=$(./bin/clusterawsadm bootstrap credentials encode-as-profile)
```

#### Deploy HMC

1. Clone `Mirantis/hmc` repository

Example:
```
git clone https://github.com/Mirantis/hmc.git && cd hmc
```
### Deploy HMC

2. Configure your cluster parameters in `config/dev/deployment.yaml`:
1. Configure your cluster parameters in `config/dev/deployment.yaml`:

* Configure the `name` of the deployment
* Change `amiID` and `instanceType` for control plane and worker machines
* Specify the number of control plane and worker machines, etc

4. Run `make dev-apply` to deploy and configure management cluster
2. Run `make dev-apply` to deploy and configure management cluster

5. Wait a couple of minutes for management components to be up and running
3. Wait a couple of minutes for management components to be up and running

6. Run `make dev-aws-apply` to deploy managed cluster on AWS with default configuration
4. Run `make dev-aws-apply` to deploy managed cluster on AWS with default configuration

7. Wait for infrastructure to be provisioned and the cluster to be deployed. You may watch the process with the
`clusterctl describe` command. Example:
5. Wait for infrastructure to be provisioned and the cluste 5AB6 r to be deployed. You may watch the process with the
`./bin/clusterctl describe` command. Example:

```
export KUBECONFIG=~/.kube/config

clusterctl describe cluster <deployment-name> -n hmc-system --show-conditions all
./bin/clusterctl describe cluster <deployment-name> -n hmc-system --show-conditions all
```

8. Retrieve the `kubeconfig` of your managed cluster:
Expand Down
0