IDE Integration

We don’t require or recommend any specific IDE to develop for K8up. Here’s just some documentation to help you setting-up K8up in some specific IDEs that are in use by the K8up developers.

JetBrains GoLand

You can basically just open the root directory in GoLand and you’ll be mostly ready. Just in order to run the integration tests you will need to do some extra configuration:

  1. Before you can run an integration test from GoLand, you need to run make integration-test.

  2. You need to tell GoLand to consider the integration build tag when building:

    1. Go to PreferencesGoBuild Tags & Vendoring

    2. Put integration into Custom tags

  3. Now try to run a specific integration test.

You can use all the usual shortcuts to quickly run a test (for example Ctrl+Shift+D to debug a specific test method). If it doesn’t work, check the following:

  1. Check that the Custom tags field in PreferencesGoBuild Tags & Vendoring contains to term integration.

  2. Make sure the Working directory of your test’s Run Configuration points to the directory where your test lies, for example /home/your_user/projects/k8up/controllers.

  3. Try to tick Use all custom build tags checkbox in your test’s Run Configuration.

Remember that you need to re-run make integration-test when you ran make clean or when you deleted the ./integration-test directory.

If you’re in doubt about your configuration, check whether make clean integration-test succeeds. If it does, the trouble is probably within your IDE configuration. Otherwise, you’ve likely broken the tests or something else. Check your git diff for a start.

Visual Studio Code

Example VSCode run configuration:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch",
      "type": "go",
      "request": "launch",
      "mode": "auto",
      "program": "${workspaceFolder}/cmd/operator/main.go",
      "env": {
        "BACKUP_IMAGE": "ghcr.io/k8up-io/k8up:latest",
        "BACKUP_GLOBALS3ENDPOINT": "http://somewhere.example.org",
        "BACKUP_GLOBALS3BUCKET": "somebucket",
        "BACKUP_GLOBALSECRETACCESSKEY": "replacewithaccesskey",
        "BACKUP_GLOBALACCESSKEYID": "replacewithkeyid",
        "BACKUP_GLOBALREPOPASSWORD": "somepassword"
      },
      "args": []
    }
  ]
}