Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

operator-sdk v0.19.1 cli does not support all the features that was in v0.18.2. Specifically --enable-delve #3630

Closed
apm-opentt opened this issue Aug 1, 2020 · 5 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@apm-opentt
Copy link

Type of question

Are you asking about community best practices, how to implement a specific feature, or about general context and help around the operator-sdk?
Yes

Question

What did you do?
A clear and concise description of the steps you took (or insert a code snippet).
I am trying to run operator-sdk in local debug mode so I can attach vscode to it. Using operator-sdk v0.18.2 I can do this with the command operator-sdk run local --watch-namespace=default --enable-delve

What did you expect to see?
A clear and concise description of what you expected to happen (or insert a code snippet).
I expect the process to launch like the following

operator-sdk run local --watch-namespace=default --enable-delve
INFO[0000] Running the operator locally; watching namespace "default" 
INFO[0000] Delve debugger enabled with args [--listen=:2345 --headless=true --api-version=2 exec build/_output/bin/opentt-operator-local --] 
API server listening at: [::]:2345
debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1103.0.22
 for x86_64.
Got a connection, launched process build/_output/bin/opentt-operator-local (pid = 8560).

What did you see instead? Under which circumstances?
A clear and concise description of what you expected to happen (or insert a code snippet).
In operator-sdk v0.19.1 local is no longer an option for operator-sdk run

operator-sdk run -h
This command has subcommands that will deploy your Operator with OLM.
Currently only the package manifests format is supported via the 'packagemanifests' subcommand.
Run 'operator-sdk run --help' for more information.

Usage:
  operator-sdk run [command]

Available Commands:
  packagemanifests Deploy an Operator in the package manifests format with OLM

Flags:
  -h, --help   help for run

Global Flags:
      --verbose   Enable verbose logging

I noticed that in v0.19.1, run local is replaced with make run ENABLE_WEBHOOKS=false. However, make run does not have the options to run delve and set namespace. Here is the help output for make run:

make run -h
Usage: make [options] [target] ...
Options:
  -b, -m                      Ignored for compatibility.
  -B, --always-make           Unconditionally make all targets.
  -C DIRECTORY, --directory=DIRECTORY
                              Change to DIRECTORY before doing anything.
  -d                          Print lots of debugging information.
  --debug[=FLAGS]             Print various types of debugging information.
  -e, --environment-overrides
                              Environment variables override makefiles.
  -f FILE, --file=FILE, --makefile=FILE
                              Read FILE as a makefile.
  -h, --help                  Print this message and exit.
  -i, --ignore-errors         Ignore errors from commands.
  -I DIRECTORY, --include-dir=DIRECTORY
                              Search DIRECTORY for included makefiles.
  -j [N], --jobs[=N]          Allow N jobs at once; infinite jobs with no arg.
  -k, --keep-going            Keep going when some targets can't be made.
  -l [N], --load-average[=N], --max-load[=N]
                              Don't start multiple jobs unless load is below N.
  -L, --check-symlink-times   Use the latest mtime between symlinks and target.
  -n, --just-print, --dry-run, --recon
                              Don't actually run any commands; just print them.
  -o FILE, --old-file=FILE, --assume-old=FILE
                              Consider FILE to be very old and don't remake it.
  -p, --print-data-base       Print make's internal database.
  -q, --question              Run no commands; exit status says if up to date.
  -r, --no-builtin-rules      Disable the built-in implicit rules.
  -R, --no-builtin-variables  Disable the built-in variable settings.
  -s, --silent, --quiet       Don't echo commands.
  -S, --no-keep-going, --stop
                              Turns off -k.
  -t, --touch                 Touch targets instead of remaking them.
  -v, --version               Print the version number of make and exit.
  -w, --print-directory       Print the current directory.
  --no-print-directory        Turn off -w, even if it was turned on implicitly.
  -W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
                              Consider FILE to be infinitely new.
  --warn-undefined-variables  Warn when an undefined variable is referenced.
  -N OPTION, --NeXT-option=OPTION
                              Turn on value of NeXT OPTION.

Environment

  • operator-sdk version:
    operator-sdk version: "v0.19.1", commit: "24395e17b0f2601320227b7ca32b5f54db000e42", kubernetes version: "v1.18.2", go version: "go1.14.5 darwin/amd64"
    insert release or Git SHA here

  • Kubernetes version information:

    insert output of kubectl version here

  • Kubernetes cluster kind:

Additional context
Is delve debugging still supported in v0.19.1? If yes, are there any documentation to describe it in v0.19.1?
Thanks!

@camilamacedo86
Copy link
Contributor

Hi @apm-opentt,

Are you using the new layout with the Kubebuilder style or the legacy one? Note that for the legacy layout, you will still able to use operator-sdk run local -enable-delve (See 0.19 local code)

However, beware that the legacy layout will no longer be supported after 1.0.0. For the new layout, it is not a valid option by default but users are able to customize their Makefile as they wish. See that it has the target make run which will run locally the project and besides I do not use delve, I understand that it could be something as in your Makefile.

# Run with delve against the configured Kubernetes cluster in ~/.kube/config
run-delve: generate fmt vet manifests
     go build  main.go
     dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient exec ./main

Please, let us know if it answers your question.

@camilamacedo86 camilamacedo86 reopened this Aug 2, 2020
@camilamacedo86 camilamacedo86 added the triage/support Indicates an issue that is a support question. label Aug 2, 2020
@apm-opentt
Copy link
Author

Thanks @camilamacedo86. operator-sdk run no longer has a local option in v0.19.1. The only available option shown by operator-sdk run --help is:

Available Commands:
  packagemanifests Deploy an Operator in the package manifests format with OLM

I added the run-delve target you provided above to my Makefile. It worked. It would be nice to have this "out of the box" though.

@camilamacedo86
Copy link
Contributor

Hi @apm-opentt,

operator-sdk run no longer has a local option in v0.19.1. The only available option shown by operator-sdk run --help is:

Available Commands:
packagemanifests Deploy an Operator in the package manifests format with OLM

If you created your project with operator-sdk init it means that it is in the new layout. For the new layout operator-sdk run local was replaced by make run. The idea is to allow users to customize their makefile as they wish.

I added the run-delve target you provided above to my Makefile. It worked. It would be nice to have this "out of the box" though.

What do you mean with? Would you like to have this target scaffolded by default?

@apm-opentt
Copy link
Author

Hi @camilamacedo86, I used operator-sdk init. Yes, I would like to have run-delve target scaffolded by default. Thanks!

@camilamacedo86 camilamacedo86 self-assigned this Aug 3, 2020
@camilamacedo86 camilamacedo86 added kind/feature Categorizes issue or PR as related to a new feature. and removed triage/support Indicates an issue that is a support question. labels Aug 3, 2020
@estroz
Copy link
Member

estroz commented Aug 10, 2020

Since this is a go scaffold related issue, this should be addressed in the kubebuilder repo. However this isn't likely something kubebuilder will adopt. The Mikefile is yours to modify, so feel free to add this target!

@estroz estroz closed this as completed Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants