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

[v16] Auto-generate operator CRD docs #45538

Merged
merged 4 commits into from
Sep 5, 2024
Merged

Conversation

ptgott
Copy link
Contributor

@ptgott ptgott commented Aug 15, 2024

Backports #44107

  • Auto-generate operator CRD docs

We already pull JSON schema data from Teleport protobuf message definitions in order to generate CRD manifests. Extract a shared library from code within the existing protoc plugin for generating CRDs. This way, we can use the library to generate docs for our CRDs with a separate plugin, and don't need to complicate the interface for using the existing plugin.

  • Organize integrations/crdgen into lib and cmd directories, turning lib into a package.
  • Edit the generateSchema signature to include a function that formats a CRD into a document, injecting separate functions for formatting the CRD as YAML and as a docs page.
  • Add Makefile targets for building the docs plugin and generating CRD docs.

To display the resulting reference pages in the docs, this change configures docs/config.json to generate the Reference section of the sidebar from the docs directory. This requires moving the Helm reference includes directory into docs/pages/includes.

  • Respond to hugoShaka feedback
  • Do not display the status field.
  • Indicate that enum fields can take an integer or a string. This is consistent with our comment conventions, which describe both the integer and the string values for each enum option.
  • Sort CRD reference page sections

Also handle duplicate page sections by including the names of parent properties within section headings.

  • Fix crdgen Makefile targets
  • bring test data and hack out of lib/
  • fix broken debug builds
  • add crd-docs checks to the crds-up-to-date target
  • trigger proto lint on CRD and CRD doc changes
  • removed stale gitkeep in docs/pages/includes/crd-docs/.gitkeep
  • split crdgen formatting logic in another file for readability
  • update license header years on new files
  • fixup! Fix crdgen Makefile targets

  • lint files due to false positive 'generated' comment

  • fixup! lint files due to false positive 'generated' comment

  • Incorporate rosstimothy feedback

Remove an unnecessary package.

Also regenerate the CRD docs.

  • fix debug builds and gitignore

  • fixup! fix debug builds and gitignore

  • Respond to rosstimothy feedback

Fix integrations/operator/crdgen/Makefile

  • Fix spelling

  • Fix flaky propertyTable test

Compare the unsorted slice elements, since sorting takes place on the containing VersionSection.


@public-teleport-github-review-bot

@ptgott - this PR will require admin approval to merge due to its size. Consider breaking it up into a series smaller changes.

@github-actions github-actions bot requested review from hugoShaka and tigrato August 15, 2024 18:57
Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

Copy link

🤖 Vercel preview here: https://docs-hxtz1w1rv-goteleport.vercel.app/docs/ver/preview

@ptgott ptgott force-pushed the paul.gottschling/44107-bp-v16 branch from 214cd95 to 4dc5edd Compare August 28, 2024 19:39
Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

Copy link

🤖 Vercel preview here: https://docs-mn92rifzk-goteleport.vercel.app/docs/ver/preview

@ptgott ptgott added the no-changelog Indicates that a PR does not require a changelog entry label Aug 30, 2024
@ptgott ptgott force-pushed the paul.gottschling/44107-bp-v16 branch from 4dc5edd to 7908735 Compare August 30, 2024 12:58
Copy link

🤖 Vercel preview here: https://docs-6pcy0c2tz-goteleport.vercel.app/docs/ver/preview

docs/cspell.json Outdated
Comment on lines 845 to 910
"specallow",
"specallowdb",
"specallowimpersonate",
"specallowjoin",
"specallowkubernetes",
"specallowrequest",
"specallowrequestclaims",
"specallowrequestthresholds",
"specallowrequire",
"specallowreview",
"specallowrules",
"specallowspiffe",
"specassertion",
"specattributes",
"specaudit",
"specauditnotifications",
"specauditrecurrence",
"specazure",
"specazureallow",
"speccircleci",
"speccircleciallow",
"specclaims",
"specclient",
"speccloud",
"specdeny",
"specdenydb",
"specdenyimpersonate",
"specdenyjoin",
"specdenykubernetes",
"specdenyrequest",
"specdenyrequestclaims",
"specdenyrequestthresholds",
"specdenyrequire",
"specdenyreview",
"specdenyrules",
"specdenyspiffe",
"specgcp",
"specgcpallow",
"specgithub",
"specgithuballow",
"specgitlab",
"specgitlaballow",
"specgrants",
"speckubernetes",
"speckubernetesallow",
"speckubernetesstatic",
"specmappings",
"specmembership",
"specoidc",
"specoptions",
"specoptionscert",
"specoptionsidp",
"specoptionsidpsaml",
"specoptionsrecord",
"specowner",
"specowners",
"specownership",
"specrotation",
"specrotationschedule",
"specsaml",
"specsigning",
"specspacelift",
"specspaceliftallow",
"specteams",
"spectpm",
"spectpmallow",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't scale, can we skip the spell check on the links or those pages instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a PR to address this on master here: #46259

Copy link

github-actions bot commented Sep 5, 2024

🤖 Vercel preview here: https://docs-8f8xzvrdo-goteleport.vercel.app/docs/ver/preview

@ptgott ptgott disabled auto-merge September 5, 2024 15:53
@ptgott ptgott force-pushed the paul.gottschling/44107-bp-v16 branch from e588796 to 8ddf45e Compare September 5, 2024 15:56
@ptgott ptgott enabled auto-merge September 5, 2024 15:56
Copy link

github-actions bot commented Sep 5, 2024

🤖 Vercel preview here: https://docs-g7za1i7a7-goteleport.vercel.app/docs/ver/preview

@ptgott ptgott force-pushed the paul.gottschling/44107-bp-v16 branch from 8ddf45e to ae2c274 Compare September 5, 2024 17:13
Copy link

github-actions bot commented Sep 5, 2024

🤖 Vercel preview here: https://docs-lfrjb1fpv-goteleport.vercel.app/docs/ver/preview

@ptgott ptgott force-pushed the paul.gottschling/44107-bp-v16 branch from ae2c274 to d7b3222 Compare September 5, 2024 17:30
Copy link

github-actions bot commented Sep 5, 2024

🤖 Vercel preview here: https://docs-freizogjb-goteleport.vercel.app/docs/ver/preview

ptgott and others added 4 commits September 5, 2024 16:01
Backports #44107

* Auto-generate operator CRD docs

We already pull JSON schema data from Teleport protobuf message
definitions in order to generate CRD manifests. Extract a shared library
from code within the existing protoc plugin for generating CRDs. This
way, we can use the library to generate docs for our CRDs with a
separate plugin, and don't need to complicate the interface for using
the existing plugin.

- Organize `integrations/crdgen` into `lib` and `cmd` directories,
  turning `lib` into a package.
- Edit the `generateSchema` signature to include a function that formats
  a CRD into a document, injecting separate functions for formatting the
  CRD as YAML and as a docs page.
- Add Makefile targets for building the docs plugin and generating CRD
  docs.

To display the resulting reference pages in the docs, this change
configures `docs/config.json` to generate the Reference section of the
sidebar from the docs directory. This requires moving the Helm reference
includes directory into `docs/pages/includes`.

* Respond to hugoShaka feedback

- Do not display the `status` field.
- Indicate that enum fields can take an integer or a string. This is
  consistent with our comment conventions, which describe both the
  integer and the string values for each enum option.

* Sort CRD reference page sections

Also handle duplicate page sections by including the names of parent
properties within section headings.

* Fix crdgen Makefile targets

- bring test data and hack out of `lib/`
- fix broken debug builds
- add crd-docs checks to the `crds-up-to-date` target
- trigger proto lint on CRD and CRD doc changes
- removed stale gitkeep in `docs/pages/includes/crd-docs/.gitkeep`
- split crdgen formatting logic in another file for readability
- update license header years on new files

* fixup! Fix crdgen Makefile targets

* lint files due to false positive 'generated' comment

* fixup! lint files due to false positive 'generated' comment

* Incorporate rosstimothy feedback

Remove an unnecessary package.

Also regenerate the CRD docs.

* fix debug builds and gitignore

* fixup! fix debug builds and gitignore

* Respond to rosstimothy feedback

Fix integrations/operator/crdgen/Makefile

* Fix spelling

* Fix flaky propertyTable test

Compare the unsorted slice elements, since sorting takes place on the
containing VersionSection.

---------

Co-authored-by: hugoShaka <hugo.hervieux@goteleport.com>
Backports #46259

Teleport Operator reference docs contain a large number of internal link
references that fail the spell checker. Until we find a more scalable
spell check workflow (#46191), ignore these reference docs in the spell
checker.
@ptgott ptgott force-pushed the paul.gottschling/44107-bp-v16 branch from d7b3222 to c52ae01 Compare September 5, 2024 20:01
Copy link

github-actions bot commented Sep 5, 2024

🤖 Vercel preview here: https://docs-b6m1ltcvj-goteleport.vercel.app/docs/ver/preview

@ptgott ptgott added this pull request to the merge queue Sep 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 5, 2024
@fheinecke fheinecke added this pull request to the merge queue Sep 5, 2024
@fheinecke fheinecke removed this pull request from the merge queue due to a manual request Sep 5, 2024
@ptgott ptgott added this pull request to the merge queue Sep 5, 2024
Merged via the queue into branch/v16 with commit 8056670 Sep 5, 2024
41 of 42 checks passed
@ptgott ptgott deleted the paul.gottschling/44107-bp-v16 branch September 5, 2024 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport documentation no-changelog Indicates that a PR does not require a changelog entry size/xl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants