diff --git a/.gitignore b/.gitignore index 898d07796..9be9b01b6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,6 @@ bundle.Dockerfile *~ .DS_STORE + +# VSCode +.vscode diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..731487da5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug CodeFlare Operator", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${workspaceFolder}/main.go", + "env": { + "KUBECONFIG": "", + "NAMESPACE": "" + }, + "showLog": true + } + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 83edd2f9b..9fd4a3f8b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,3 +56,10 @@ To write and inspect unit tests: - MCAD and InstaScale unit tests under `mcad_controller_test.go` and `instascale_controller_test.go` in the `controllers` dir - Unit test functions are defined in `suite_test.go` (with utils in `util/util.go`) in the `controllers dir` - Test cases defined under `controllers/testdata` + + ## Local debugging with VSCode + Steps outlining how to run the operator locally. + - Ensure you are authenticated to your Kubernetes/OpenShift Cluster. + - Populate the [.vscode/launch.json](https://github.com/project-codeflare/codeflare-operator/tree/main/.vscode/launch.json) file with the location of your Kubernetes config file and desired namespace. + - In VSCode on the activity bar click `Run and Debug` or `CTRL + SHIFT + D` to start a local debugging session of the CodeFlare Operator. + The operator should be running as intended.