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

Add human-readable specification of Tracing Policy API to web site under Reference #2074

Open
2 tasks done
christian-2 opened this issue Feb 7, 2024 · 4 comments · May be fixed by #2152
Open
2 tasks done

Add human-readable specification of Tracing Policy API to web site under Reference #2074

christian-2 opened this issue Feb 7, 2024 · 4 comments · May be fixed by #2152
Assignees
Labels
kind/enhancement This improves or streamlines existing functionality

Comments

@christian-2
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem?

Currently the best exact description of Tetragon's CRD TraingPolicy resides in the source code (see also #2073). This is sub-optimal. There should be a human-friendly, if machine-generated description of the of Tetragon's tracing policy API available on tetragon.io under Reference.

See here on Slack.

Describe the feature you would like

A fourth section Tracing Policy API should be added to Reference (see above); it would sit next to Daemon Configuration, Helm Chart, and gRPC_API.

Describe your proposed solution

The content should reside under docs/content/en/docs/reference as a collection of HTML files. A pipeline that may be suitable for generating it automatically could perhaps consist of the following steps:

  1. produce description in text format with go doc --all ...
  2. pipe into custom script (or similar) that filters for descriptions of types and their fields only; converts those into JSON schema
  3. "import" JSON schema into OpenAPI
  4. let OpenAPI render static HTML files

Perhaps the model generator from kubernetes/kube-openapi ("goes through .go files, find and generate model definitions") could serve as well.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@christian-2 christian-2 added the kind/enhancement This improves or streamlines existing functionality label Feb 7, 2024
@christian-2
Copy link
Contributor Author

@mtardy I have meanwhile looked how this is done in Kubernetes. If I am not mistaken, its hacks/update-openapi-spec.sh spins up a kube-apiserver as well as etcd and then contacts the first at URL path /openapi/v3 for downloading OpenAPI specifications for the Kubernetes APIs. Since Tetragon can be installed into Kubernetes, downloading an openapi.yaml for its CDR should be possible in the same way. So much for the first step; I have taken that one already.

In a second step static HTML would have to be generated from the downloaded OpenAPI spec. There are apparently suitable tools e.g. in OpenAPITools/openapi-generator, but I have not explored those yet.

Overall, this pipeline seems to be simpler than the one I had originally intended. Feel free to assign this issue to me, if that is of any help. A set of HTML files (in docs/content/en/docs/reference/tracing-policy-api/) plus perhaps a script (in contrib/) would be the likely deliverables.

@christian-2
Copy link
Contributor Author

@mtardy I now have some output from OpenAPITools/openapi-generator. It is ready for a first review, but it is also quite large:

generator size
html 948K
html2 1.5M
markdown 240K

Do you want me to push these files into GitHub or (perhaps better) to provide only instructions on how to generate them locally (suitable e.g. for Debian)?

@christian-2
Copy link
Contributor Author

I have pushed the tree generators's current output to a temporary repository christian-2/tmp. This is to avoid polluting cilium/tetragon at this stage. The markdown version has already proved quite useful.

@mtardy
Copy link
Member

mtardy commented Feb 23, 2024

Sorry I missed your messages, feel free to open a PR if you have something ready. I discussed this online and we were not sure if exposing this doc would be more interesting that the "human version" we have under concepts. Because we thought maybe that easier to use "kubectl explain" (or "tetra explain" as you suggested in another PR).

Of course if you've already invested time in this, please open a PR and we'll take a look on what we can do with it!

I'll assign this issue to you!

christian-2 added a commit to christian-2/tetragon that referenced this issue Feb 26, 2024
This commit includes initial markdown documentation for the
Tracing Policy API, which was generated by OpenAPI Generator.
It is intended as 4th "tile" in the reference section of the
Tetragon online documentation.

fixes cilium#2074

Signed-off-by: Christian Hörtnagl <christian2@univie.ac.at>
christian-2 added a commit to christian-2/tetragon that referenced this issue Mar 21, 2024
(still a draft version: I want to see again how this renders with
Netlify in deploy preview)

This commit includes initial markdown documentation for the
Tracing Policy API, which was generated by OpenAPI Generator.
It is intended as 4th "tile" in the reference section of the
Tetragon online documentation.

HUGO_VERSION was bumped from 0.111.3 to the current version 0.124.1
because Hugo includes an embedded link render hook to resolve
Markdown link destinations, which serves here, since 0.123.0.

fixes cilium#2074

Signed-off-by: Christian Hörtnagl <christian2@univie.ac.at>
christian-2 added a commit to christian-2/tetragon that referenced this issue Mar 21, 2024
* still a draft version: I want to see again how this renders with
  in the deploy preview w/ Netlify

* in the final version /tmp/openapi.json, the input to operapi-generator,
  should be obtained life as part of make docs e.g. from a Minikube cluster
  w/ Tetragon

* in the final version docs/content/en/docs/reference/
  {Apis,Models,tracing-policy-api.md} should be git-ignored
  and generated also as part of make docs instead

* HUGO_VERSION was bumped from 0.111.3 to the current version 0.124.1
  because Hugo includes an embedded link render hook to resolve
  Markdown link destinations, which serves here, since 0.123.0.

* The specification is currently rendered as 5th "tile" in the reference
  section of the Tetragon online documentation.

This commit supports the generation of a human-readable specifition of the
Tracing Policy API from source-code comments.

fixes cilium#2074

Signed-off-by: Christian Hörtnagl <christian2@univie.ac.at>
christian-2 added a commit to christian-2/tetragon that referenced this issue Mar 28, 2024
* switching to generator html (i.e. single HTML page)
* still work in progress

This commit supports the generation of a human-readable specifition of the
Tracing Policy API from source-code comments.

fixes cilium#2074

Signed-off-by: Christian Hörtnagl <christian2@univie.ac.at>
christian-2 added a commit to christian-2/tetragon that referenced this issue Mar 28, 2024
* still a draft version: I want to see again how this renders with
  in the deploy preview w/ Netlify

* in the final version /tmp/openapi.json, the input to operapi-generator,
  should be obtained life as part of make docs e.g. from a Minikube cluster
  w/ Tetragon

* in the final version docs/content/en/docs/reference/
  {Apis,Models,tracing-policy-api.md} should be git-ignored
  and generated also as part of make docs instead

* HUGO_VERSION was bumped from 0.111.3 to the current version 0.124.1
  because Hugo includes an embedded link render hook to resolve
  Markdown link destinations, which serves here, since 0.123.0.

* The specification is currently rendered as 5th "tile" in the reference
  section of the Tetragon online documentation.

This commit supports the generation of a human-readable specifition of the
Tracing Policy API from source-code comments.

fixes cilium#2074

Signed-off-by: Christian Hörtnagl <christian2@univie.ac.at>
christian-2 added a commit to christian-2/tetragon that referenced this issue Mar 28, 2024
* switching to generator html (i.e. single HTML page)
* still work in progress

This commit supports the generation of a human-readable specifition of the
Tracing Policy API from source-code comments.

fixes cilium#2074

Signed-off-by: Christian Hörtnagl <christian2@univie.ac.at>
christian-2 added a commit to christian-2/tetragon that referenced this issue Mar 28, 2024
* switching to generator html (i.e. single HTML page)
* still work in progress

This commit supports the generation of a human-readable specifition of the
Tracing Policy API from source-code comments.

fixes cilium#2074

Signed-off-by: Christian Hörtnagl <christian2@univie.ac.at>
christian-2 added a commit to christian-2/tetragon that referenced this issue Mar 29, 2024
* switching to generator html (i.e. single HTML page)
* still work in progress

This commit supports the generation of a human-readable specifition of the
Tracing Policy API from source-code comments.

fixes cilium#2074

Signed-off-by: Christian Hörtnagl <christian2@univie.ac.at>
christian-2 added a commit to christian-2/tetragon that referenced this issue Mar 29, 2024
* switching to generator html (i.e. single HTML page)
* still work in progress

This commit supports the generation of a human-readable specifition of the
Tracing Policy API from source-code comments.

fixes cilium#2074

Signed-off-by: Christian Hörtnagl <christian2@univie.ac.at>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement This improves or streamlines existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants