generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #726 from dmvolod/issue-719
🌱 Utilize tilt-provider.yaml and Tilt deploy approach from the Cluster API
- Loading branch information
Showing
4 changed files
with
55 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resources: | ||
- ../default | ||
|
||
labels: | ||
- includeSelectors: false | ||
pairs: | ||
cluster.x-k8s.io/provider: capi-operator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,44 @@ | ||
# Local Development | ||
Tilt is favoured by most Cluster API projects for local development, it offers a simple way of creating a local development environment. | ||
Cluster API includes its own Tiltfile that can be used to run Cluster API Operator on a local Kind cluster. | ||
|
||
## Clone the Cluster API repository | ||
|
||
Clone the Cluster API repository in the same directory as the Cluster API Operator: | ||
|
||
## Create a kind cluster | ||
We'll need to create a kind cluster to deploy the operator to. This cluster will be used to deploy `cluster-api-operator` to, along with all dependencies such as `cert-manager` | ||
```bash | ||
kind create cluster | ||
git clone https://github.com/kubernetes-sigs/cluster-api.git | ||
``` | ||
|
||
Afterward, your folder structure should look like as follows: | ||
|
||
``` | ||
some-folder/ | ||
├── cluster-api | ||
└── cluster-api-operator | ||
``` | ||
|
||
## Set up Tilt settings in `cluster-api` folder | ||
|
||
Refer to [this guide](https://cluster-api.sigs.k8s.io/developer/core/tilt.html) to set up Tilt for Cluster API. | ||
|
||
For our use case, you only need to configure `tilt-settings.yaml` in the `cluster-api` directory to enable the Cluster API Operator. Add the following fields to the corresponding lists in `tilt-settings.yaml`: | ||
|
||
```yaml | ||
provider_repos: | ||
- "../cluster-api-operator" | ||
enable_providers: | ||
- capi-operator | ||
enable_core_provider: false | ||
``` | ||
## Run Tilt | ||
Once the cluster is live, and you've confirmed you're using the correct context, you can simply run: | ||
From `cluster-api` folder run: | ||
|
||
```bash | ||
tilt up | ||
make docker-build-e2e # Use locally built CAPI images | ||
make tilt-up | ||
``` | ||
|
||
That's it! Tilt will automatically reload the deployment to your local cluster every time you make a code change. | ||
That's it! Tilt will automatically reload the deployment in your local cluster whenever you make code changes, allowing you to debug the deployed code in real time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: capi-operator | ||
config: | ||
image: gcr.io/k8s-staging-capi-operator/cluster-api-operator | ||
live_reload_deps: | ||
- cmd | ||
- go.mod | ||
- go.sum | ||
- api | ||
- internal | ||
- util | ||
label: CAPIO | ||
kustomize_folder: config/tilt | ||
go_main: cmd/main.go | ||
manager_name: capi-operator-controller-manager |