This is an automated email from the ASF dual-hosted git repository. vishesh pushed a commit to branch update-docs-gha-and-golangci in repository https://gitbox.apache.org/repos/asf/cloudstack-kubernetes-provider.git
commit 70c1607ff3dba1799321fd7371e30eb63f5f4908 Author: vishesh92 <[email protected]> AuthorDate: Tue Nov 25 16:20:19 2025 +0100 Add instructions for debugging --- Makefile | 3 ++- README.md | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0b33fb10..728caa02 100644 --- a/Makefile +++ b/Makefile @@ -58,4 +58,5 @@ lint: @(echo "Running golangci-lint...") golangci-lint run @(echo "Running gofmt...") - @(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) \ No newline at end of file + @(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) + diff --git a/README.md b/README.md index cdd0aaf1..972c8acf 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ Instead, it first obtains the name of the node from Kubernetes, then fetches inf ### Building -At least Go 1.21 is required to build cloudstack-ccm. +At least Go 1.23 is required to build cloudstack-ccm. To build the controller with correct versioning, some build flags need to be passed. 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 so you can simply point it to that. ```bash -./cloudstack-ccm --cloud-provider external-cloudstack --cloud-config ~/.cloud-config --master k8s-apiserver +./cloudstack-ccm --cloud-provider external-cloudstack --cloud-config ./cloud-config --kubeconfig ~/.kube/config ``` Replace k8s-apiserver with the host name of your Kubernetes development clusters's API server. 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. +### Debugging + +You can use the VSCode extension [Go](https://marketplace.visualstudio.com/items?itemName=golang.go) to debug the CCM. +Add the following configuration to the `.vscode/launch.json` file use it to launch the CCM. + +```json +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch CloudStack CCM", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${workspaceFolder}/cmd/cloudstack-ccm", + "env": {}, + "args": [ + "--cloud-provider=external-cloudstack", + "--cloud-config=${workspaceFolder}/cloud-config", + "--kubeconfig=${env:HOME}/.kube/config", + "--leader-elect=false", + "--v=5" + ], + "showLog": true, + "trace": "verbose" + }, + { + "name": "Attach to Process", + "type": "go", + "request": "attach", + "mode": "local", + "processId": 0 + } + ] +} +``` + ## Copyright Copyright 2019 The Apache Software Foundation
