-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Operator-SDK add api error #2490
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
Comments
Hi @sky-big, Could you please provide the full information? Environment
|
Hi @camilamacedo86 , operator-sdk version:v0.15.1 |
This isn't even talking to kubernetes yet |
Operate System:Centos7.2 |
Hi @sky-big, Could you please let us know if you are following the quick start? Have you already change the specs of any type in the project before run this command? If yes, could you share snaps of the code? |
@sky-big This is typically an issue with the fields added to your structs in |
This is all I have to do, I failed in step 2, I haven't modified the *_types.go file yet @joelanford
|
I failed the second step by following quick start @camilamacedo86 |
Hi @sky-big, As @joelanford explained this error usually occurs because of wrong definitions in the _types files where you define the specs. Also, it is essential to highlight that these steps are fully tested and ensured automatically via the CI; besides, also, I am unable to reproduce your scenario manually. In this way, it shows that you have some issue with the scaffolded project and/or local env setup. So, in order to help you with. Let's do it step by step and re-check/re-config all OK following my recommendation and suggestions.
Tips:
Recommendations: Also, if you are Getting Started with SDK and Go projects, I'd recommend you follow up the Getting Started instead of the Quick Started since it will provide a better context and example. And then, check the blog post Getting started with Golang Operators by using Operator SDK to have a further understatement over the example done in the Getting Started guide. Please, let us know if it makes sense and if you could solve the issue with the information provided. |
@camilamacedo86 For what it's worth, I'm hitting the exact same situation as @sky-big, despite following the documentation (both Quick Start and Getting Started). I'm on Ubuntu 19.10, but otherwise it's exactly as @sky-big describes. |
I'm not able to reproduce this either. We've seen issues with the code generators because they can sometimes rely on some Go environment variables being set, which are not usually necessary to set in normal Go installations (see #2426) Can you run the following command and retry: unset GOROOT
export GOROOT=$(go env GOROOT) |
That actually worked! Thanks! |
@joelanford Very good method |
@joelanford I think I've got some additional information on this one that might be useful: this issue only appears on some of the linux (at least) binaries on the releases page, but not all. It seems like it might depend on the environment of the developer who built the binary. For example, if I don't have
Notably, v0.15.0 doesn't give me this behaviour, it just works. Maybe @jmccormick2001 has some magic? Also, if I build the broken versions locally myself, they don't have the issue that the binaries on the GitHub releases page have. |
I did the 1.15.0 build on a Fedora 31 host. I'll re-open this one so that we can confirm this one. |
I can replicate this issue on Ubuntu 18.04 very easily. The only solution I found is setting the GOROOT as described here. |
Hi @jmccormick2001, It is caused because of an error in your local env. You need to set the go env GOROOT. See: The GOROOT environment variable point to the directory where the go which should be used is installed. In this way, I understand that usually, you don’t need to set $GOROOT variable. However, you may face issues in some scenarios. For example; if you have more than one go version installed locally, or if you installed it in different locally from where was recommend or if you use homebrew to install. Just to illustrate the homebrew scenario see, for example, https://coderwall.com/p/c00m1g/set-goroot-variable-with-homebre Duplication of many: |
HI as described above all shows sorted out here, so I am closing this one. However, please feel free to re-open if you see that something still required to be done regards this issue. |
I am also hitting this, only setting GOROOT as described by @joelanford works. However operator-sdk v0.13.0 works without a problem(which was the version I used before testing the v0.16.0 version). I am also pretty sure I never set GOROOT in my environment when using the v0.13.0. So what has changed? |
@loxley the most bizarre thing is that for me it was v0.15.0 that worked fine, and for you it was v0.13.0. 🤷 I wonder if it's some similarity to the environment in which it was built -- e.g. I use Fedora 31, the same as jmccormick2001 built v0.15.0 on. Maybe your local environment is similar to that of whoever built v0.13.0? In any case, explicitly setting GOROOT seems to be the only consistent fix. |
Uh oh!
There was an error while loading. Please reload this page.
$ operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService
By @camilamacedo86 : Add info to centralized:
operator-sdk version:v0.15.1
go version:go1.13 linux/amd64
I'm writing operator in go
Operate System:Centos7.2
The text was updated successfully, but these errors were encountered: