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 generated documentation for image restrictions #820

Closed
stgraber opened this issue May 3, 2024 · 6 comments · Fixed by #833
Closed

Add generated documentation for image restrictions #820

stgraber opened this issue May 3, 2024 · 6 comments · Fixed by #833
Assignees
Labels
Documentation Documentation needs updating Easy Good for new contributors
Milestone

Comments

@stgraber
Copy link
Member

stgraber commented May 3, 2024

Incus is slowly moving to automatically generated documentation for its configuration keys.

This can be done through the gendoc:generate type comments in the code, followed by running make update-metadata and consumption in the documentation through {include} ../config-option.txt.

This issue is for the keys defined in doc/image-handling.md to be moved to code in internal/server/instance/drivers/driver_lxc.go and internal/server/instance/drivers/driver_qemu.go.

@stgraber stgraber added Documentation Documentation needs updating Easy Good for new contributors labels May 3, 2024
@stgraber stgraber added this to the soon milestone May 3, 2024
@TinkeringWithUS
Copy link
Contributor

Can I get this assigned? We just to have the gen doc comment above where the parameter is being assigned right?

@stgraber
Copy link
Member Author

stgraber commented May 3, 2024

Done!

@TinkeringWithUS
Copy link
Contributor

Thanks! How can I validate that documentation is correct?

@TinkeringWithUS
Copy link
Contributor

TinkeringWithUS commented May 3, 2024

The defaults in the documentation is a hyphen, -. In the gendoc comment, would it be better for the default to be specified as a blank like so "default: " or just not leave out the default field entirely? And to clarify, since there's no validation section for image requirements, I'm putting the gendoc comments above where the requirements are being checked.
// gendoc:generate(entity=image, group=restrictions, key=privileged) .. if util.IsFalse(d.localConfig["image.requirements.privileged"]) && util.IsTrue(d.expandedConfig["security.privileged"]) { return "", nil, fmt.Errorf("The image used by this instance is incompatible with privileged containers. Please unset security.privileged on the instance") }. Is this fine?

@stgraber
Copy link
Member Author

stgraber commented May 4, 2024

I think we've usually just left out the default value in such cases.

And yeah, right above the actual check is fine for keys like those which don't have a validator.

@TinkeringWithUS
Copy link
Contributor

ss_incus_image_requirements Is this current format fine for image requirements? For comparison, the current key display. ss_incus_regular_image

stgraber pushed a commit to TinkeringWithUS/incus that referenced this issue May 5, 2024
@stgraber stgraber modified the milestones: soon, incus-6.2 May 6, 2024
stgraber pushed a commit that referenced this issue May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Documentation needs updating Easy Good for new contributors
2 participants