Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: debugging information added #2053

Merged
merged 1 commit into from
Feb 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/book/src/developers/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [Tilt for dev in both CAPZ and CAPI](#tilt-for-dev-in-both-capz-and-capi)
- [Deploying a workload cluster](#deploying-a-workload-cluster)
- [Viewing Telemetry](#viewing-telemetry)
- [Debugging](#debugging)
- [Manual Testing](#manual-testing)
- [Creating a dev cluster](#creating-a-dev-cluster)
- [Building and pushing dev images](#building-and-pushing-dev-images)
Expand Down Expand Up @@ -265,6 +266,49 @@ To view metrics in the Prometheus interface, open the Tilt web interface, select
"metrics: prometheus-operator" resource, and click "View metrics" near the top of the screen. Or
visit http://localhost:9090/ in your browser. <!-- markdown-link-check-disable-line -->

#### Debugging

You can debug CAPZ (or another provider / core CAPI) by running the controllers with delve. When developing using Tilt this is easily done by using the **debug** configuration section in your **tilt-settings.json** file. For example:

```json
{
"default_registry": "${REGISTRY}",
"provider_repos": ["../cluster-api-provider-azure"],
"enable_providers": ["azure", "kubeadm-bootstrap", "kubeadm-control-plane"],
"kustomize_substitutions": {
"AZURE_SUBSCRIPTION_ID_B64": "$(echo "${AZURE_SUBSCRIPTION_ID}" | tr -d '\n' | base64 | tr -d '\n')",
"AZURE_TENANT_ID_B64": "$(echo "${AZURE_TENANT_ID}" | tr -d '\n' | base64 | tr -d '\n')",
"AZURE_CLIENT_SECRET_B64": "$(echo "${AZURE_CLIENT_SECRET}" | tr -d '\n' | base64 | tr -d '\n')",
"AZURE_CLIENT_ID_B64": "$(echo "${AZURE_CLIENT_ID}" | tr -d '\n' | base64 | tr -d '\n')"
},
"debug": {
"azure": {
"continue": true,
"port": 30000
}
}
}
```

> Note you can list multiple controllers or **core** CAPI and expose metrics as well in the debug section. Full details of the options can be seen [here](https://cluster-api.sigs.k8s.io/developer/tilt.html).

If you then start Tilt you can connect to delve via the port defined (i.e. 30000 in the sample). If you are using VSCode then you can use a launch configuration similar to this:

```json
{
"name": "Connect to CAPZ",
"type": "go",
"request": "attach",
"mode": "remote",
"remotePath": "",
"port": 30000,
"host": "127.0.0.1",
"showLog": true,
"trace": "log",
"logOutput": "rpc"
}
```

### Manual Testing

#### Creating a dev cluster
Expand Down