Skip to content

Commit 70c1607

Browse files
committed
Add instructions for debugging
1 parent 266ed58 commit 70c1607

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ lint:
5858
@(echo "Running golangci-lint...")
5959
golangci-lint run
6060
@(echo "Running gofmt...")
61-
@(echo "gofmt -l"; FMTFILES="$$(gofmt -l .)"; if test -n "$${FMTFILES}"; then echo "Go files that need to be reformatted (use 'go fmt'):\n$${FMTFILES}"; exit 1; fi)
61+
@(echo "gofmt -l"; FMTFILES="$$(gofmt -l .)"; if test -n "$${FMTFILES}"; then echo "Go files that need to be reformatted (use 'go fmt'):\n$${FMTFILES}"; exit 1; fi)
62+

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Instead, it first obtains the name of the node from Kubernetes, then fetches inf
126126

127127
### Building
128128

129-
At least Go 1.21 is required to build cloudstack-ccm.
129+
At least Go 1.23 is required to build cloudstack-ccm.
130130

131131
To build the controller with correct versioning, some build flags need to be passed.
132132
A Makefile is provided that sets these build flags to automatically derived values.
@@ -151,13 +151,50 @@ The CCM supports the same cloud-config configuration file format used by [the cs
151151
so you can simply point it to that.
152152

153153
```bash
154-
./cloudstack-ccm --cloud-provider external-cloudstack --cloud-config ~/.cloud-config --master k8s-apiserver
154+
./cloudstack-ccm --cloud-provider external-cloudstack --cloud-config ./cloud-config --kubeconfig ~/.kube/config
155155
```
156156

157157
Replace k8s-apiserver with the host name of your Kubernetes development clusters's API server.
158158

159159
If you don't have a 'real' CloudStack installation, you can also launch a local [simulator instance](https://hub.docker.com/r/cloudstack/simulator) instead. This is very useful for dry-run testing.
160160

161+
### Debugging
162+
163+
You can use the VSCode extension [Go](https://marketplace.visualstudio.com/items?itemName=golang.go) to debug the CCM.
164+
Add the following configuration to the `.vscode/launch.json` file use it to launch the CCM.
165+
166+
```json
167+
{
168+
"version": "0.2.0",
169+
"configurations": [
170+
{
171+
"name": "Launch CloudStack CCM",
172+
"type": "go",
173+
"request": "launch",
174+
"mode": "auto",
175+
"program": "${workspaceFolder}/cmd/cloudstack-ccm",
176+
"env": {},
177+
"args": [
178+
"--cloud-provider=external-cloudstack",
179+
"--cloud-config=${workspaceFolder}/cloud-config",
180+
"--kubeconfig=${env:HOME}/.kube/config",
181+
"--leader-elect=false",
182+
"--v=5"
183+
],
184+
"showLog": true,
185+
"trace": "verbose"
186+
},
187+
{
188+
"name": "Attach to Process",
189+
"type": "go",
190+
"request": "attach",
191+
"mode": "local",
192+
"processId": 0
193+
}
194+
]
195+
}
196+
```
197+
161198
## Copyright
162199

163200
Copyright 2019 The Apache Software Foundation

0 commit comments

Comments
 (0)