Skip to content

Spike: generating a CRD reference #238

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

Closed
fhennig opened this issue Jul 7, 2022 · 5 comments
Closed

Spike: generating a CRD reference #238

fhennig opened this issue Jul 7, 2022 · 5 comments
Labels

Comments

@fhennig
Copy link
Contributor

fhennig commented Jul 7, 2022

Many operators are missing a CRD reference for the ProductCluster resource. Instead of manually creating it and having to maintain it, it would be nice if it was possible to generate it from the rust code/the generated CRD files.

This should be spiked for one operator and then put into the templating if possible.

Tested tools

I noticed that if I generate docs for i.e. the DruidCluster, it also generates the docs for all the embedded types, i.e. the S3Resource. I think those should be documented separately.

Conclusion

Good documentation cannot be generated from the CRD file, as a lot of information is missing from it. The one tool that generates nice docs uses the underlying source files as a basis for the docs. This only works with go files.

There is no good tool to do this at the moment.

My preferred solution would be something that integrates with the rust code, like the go solution. That seems way more work than initially thought though.


The config I used for the CRD docs generator:

template_path: templates/crd.template

output_path: output

source_repositories:
  - url: https://github.com/stackabletech/druid-operator
    organization: stackabletech
    short_name: druid-operator
    commit_reference: main
    crd_paths:
      - deploy/crd
    cr_paths:
    metadata:
      druidclusters.druid.stackable.tech:
        owner:
          - https://github.com/orgs/giantswarm/teams/team-honeybadger
        topics:
          - apps
@fhennig
Copy link
Contributor Author

fhennig commented Dec 5, 2022

@maltesander
Copy link
Member

This looks pretty good. This probably also means we should improve our documentation on the exposed structs?

@fhennig
Copy link
Contributor Author

fhennig commented Dec 5, 2022

It does look nice. Not sure how we'd integrate it with the docs, but maybe it can just be visually distinct, it doesn't matter. We can give it the stackable colorscheme though.

Yes, we'd need to make the docs nicer :D

Once thing that it doesn't do but that would be cool is factoring out common elements. I.e. the opa configuration or an S3 connection, that's a common fragment that would only need to be documented once. But I think that can only be seen in the rust code.

@sbernauer
Copy link
Member

We should do that regardless of that, but yes in that case most notably ;)

@fhennig
Copy link
Contributor Author

fhennig commented Dec 13, 2022

I think it would be nice to use this for our docs, I'm making a new ticket for it though, because this one has gotten a bit messy.

#328

@fhennig fhennig closed this as completed Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants