Closed harpratap closed 4 years ago
It shows the same as https://github.com/kubernetes-sigs/kubebuilder/issues/786 (duplicated). The project requires fo 1.13. Also, see:
This issue is caused by go modules.
You need to set GO111MODULE=on to use go modules when in GOPATH.
@camilamacedo86 I see. After switching to go 1.13.12 and setting GO111MODULE=on it seems to be trying to fetch the api package.
Error: go [list -e -json -compiled=true -test=false -export=false -deps=true -find=false -tags ignore_autogenerated -- ./...]: exit status 1: go: finding istio.io/api latest build istio.io: cannot load istio.io/api/v1alpha3: module istio.io/api@latest found (v0.0.0-20200626203124-c07d1d63dab7), but does not contain package istio.io/api/v1alpha3
It seems to fetching with a fixed format
What if there's no Go code at all to fetch the api from? What if the CRD is just a yaml? How to create controller for it?
Hi @harpratap,
The istio.io/api/v1alpha3
shows are related to your implementation. Following some comments inline which I hope that helps you with.
It seems to fetching with a fixed format
/api/ but what if the following a different folder structure? like /api/ / ?
What if there's no Go code at all to fetch the api from? What if the CRD is just a yaml? How to create controller for it?
When following the tutorial, one of the first steps is to run the command kubebuilder create api
. The purpose of this command is to generate Custom Resource (CR) and Custom Resource Definition (CRD) resources for the Kind. This command is creating the API with the group, and version which uniquely identifies the new CRD of the Kind.
Consequently, by using the tool, we can create our APIs and objects that will represent our solutions on these platforms. The quick-start adds only a single kind of resource; however, it could have as many Kinds as needed (1…N). Basically, the CRDs are a definition of our customized Objects, and the CRs are an instance of it.
In this way, If you are creating the API via kubebuilder to use it in your project it will generate the <kind>_types.go
where you will define its specifications and status. So, based on your question, I assume that you are trying to use an API defined in another project which it is achievable. For further info, I'd recommend you check the blog How to use third-party APIs in Operator SDK projects. Note that the solution is done using the SDK tool to scaffold the project, however, the same could be applied in a project built with Kubebuilder as well.
/assign @camilamacedo86 /kind bug cancel /kind support-triagge
@camilamacedo86: The label(s) kind/cancel, kind/support-triagge
cannot be applied, because the repository doesn't have them
I am closing this since the main question of your issue is solved with https://github.com/kubernetes-sigs/kubebuilder/issues/1575#issuecomment-650790093 and we already started the second wave of questions which I believe that is sorted out with https://github.com/kubernetes-sigs/kubebuilder/issues/1575#issuecomment-651038192.
However, please feel free to raise new issues as well. Let's try to keep 1(one) subject 1 per issue. Because it allow answers more assertive an have the info tracked a better way to help others as well.
/close
@camilamacedo86: Closing this issue.
I want to create just a controller for a CRD that already exists, so followed the advice given here - https://github.com/kubernetes-sigs/kubebuilder/issues/1270 it works for core types like svc and pods but fails when you try on a custom type.
I expect the controller to run without any errors just like it did for the core types.
After removing all API related code -
What versions of software are you using? Specifically, the following are often useful:
kubebuilder version
) and scaffolding version (check yourPROJECT
file) 2.13.1go.mod
file) v0.5.0kubectl version
against your API server) 1.17.0/kind bug