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

[wip] Add support for kubebuilder v2 #15

Open
xrmzju opened this issue Sep 16, 2019 · 10 comments
Open

[wip] Add support for kubebuilder v2 #15

xrmzju opened this issue Sep 16, 2019 · 10 comments

Comments

@xrmzju
Copy link

xrmzju commented Sep 16, 2019

No description provided.

@xrmzju
Copy link
Author

xrmzju commented Sep 16, 2019

for now, two things should do:

  • v2 does not generate doc.go, groupName should not take from doc.go
  • // +genclient comment not supported in v2, should not use this to judge a export type

@ahmetb
Copy link
Owner

ahmetb commented Jan 17, 2020

I encourage you to take a look at the source code.

We heavily rely on //+ comments for discovering certain things like apiGroups, optional fields etc.

If there's an alternative way we can discover these things, we can make code changes. The code is pretty straightforward, search for ExtractCommentTags ,//+ , // + etc.

Maybe there's an easy fix.

@zhenghuiwang
Copy link

zhenghuiwang commented Jan 18, 2020

The code for extracting group name is this line:
https://github.com/ahmetb/gen-crd-api-reference-docs/blob/master/main.go#L190

The package comments are considered by gengo only if it appears in doc.go,
https://github.com/kubernetes/gengo/blob/master/types/types.go#L120
which seems unnecessarily restrictive. kubebuilder v2 no longer generates doc.go.

Is it possible to consider type comments instead of package comments? For kubebuilder v2, some type comments contains // +groupName=...

(A temporary workaround is to manually create a doc.go which contains the // +groupName=... comment.)

@ahmetb
Copy link
Owner

ahmetb commented Jan 18, 2020

Is it possible to consider type comments instead of package comments? For kubebuilder v2, some type comments contains // +groupName=...

Let's be more crisp here. Does every single type that correspond to a CRD actually have this field? (We currently inherit groupName for all types from that.) We currently have 1:1 mapping between "Go packages : groupName".

Let's first make sure these two assumptions still hold true.

@zhenghuiwang
Copy link

Is it possible to consider type comments instead of package comments? For kubebuilder v2, some type comments contains // +groupName=...

Let's be more crisp here. Does every single type that correspond to a CRD actually have this field? (We currently inherit groupName for all types from that.) We currently have 1:1 mapping between "Go packages : groupName".

Let's first make sure these two assumptions still hold true.

To correct my observation: the groupName comments appear in groupversion_info.go at package level.

Examples:
https://github.com/kubeflow/kubeflow/blob/master/components/notebook-controller/api/v1/groupversion_info.go

https://github.com/kubeflow/kubeflow/blob/master/components/profile-controller/api/v1/groupversion_info.go

@ahmetb
Copy link
Owner

ahmetb commented Jan 21, 2020 via email

@yindia
Copy link

yindia commented Jul 17, 2020

@ahmetb Any update on kube builder support ?

@ahmetb
Copy link
Owner

ahmetb commented Jul 17, 2020

Nope, I am not actively working on this.

@yindia
Copy link

yindia commented Jul 17, 2020

@ahmetb I think some one create a pr for the issue. #26

@Starefossen
Copy link

This does currently not work for operators made with later versions of kubebuilder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants