Skip to content

Commit

Permalink
Merge pull request #726 from dmvolod/issue-719
Browse files Browse the repository at this point in the history
🌱 Utilize tilt-provider.yaml and Tilt deploy approach from the Cluster API
  • Loading branch information
k8s-ci-robot authored Feb 25, 2025
2 parents 37807cd + bb2b9a1 commit da897f7
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 40 deletions.
34 changes: 0 additions & 34 deletions Tiltfile

This file was deleted.

7 changes: 7 additions & 0 deletions config/tilt/kustomization.yaml
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
40 changes: 34 additions & 6 deletions docs/local-development.md
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.
14 changes: 14 additions & 0 deletions tilt-provider.yaml
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

0 comments on commit da897f7

Please sign in to comment.