Skip to content

Commit c6db0cb

Browse files
committed
🌱 Utilize tilt-provider.yaml and Tilt deploy approach from the Cluster API
1 parent 6b72fcd commit c6db0cb

File tree

4 files changed

+54
-40
lines changed

4 files changed

+54
-40
lines changed

Tiltfile

Lines changed: 0 additions & 34 deletions
This file was deleted.

config/tilt/kustomization.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resources:
2+
- ../default
3+
4+
labels:
5+
- includeSelectors: false
6+
pairs:
7+
cluster.x-k8s.io/provider: capi-operator

docs/local-development.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,43 @@
11
# Local Development
22
Tilt is favoured by most Cluster API projects for local development, it offers a simple way of creating a local development environment.
3+
Cluster API includes its own Tiltfile that can be used to run Cluster API Operator on a local Kind cluster.
4+
5+
## Clone the Cluster API repository
6+
7+
Clone the Cluster API repository in the same directory as the Cluster API Operator:
38

4-
## Create a kind cluster
5-
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`
69
```bash
7-
kind create cluster
10+
git clone https://github.com/kubernetes-sigs/cluster-api.git
11+
```
12+
13+
Afterward, your folder structure should look like as follows:
14+
15+
```
16+
some-folder/
17+
├── cluster-api
18+
└── cluster-api-operator
19+
```
20+
21+
## Set up Tilt settings in `cluster-api` folder
22+
23+
Refer to [this guide](https://cluster-api.sigs.k8s.io/developer/core/tilt.html) to set up Tilt for Cluster API.
24+
25+
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`:
26+
27+
```yaml
28+
provider_repos:
29+
- "../cluster-api-operator"
30+
enable_providers:
31+
- capi-operator
32+
enable_core_provider: false
833
```
934
1035
## Run Tilt
11-
Once the cluster is live, and you've confirmed you're using the correct context, you can simply run:
36+
37+
From `cluster-api` folder run:
38+
1239
```bash
13-
tilt up
40+
make tilt-up
1441
```
1542

16-
That's it! Tilt will automatically reload the deployment to your local cluster every time you make a code change.
43+
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.

tilt-provider.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: capi-operator
2+
config:
3+
image: gcr.io/k8s-staging-capi-operator/cluster-api-operator
4+
live_reload_deps:
5+
- cmd
6+
- go.mod
7+
- go.sum
8+
- api
9+
- internal
10+
- util
11+
label: CAPIO
12+
kustomize_folder: config/tilt
13+
go_main: cmd/main.go
14+
manager_name: capi-operator-controller-manager

0 commit comments

Comments
 (0)