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

Support custom markers for packages out of api/ #106

Open
buraksekili opened this issue Oct 14, 2024 · 0 comments
Open

Support custom markers for packages out of api/ #106

buraksekili opened this issue Oct 14, 2024 · 0 comments

Comments

@buraksekili
Copy link

Hi team,

First of all, thank you for your work in maintaining this tool. It has been incredibly useful for our project.

I have a use case where my CRDs share common types that are defined outside of the api/<version_number> package, as mentioned in issue #58.

While adding the +groupName and +versionName markers allows dependent packages to be included in the generated documentation, I've encountered a challenge. In my case, adding these k8s-related markers causes issues with internal tooling. Specifically, adding the +versionName marker breaks the functionality of controller-tools. As a result, this solution isn't feasible for my use case; thus, some of the fields in the generated crd docs are not pointing anywhere. Unless I miss something, there is no way for me to use another marker tag to specify the values read by +groupName and +versionName in dependent packages.

At the moment, the tool supports custom markers (this is how I overcame my issue). I was wondering if you would consider extending the functionality to allow the use of custom marker tag keys for +groupName and +versionName, as seen in the following section of the code:

groupName := markerValues.Get("groupName")
if groupName == nil {
return nil
}
version := pkg.Name
if v := markerValues.Get("versionName"); v != nil {
version = v.(string)
}
.

Instead of the following, which is also recognized by controller-gen:

// +groupName=my.group.io
// +versionName=v1alpha1
package common

Perhaps we could implement custom markers like this:

// +mygrouptag=my.group.io
// +myversiontag=v1alpha1
package common

These custom tags (+mygrouptag and +myversiontag) could then be defined through the config file, as shown below:

processor:
  includePackages:
    "github.com/myorg/my-operator/api/common": # Go package name
      groupNameTag: "mygrouptag"  # Custom tag for groupName
      groupVersionTag: "myversiontag"  # Custom tag for versionName

This would provide great flexibility. I already have a toy implementation I use => buraksekili@99f5b67.

Regardless of the proposed solution, any suggestions or ideas to address this issue are most welcome.
Thank you!

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

1 participant