Debug Kubernetes Operator-sdk v1.0.0 locally in Goland

Wrote this Debug Kubernetes Operator-sdk locally in Goland last year before the first major release of the Operator-sdk. Due to changes in the Operator-sdk it’s not valid for version v1.0.0 and greater.

Here are the steps to get debug running with v1.0.0

  • In Goland go to Run\Edit Configurations
  • Select Go Build\+
  • Give the configuration a name
  • In Files add the path to main.go

In Environment add WATCH_NAMESPACE=your-operators-namespace

You can then run the debug from the Run menu

  • Go to Run\debug
  • Select the configuration name you just setup
  • Debug will start and stop at break points