Skip to content

Commit

Permalink
🌱 Utilize tilt-provider.yaml and Tilt deploy approach from the Cluste…
Browse files Browse the repository at this point in the history
…r API
  • Loading branch information
dmvolod committed Feb 21, 2025
1 parent 6b72fcd commit badc016
Show file tree
Hide file tree
Showing 4 changed files with 54 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
39 changes: 33 additions & 6 deletions docs/local-development.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
# 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 on the same level folder where Cluster API Operator located:

## 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 this:

```
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.

In particular, for our purposes we only need to set up `tilt-settings.yaml` in Cluster API to enable Cluster API Operator. Add the following fields to the 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 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 to your local cluster every time you make a code change and able to debug deployed code.
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 badc016

Please sign in to comment.