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.
🌱 Utilize tilt-provider.yaml and Tilt deploy approach from the Cluste…
…r API
- Loading branch information
Showing
4 changed files
with
54 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,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. |
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 |